Reaction collector does not seem to work for me , i am expecting to be able to collect reactions on a message or embed.
Here is the slash command i created
js const { SlashCommandBuilder } = require('discord.js'); // Create a slash command module.exports = { data: new SlashCommandBuilder() .setName('ping') .setDescription('Replies with Pong!'), async execute(interaction) { // Reply with a regular message await interaction.reply('Pong! This is a simple response.'); // Log to console when someone uses the command console.log(`User ${interaction.user.tag} used the /ping command.`); // Listen for an interaction with an emote const collectorFilter = (reaction, user) => { return reaction.emoji.name === ':thumbsup:' && user.id === interaction.user.id; }; const collector = interaction.channel.createMessageComponentCollector({ filter: collectorFilter, time: 15000, // 15 seconds }); collector.on('collect', (interaction) => { console.log(`User ${interaction.user.tag} reacted with 👍`); }); collector.on('end', (collected, reason) => { console.log(`Collected ${collected.size} items. Reason: ${reason}`); }); }, };
js const { SlashCommandBuilder } = require('discord.js'); // Create a slash command module.exports = { data: new SlashCommandBuilder() .setName('ping') .setDescription('Replies with Pong!'), async execute(interaction) { // Reply with a regular message await interaction.reply('Pong! This is a simple response.'); // Log to console when someone uses the command console.log(`User ${interaction.user.tag} used the /ping command.`); // Listen for an interaction with an emote const collectorFilter = (reaction, user) => { return reaction.emoji.name === ':thumbsup:' && user.id === interaction.user.id; }; const collector = interaction.channel.createMessageComponentCollector({ filter: collectorFilter, time: 15000, // 15 seconds }); collector.on('collect', (interaction) => { console.log(`User ${interaction.user.tag} reacted with 👍`); }); collector.on('end', (collected, reason) => { console.log(`Collected ${collected.size} items. Reason: ${reason}`); }); }, };
and the results i get in console after reacting:
User xxxx used the /ping command. Collected 0 items. Reason: time
I have verified permissions on the developer site: Permissions are: application commands, bot, manage messages, send messages, read messages. I have many other slash commands and functions working.
I have tried this with an embed and regular message. I have tried to listen for any reaction, as i thought it could be the type of thumbs up.