I've an issue with messageReactionAdd with floowing code :
bot.on("ready", () =>
{
// I cache the selected message declared before in message_id and channel_id
bot.channels.cache.get(channel_id).messages.fetch(message_id).then(m => {
console.log("Cached reaction message.");
}).catch(e => {
console.error("Error loading message.");
console.error(e);
});
})
bot.on("messageReactionAdd", (reaction, user) => {
if(reaction.emoji.name == "" && reaction.message.id === message_id)
try {
const role = reaction.message.channel.guild.roles.cache.find(role => role.name == "Membres");
reaction.message.guild.member(user).roles.add(role);
} catch {
console.log('Error : can\'t add the role');
}
});
The problem is that code works only with the owner of the cached message not with other user in the channel.
Do you know why ?