So I am making Discord bot for my server and it works pretty well so far, save for one issue which seems really small, but I can't find solution despite reading documentation.
Basically I send embed with reactions and it works fine, but if someone doesn't react within particular amount of time, bot creates another emoji reaction and here's the issue. I want it to collect the very first person who reacts to new emoji instead of message author. Here's this part of the code:
.catch(collected => {
message.channel.sendMessage("You run out of time, maybe someone else wants it?");
const filter = (reaction, user) => {
return ['????'].includes(reaction.emoji.name) && user.id === message.author.id;
};
embedMessage.react('????');
embedMessage.awaitReactions(filter, {
max: 1,
time: 45000,
errors: ['time']
}).then(collected => {
const reaction = collected.first();
if (reaction.emoji.name === '????'){
message.channel.sendMessage("Yay.");
}
});
});
So I wonder if this is about this part:
return ['????'].includes(reaction.emoji.name) && user.id === message.author.id;
I tried replacing message.author.id with reaction.users, but it doesn't seem to work.