I have a discord bot that when when a certain number of reactions received, it stops any more users from reacting. This is the event listener that does that:
bot.on("messageReactionAdd", (reaction, user) => {
if (
reaction.emoji.name === "️♂️" &&
reaction.message.author.bot &&
user.id !== "773710233977618464"
) {
const spotsLeft = reaction.message.embeds[0].fields[1].value;
if (spotsLeft == 0) {
return reaction.users.remove(user.id);
}
...
}
However, this is triggering my MessageReactionRemove event later, which I do not want triggered. I have tried to filter that out with the following:
bot.on("messageReactionRemove", (reaction, user) => {
if (
reaction.emoji.name === "️♂️" &&
reaction.message.author.bot &&
user.id !== "773710233977618464"
) {
...
I have tried !user.bot and several other things, but every time I console log from what I can tell it looks like the reaction removal is coming from a user. I console.log(user.id) and it is the person whose reaction was removed ID.
How do I tell DiscordJS "if this is triggered by Javascript or a bot, do nothing"?