Reputation:
I looked everywhere, but my question is never answered. Here is what I want to do, in simple terms.
When a user reacts to a message in the following code, it will dm them saying 'you reacted!'
collector.on('collect', (reaction, reactionCollector) => {
// I tried: reaction.author.send, doesn't work.
});
Upvotes: 0
Views: 1520
Reputation: 2722
The fist its great reaction collector after some trigger, and then handle emoji. But this work only for certain time.
message.channel.send('Your Text').then(msg=> {
msg.react(`◀️`)
const filter = (reaction, user) => {
return [`◀️`].includes(reaction.emoji.name) && user.id === message.author.id;
};
const collector = msg.createReactionCollector(filter, {time: 60000 });
collector.on('collect', (reaction, reactionCollector) => {
reaction.users.last().send('Some')
.catch(console.error)
});
})
If you need handle it all time in specific message, you can listen event reaction_add
bot.on('messageReactionAdd', (reaction, user) => {
if(reaction.message.id !== 'YOUR MESSAGE ID') return
user.send('Some')
.catch(console.error)
});
Upvotes: 1