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 toolkit10mo 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
NyR10mo ago
Enable Reaction partial
d.js docs
d.js docs10mo ago
:guide: Popular Topics: Partial Structures read more
ProphecyOak
ProphecyOakOP10mo 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
NyR10mo ago
So does that log you have there logs when you remove an uncached reaction?
ProphecyOak
ProphecyOakOP10mo ago
It does not there is no response at all from the event listener
NyR
NyR10mo ago
And it works for cached ones?
ProphecyOak
ProphecyOakOP10mo ago
yep as far as i can tell
NyR
NyR10mo 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
ProphecyOakOP10mo 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 User10mo ago
Message Not Public
Sign In & Join Server To View

Did you find this page helpful?