2

How can I mention the user who reacted to my bot message?
I want to send message like, "@user reacted to my message!", here is my code:

msg.awaitReactions((reaction, user) => user.id == user.id && (reaction.emoji.name == ''), { max: 1, time: 30000 }).then(collected => {
    if (collected.first().emoji.name == '') {
        //here I want to send the message with the mention
    } else {
        //I added it for case that I going to use yes or no react question
    }
}).catch(() => {
    //maybe I will add here message that says the time passed.
});
Tyler2P
  • 2,324
  • 26
  • 22
  • 31
yair
  • 41
  • 4
  • 1
    Does [this](https://discordjs.guide/popular-topics/collectors.html#reaction-collectors) help you? – Toasty Apr 06 '21 at 13:17

1 Answers1

2

After reading articles and troubleshooting I came up with the following solution:

    msg.awaitReactions((reaction, user) => user.id == user.id && (reaction.emoji.name == ''),
    { max: 1, time: 30000 }).then(collected => {
        const reaction = collected.first();
        if (collected.first().emoji.name == '') {
            const member = reaction.users.cache.find((user) => !user.bot);
            message.channel.send(`test is ${member}`)
        } else {
            //I added it for case that I gonna use yes or no react question
}
    }).catch(() => {
        //maybe I will add here message that says the time passed.
    });
yair
  • 41
  • 4