Reputation:
im trying to create an embed then collect reactions from that embed, everything works as it should until it comes to the collector, it doesnt seem that the collecter is recognizing the reactions i am giving it.
The code is as follows:
let embed = new Discord.MessageEmbed();
message.channel.send(embed).then(embedMessage => {
embedMessage.react('🍇');
const filter = (reaction) => {
return reaction === '🍇'
};
const collector = new Discord.ReactionCollector(embedMessage, filter, {
time: 15000
});
collector.on('collect', (reaction) => {
console.log('reaction received:' + reaction)
});
collector.on('end', collected => {
console.log('Collecter Expired')
});
});
Upvotes: 0
Views: 217
Reputation: 4520
The issue is that your filter is checking if reaction == 'some emoji'
. However, reaction
is actually a MessageReaction object, not a string representation of what the emoji is. If you want the string representation, you'll need to use reaction.emoji.name
instead.
let embed = new Discord.MessageEmbed()
.embedStuff();
message.channel.send(embed).then(embedMessage => {
embedMessage.react('🍇');
const filter = (reaction) => {
return reaction.emoji.name == '🍇'
};
const collector = new Discord.ReactionCollector(embedMessage, filter, {
time: 15000
});
collector.on('collect', (reaction) => {
console.log('reaction received:' + reaction.emoji.name)
});
collector.on('end', collected => {
console.log('Collecter Expired')
});
});
Upvotes: 1