Discord.js: How to send a message and collect reactions from it

后端 未结 1 1296
暖寄归人
暖寄归人 2021-01-25 22:04

I want the discord.js bot to send a message when a command is executed, react on it and then catch all reactions from users to do certain stuff, like respond to them. No time li

相关标签:
1条回答
  • 2021-01-25 22:46

    Why not include the Collector in your command.js?

     const time = 60000 //amount of time to collect for in milliseconds
    
     receivedMessage.channel.send("Hello World")
     .then(async function (message) {
          await message.react('✅')
          const filter = (reaction, user) => {
               return //YOUR FILTER HERE;
          };
    
          const collector = message.createReactionCollector(filter, { time: time });
    
          collector.on('collect', (reaction, reactionCollector) => {
               //do stuff
          });
     });
    
    0 讨论(0)
提交回复
热议问题