Help with Message Reaction Collectors

Hello, Version: 14.21 I'm not sure if I am just missing something really obvious here, but I can't seem to get the Message#createReactionCollector() to acknowledge reactions on a message. Here is my code:
import { ChatInputCommandInteraction, MessageReaction, SlashCommandBuilder, User } from "discord.js";

export const data = new SlashCommandBuilder()
.setName("test")
.setDescription("test");

export async function execute(interaction: ChatInputCommandInteraction) {
const response = await interaction.reply({ content: "test", withResponse: true });
const message = response.resource?.message;
const collector = message?.createReactionCollector({
filter: (reaction: MessageReaction, user: User) => reaction.emoji.name === "❤️" && user.id === interaction.user.id,
time: 300_000
});
collector?.on("collect", (reaction: MessageReaction, user: User) => {
console.log("collected");
});
}
import { ChatInputCommandInteraction, MessageReaction, SlashCommandBuilder, User } from "discord.js";

export const data = new SlashCommandBuilder()
.setName("test")
.setDescription("test");

export async function execute(interaction: ChatInputCommandInteraction) {
const response = await interaction.reply({ content: "test", withResponse: true });
const message = response.resource?.message;
const collector = message?.createReactionCollector({
filter: (reaction: MessageReaction, user: User) => reaction.emoji.name === "❤️" && user.id === interaction.user.id,
time: 300_000
});
collector?.on("collect", (reaction: MessageReaction, user: User) => {
console.log("collected");
});
}
8 Replies
d.js toolkit
d.js toolkit5mo ago
Amgelo
Amgelo5mo ago
what are your intents
Madeline
MadelineOP5mo ago
Message Content, Guild Members, Presences and Administrator permissions this is a test bot only installed on one server at the moment
Amgelo
Amgelo5mo ago
you also need the GuildMessageReactions intent permissions are unrelated
Madeline
MadelineOP5mo ago
Oh! Thank you, I didn't realize
Amgelo
Amgelo5mo ago
and the Guild intent as well for most caches to work, probably includes the emoji cache
Madeline
MadelineOP5mo ago
working now! thanks so much :nya_flowers_pink:
d.js toolkit
d.js toolkit5mo ago
The thread owner has marked this issue as solved.

Did you find this page helpful?