I'm making my first discord bot and I'm trying to make it send a message after I react to one of its emojis, problem is, when I click the thumbs up emoji, the bot simply does not send the message, it's been a few hours now and I can't find the problem, I'm sorry if this has been solved somewhere else, I couldn't find anything that works.
if (command === "ping") {
const attachment = new MessageAttachment('https://cdn.mcr.ea.com/3/images/ac394369-2801-4e09-87eb-82ca54e26254/1588018258-0x0-0-0.jpg');
const sentMessage = await message.channel.send({files: [attachment] })
sentMessage.react('๐');
//sentMessage.react('๐');
const filter = (reaction, user) => {
return reaction.emoji.name === '๐' && user.id === message.author.id;
};
const collector = sentMessage.createReactionCollector(filter, { time: 15000 });
collector.on('collect', (reaction, user) => {
message.channel.send(`Collected ${reaction.emoji.name} from ${user.tag}`);
});
collector.on('end', collected => {
message.channel.send(`Collected ${collected.size} items`);
console.log(`Collected ${collected.size} items`);
});
EDIT
I found that I was missing the "GUILD_MESSAGE_REACTIONS" intent, now i have these 3 "GUILDS", "GUILD_MESSAGES", "GUILD_MESSAGE_REACTIONS", still not working sadly!
Here's the full code: https://pastebin.com/Q0eZ6VSz
Hi, this code is working except a small thing...
sentMessage.createReactionCollector(filter, { time: 15000 });
change this to:
sentMessage.createReactionCollector({filter, time: 15000 });
also I suggest you to add max: 1 option too.
so final code:
...
sentMessage.createReactionCollector({filter, max: 1, time: 15000 });
in this situation only gets first react by you.