From 238497110c58f7ab98eae654a6b7f1b95f4c05b2 Mon Sep 17 00:00:00 2001 From: Abheek Dhawan Date: Tue, 6 Apr 2021 16:37:11 -0500 Subject: [PATCH] Log only reaction deletes and set the number of emojis to be 0 if no emoji with that ID is found on the message --- bot.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/bot.js b/bot.js index 7d79acb..223c5e1 100644 --- a/bot.js +++ b/bot.js @@ -913,7 +913,7 @@ client.on('messageReactionAdd', (messageReaction, user) => { if (result.bot_logs_id) { botLogsChannel = result.bot_logs_id; if (message.guild.channels.cache.get(botLogsChannel)) { - message.guild.channels.cache.get(botLogsChannel).send(messageReactionAddEmbed).catch(console.error); + // message.guild.channels.cache.get(botLogsChannel).send(messageReactionAddEmbed).catch(console.error); } } if (result.kulboard_id) { @@ -948,14 +948,20 @@ client.on('messageReactionAdd', (messageReaction, user) => { }); }); -client.on('messageReactionRemove', (messageReaction, user) => { - messageReaction.message.channel.messages.fetch(messageReaction.message.id) +client.on('messageReactionRemove', async (messageReaction, user) => { + await messageReaction.message.channel.messages.fetch(messageReaction.message.id) .then(message => { const emoji = messageReaction.emoji.name; const emojiID = messageReaction.emoji.id; let numEmoji; let coolness; - message.reactions.cache.get(emojiID) ? numEmoji = message.reactions.cache.get(emojiID).count : numEmoji = message.reactions.cache.get(emoji).count; + if (!message.reactions.cache.get(emojiID)) { + numEmoji = 0; + } else if (message.reactions.cache.get(emojiID)) { + numEmoji = message.reactions.cache.get(emojiID).count; + } else { + numEmoji = message.reactions.cache.get(emoji).count; + } if (numEmoji > 6 && numEmoji <= 9) { coolness = '<:cool_finger_guns:828632824512512030> *Very* Kül Message' } else if (numEmoji > 9) {