# discord-interface2

> A discord.js extension to easily create reactions menu's interfaces

Latest version **1.0.1** (published 2019-02-10) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install discord-interface2
pnpm add discord-interface2
yarn add discord-interface2
bun add discord-interface2
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2019-02-10 |
| First published | 2019-02-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 11 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Pedro Pinto |
| Maintainers | extreme_hero |
| Keywords | discord.js, discord-interface |

## Links

- npm: https://www.npmjs.com/package/discord-interface2
- npm.io page: https://npm.io/package/discord-interface2

## Recent versions

- 1.0.1 (latest) — 2019-02-10
- 1.0.0 — 2019-02-10

## README

# About

Discord Interface is a discord.js extension to easily create reactions menus such as [Pagination](#pagination) and [Confirmation](#confirmation). Feel free to fork or pull a request.

# Get Started

```
npm install discord-interface2
```

Just the same package as discord-interface but this supports Discord master version
Link to orginal One - [Click Here](https://www.npmjs.com/package/discord-interface)

# Interfaces

### Pagination

```js
const {Pagination} = require('discord-interface');

let items = ['Banana', 'Apple'];

function getPage(item, pageNumber) {
    return new RichEmbed()
        .setColor('RANDOM')
        .setDescription(item)
        .setFooter(`Page ${pageNumber}/${items.length}`)
}

let pagination = Pagination.create(message, {time: 60000, userID: message.author.id, items: items, getPage: getPage, removeReactions: true});
/* 
If you want to customize the Paginations Reactions add the property "reactions" to the options
Example:

"reactions": {
    "nextPage": "▶",
    "previousPage": "◀",
    "skipToFinal": "⏩",
    "backToStart": "⏪",
    "cancel": "🚫"
}
*/

// Pagination Events
pagination.on('over', timeOver => {
    if (timeOver) {
        // The time is over
    } else {
        // User stopped the collector
    }
});
```

### Confirmation

```js
const {Confirmation} = require('discord-interface');

let confirmation = Confirmation.create(message, {time: 60000, userID: message.author.id});
/* 
If you want to customize the Confirmation Reactions add the property "reactions" to the options
Example:

"reactions": {
    "accept": "✅",
    "decline": "❎"
}
*/

// Confirmation Events
// User confirmation
confirmation.on('confirmation', confirmed => {
    if (confirmed) {
        // User confirmed
    } else {
        // User didn't confirm
    }
});

// Collector ended
confirmation.on('over', timeOver => {
    if (timeOver) {
        // The time is over
    } else {
        // User stopped the collector
    }
});
```

# TODO

* [ ] Create Menu Interface
* [ ] Create Category Menu Interface
* [ ] Create a documentation website

---
_Source: https://npm.io/package/discord-interface2 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
