Reaction Collector doesn't work as intended

So the code for reaction collector doesn't work, i was following a tutorial and i rechecked every single line a few times still doesn't work as intended.
const { SlashCommandBuilder } = require(`discord.js`);

module.exports = {
data: new SlashCommandBuilder()
.setName(`reactor`)
.setDescription(`Returns reactions`),

async execute(interaction, client) {
const message = await interaction.reply({
content: `React here!`,
fetchReply: true,
});

const emoji = client.emojis.cache.find(
(emoji) => emoji.id == `1284587267565944922`
);

message.react(emoji);
message.react(":white_check_mark:");

const filter = (reaction, user) => {
return reaction.emoji.name == ":white_check_mark:" && user.id == interaction.user.id;
};

const collector = message.createReactionCollector({ filter, time: 10000 });

collector.on('collect', (reaction, user) => {
console.log(`Collected ${reaction.emoji.name} from ${user.tag}`);
});

collector.on('end', (collected) => {
console.log(`Collected ${collected.size} items`);
});
},
};
const { SlashCommandBuilder } = require(`discord.js`);

module.exports = {
data: new SlashCommandBuilder()
.setName(`reactor`)
.setDescription(`Returns reactions`),

async execute(interaction, client) {
const message = await interaction.reply({
content: `React here!`,
fetchReply: true,
});

const emoji = client.emojis.cache.find(
(emoji) => emoji.id == `1284587267565944922`
);

message.react(emoji);
message.react(":white_check_mark:");

const filter = (reaction, user) => {
return reaction.emoji.name == ":white_check_mark:" && user.id == interaction.user.id;
};

const collector = message.createReactionCollector({ filter, time: 10000 });

collector.on('collect', (reaction, user) => {
console.log(`Collected ${reaction.emoji.name} from ${user.tag}`);
});

collector.on('end', (collected) => {
console.log(`Collected ${collected.size} items`);
});
},
};
it does not throw any errors, but it collects 0 reactions, Thanks in Advance! Node.js version: v20.17.0 Discord.js version: 14.16.1
4 Replies
d.js toolkit
d.js toolkitโ€ข4mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - โœ… Marked as resolved by OP
โ˜ƒAlex<33๐ŸŽ„
โ˜ƒAlex<33๐ŸŽ„OPโ€ข4mo ago
by the way ping me because i do not always see messages so i should put message.react(U00002705)? okay ill fix that i just need to fix the Interaction has already been acknowledged. error okay um it doesnt work- still doesn't work
d.js docs
d.js docsโ€ข4mo ago
If you aren't getting any errors, try to place console.log checkpoints throughout your code to find out where execution stops. - Once you do, log relevant values and if-conditions - More sophisticated debugging methods are breakpoints and runtime inspections: learn more
โ˜ƒAlex<33๐ŸŽ„
โ˜ƒAlex<33๐ŸŽ„OPโ€ข4mo ago
tried without filter, it doesn't notice reactions so basically the bot says React Here! but when a user reacts it doesn't notice it const client = new Client({ intents: [Guilds, GuildMessages] }); ohh okay it was solved by just doing const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMessageReactions] });
Want results from more Discord servers?
Add your server