1.0.1 • Published 5 years ago
discord-interface2 v1.0.1
About
Discord Interface is a discord.js extension to easily create reactions menus such as Pagination and 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
Interfaces
Pagination
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
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