Reputation: 43
I have a problem with the messageReactionAdd
event, it only works after a message is sent inside the discord.
I also tried to put a console.log
at the beginning of the event but not even that is triggered.
This is my code:
module.exports = async (client, reaction, user) => {
if(reaction.message.partial) await reaction.message.fetch();
if(reaction.partial) await reaction.fetch();
if(user.bot) return;
if(reaction.message.channel.id === '837981337658589204') {
reaction.users.remove(user);
if(reaction.emoji.name === '🐬') {
//code...
}
}
partials:
const client = new discord.Client({ partials: ['MESSAGE', 'REACTION']});
i have tried all the methods found on this site but it still doesn't work.
Edit: The solution to all of this was to activate Privileged Gateway Intents on the bot page, like that. Thanks to @Toasty
Upvotes: 1
Views: 127
Reputation: 1880
I think you don't need to check if the message
is partial
, but if the reaction
is partial
. Try this:
try {
if(reaction.partial) await reaction.fetch();
if(user.partial) await user.fetch();
} catch(err) {
console.log('Error: ' + err);
}
In the official guide
it is checked if the message
is partial
, but this example is not about the messageReactionAdd
event
After looking through the guide again, I remembered one thing:
Try enabling Privileged Intents
in the Discord Developer Portal
under "Privileged Gateway Intents" in the "Bot" section.
If you don't know what I mean, look at this screenshot. Just enable these and it may work now.
Upvotes: 1