djs-collector

0.1.2-beta • Public • Published

djs-collector

npm version npm downloads

npm banner

Installation

npm :

npm install djs-collector

yarn :

yarn add djs-collector

Setup ReactionCollector:

const {ReactionCollector} = require("djs-collector");
const client = new Client()//discord.js

client.on("messageCreate" , (message)  => {
    if(message.content == "help"){
        let msg = message.channel.send("help , 1️⃣ 2️⃣ 3️⃣ select one");
        let Collector = new ReactionCollector()
      .setMessage(msg)//required
      .setTimeout(10000)/// remove it if you want unlimted time
      .setFilter((reaction, user) => user.id == user.id)//reactions already filterd
      .setBots(false)// false to reactions not working for bots // default false
      .addReactions([
        "1️⃣",
        "2️⃣",
        "3️⃣",
      ]).setOnEnd(() =>
      msg.delete()
      ))
      .start();//to start collect

    }
})

Set up MessageCollector :

const { MessageCollector } = require("djs-collector");
const client = new Client(); //discord.js

client.on("messageCreate", (message) => {
  if (message.content == "fast") {
    let collector = new MessageCollector()
      .setChannel(message.channel)
      .setTimeout(10000)
      .setFilter((message) => message.content == "hi")
      .setBots(false)// false to filterd bot // default false
      .setOnStart(() => {
        message.channel.send("fast is started first one type `hi`");
      })
      .setMax(1).start();
      collector.on("collect" , (message) => {
        message.channel.send(`<@!${message.author.id}> , you win !!`)
      })
  }
});

Package Sidebar

Install

npm i djs-collector

Weekly Downloads

12

Version

0.1.2-beta

License

ISC

Unpacked Size

23.6 kB

Total Files

10

Last publish

Collaborators

  • andm-19