Home > OS >  What is the best way of figuring out when someone reacts to a message (discord.js)
What is the best way of figuring out when someone reacts to a message (discord.js)

Time:10-13

I am trying to figure out if someone reacted to a message sent by the bot. I have tried reactions.awaitReactions() but you must select a time and I just want to respond after they react. Is there any way of doing this?

enter image description here

CodePudding user response:

You can listen to reactions on old messages with messageReactionAdd event. More info

client.on('messageReactionAdd', async (reaction, user) => {

console.log(`${reaction.message.id}`); // message-id
console.log(`${reaction.message.content}`); // message-content
console.log(`${reaction.count}`); // how many reactions does this emoji have
?
});

or make a message yourself and listen to it. More info

let message = await message.channel.send({content: 'Hello! Please react this message with            
  • Related