I am coding a Discord bot in Discord.js. I want to make it so when a member joins the server they have to react to a message in a certain channel to get a role. But for some reason, if a message was sent before I turned the bot on, it would not detect it if that message was reacted to and only messages after the bot was on were detected.
Here is the code I tried first:
bot.on("messageReactionAdd", (reaction, users) => {
console.log("reaction");
if (reaction.message.channel.name == "rules") {
console.log("rules")
} else {
console.log("not rules");
}
});
It told the the channel the reaction was in and if a message was reacted to but only if the message was sent after the bot started.
In desperation, I tried this code next:
bot.on("messageReactionAdd", () => {
console.log("reaction");
});
It did the same thing as the other code.
I want it to detect a reaction even if the message was send before the bot was started.