djs-reaction-collector
v2.9.3
Published
Easily Create Reaction Collectors on discord.js v12
Downloads
11
Maintainers
Readme
Discord JS Reaction Collector
A simple package to use discord.js v12
reaction collectors.
Important Links
Install
First install the package
npm i djs-reaction-collector
Importing
// Using discord.js
const collector = require('djs-reaction-collector');
// Using typescript
import collector from "djs-reaction-collector";
Examples
Pagination
//INITIALIZATION
const { pagination } = require('djs-reaction-collector')
const Discord = require('discord.js');
const lol = new Discord.MessageEmbed();
pages = [
lol,
lmao
];
//DEFAULT TIME IS 12 SECS
//const timeout = 30000; IN MILLISECONDS FOR CUSTOM TIME
pagination(message, pages, emojiList, timeout);
Confirm
//INITIALIZATION
const { confirm } = require("djs-reaction-collector")
//EXAMPLE OF SENDING MESSAGE
message.channel.send("Do you want to send the message?").then(async (message) => {
const reactions = await confirm(message, message.author, ["✅", "❌"], 10000); //TIME IS IN MILLISECONDS
if(reactions === "✅") {
message.channel.send("Hello All")
}
if(reactions === "❌") {
return;
}
else {
console.log("Timed Out")
}
})
Delete Timeout
//INITIALIZATION
const { deletetimeout } = require("djs-reaction-collector")
//EXAMPLE OF A MESSAGE
const deletion = await message.channel.send("DJS REACTION COLLECTOR");
//USING FUNCTION
deletetimeout(message, deletion, 5000) //TIME IN MILLISECONDS