Why is it giving me that error? How can I define emoji? IT should just check if the reaction was with that emoji.
.then(function (message, reaction) {
message.react("🇦")
message.react("🇧")
const filter = (reaction, user) => {
return ['🇦', 'B'].includes(reaction.emoji.name) && user.id === message.author.id;
};
message.awaitReactions(filter, { max: 1 })
.then(collected => {
if (reaction.emoji.name === '🇦') {
message.channel.send('Ok, so you want to buy a server. Let me recommend you to visit <#699374469977735208>.');
}
else {
message.channel.send('Ok, so you need more informations first. Let me recommend you to visit <#699374469977735208>.');
}
})
});
reaction
is not returned by whatever method you're calling directly before the code you showed. Remove the parameter from the callback function. Then, to access the reaction applied, you need to read it from the Collection returned by Message#awaitReactions()
. For example...
.then(collected => {
const reaction = collected.first();
// now you can check the reaction with the code you were using
})