Way to listen for MessageReactionRemove when the messages aren't cached

I am trying to detect when reactions are removed from a post in a forum channel. The relevant code looks like this:
client.on(Events.MessageReactionRemove, async (reaction, user) => {
console.log("Event: Reaction Removed");
if (reaction.emoji.name === '🍉') {
await eventHandler.reactionRemoved(reaction, user, client);
}
});
client.on(Events.MessageReactionRemove, async (reaction, user) => {
console.log("Event: Reaction Removed");
if (reaction.emoji.name === '🍉') {
await eventHandler.reactionRemoved(reaction, user, client);
}
});
However, if I react with the 🍉 and then boot the bot up, and then remove it, it doesn't detect it. On the other hand, if I add the reaction while the bot is already up and then remove it, it does detect it.
11 Replies
d.js toolkit
d.js toolkit5mo 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
NyR
NyR5mo ago
Enable Reaction partial
d.js docs
d.js docs5mo ago
:guide: Popular Topics: Partial Structures read more
ProphecyOak
ProphecyOak5mo ago
as far as I can tell I have enabled them
const client = new Client({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMessageReactions],
partials: [Partials.Message, Partials.Channel, Partials.Reaction],
});
const client = new Client({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMessageReactions],
partials: [Partials.Message, Partials.Channel, Partials.Reaction],
});
NyR
NyR5mo ago
So does that log you have there logs when you remove an uncached reaction?
ProphecyOak
ProphecyOak5mo ago
It does not there is no response at all from the event listener
NyR
NyR5mo ago
And it works for cached ones?
ProphecyOak
ProphecyOak5mo ago
yep as far as i can tell
NyR
NyR5mo ago
Hmm, not sure then, it should be working. Ideally you'd need to check if reaction is a partial (and fetch it if it is), but since you are saying it doesn't even fire the event.
ProphecyOak
ProphecyOak5mo ago
alright well ill keep experimenting then https://github.com/discordjs/discord.js/issues/3123 this seems to be related but others weren't able to reproduce it and its on an outdated version @NyR I have solved it I needed the User partial solution found here: https://github.com/discordjs/discord.js/issues/6662
Unknown User
Unknown User5mo ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server