Hello, as requested from @almostSouji from the Discord.JS server, I've opened this issue. Basically I was testing out Gateway Intents with Partials, and I've noticed a couple of things:
I made a video about this, you don't have to watch the whole thing, just skip to 8:40 and see what happens when I restart the bot, react to an un-cached message - it does not trigger the message reaction add event. When I do send a message and react to it, the event is then triggered.
Skip to 8:40 https://youtu.be/RMP5FuIBgWA?t=520
I also just tested this now with all the events in 1 file and the same issue occurs, reactions only work on cached messages, but not on un-cached messages.
const { Client } = require('discord.js');
const client = new Client({
ws: {
intents: ['GUILD_MESSAGES', 'GUILDS', 'GUILD_MESSAGE_REACTIONS']
},
partials: ['REACTION', 'MESSAGE']
});
client.on('ready', () => {
console.log('logged in')
})
client.on('message', msg => {
console.log(msg);
});
client.on('messageReactionAdd', (reaction, user) => {
console.log(`${reaction.emoji.name} was added.`)
});
client.login('token');
pretty sure you need the User intent for uncached messages sent by a user who wasn't cached yet, or the GuildPresences intent to actually be able to cache online members/users on GuildCreate events
when you have the GuildPresences intent disabled, discord only sends you the bot and people in voice channels as guild members iirc, so no one else in the guild is cached until they send a message or are fetched
so you need the User partial to receive events for their uncached messages from their uncached selves
Thank you for making this issue, I unfortunately totally lost track of it (despite that being precisely the reason why I asked you to put it on the GH in the first place)
pretty sure you need the User intent
The relevant intent is called "GUILD_PRESENCES", there is no user intent, maybe you mean the "USER" partial, as that too can help to solve this issue.
Solutions:
"GUILD_PRESENCES" intent (privileged)"USER" partial typethe relevant code reference preventing the event to emit is: https://github.com/discordjs/discord.js/blob/d827544fbd12e827fb4b6ff99d8894ecd79ede02/src/client/actions/MessageReactionAdd.js#L18-L19
Relevant comment in another issue https://github.com/discordjs/discord.js/issues/4310#issuecomment-645954864
EDIT: I have applied a tip for this on the guide with https://github.com/discordjs/guide/commit/5e11b51c9cddd8b024bb89456dee25e3a6edb3bf
Most helpful comment
Thank you for making this issue, I unfortunately totally lost track of it (despite that being precisely the reason why I asked you to put it on the GH in the first place)
The relevant intent is called
"GUILD_PRESENCES", there is no user intent, maybe you mean the"USER"partial, as that too can help to solve this issue.Solutions:
"GUILD_PRESENCES"intent (privileged)"USER"partial typethe relevant code reference preventing the event to emit is: https://github.com/discordjs/discord.js/blob/d827544fbd12e827fb4b6ff99d8894ecd79ede02/src/client/actions/MessageReactionAdd.js#L18-L19
Relevant comment in another issue https://github.com/discordjs/discord.js/issues/4310#issuecomment-645954864
EDIT: I have applied a tip for this on the guide with https://github.com/discordjs/guide/commit/5e11b51c9cddd8b024bb89456dee25e3a6edb3bf