From 3d0448b588cee22a3473bd0cc3cae13631ce0cdf Mon Sep 17 00:00:00 2001 From: loicbersier Date: Fri, 27 Dec 2019 22:02:03 +0100 Subject: [PATCH] Check if the message is in starboard before attempting to delete it --- event/listeners/messageReactionRemove.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/event/listeners/messageReactionRemove.js b/event/listeners/messageReactionRemove.js index 2c9d93f2..f94e932a 100644 --- a/event/listeners/messageReactionRemove.js +++ b/event/listeners/messageReactionRemove.js @@ -25,7 +25,7 @@ class messageReactionRemoveListener extends Listener { staremote = this.client.util.resolveEmoji(staremote, reaction.message.guild.emojis).name; } - if (reaction.emoji.name == staremote && reaction.count < starcount) { + if (messageID[reaction.message.id] && reaction.emoji.name == staremote && reaction.count < starcount) { let channel = this.client.channels.get(starboardChannel.starboard); let message = await channel.messages.get(messageID[reaction.message.id]); message.delete(); @@ -45,7 +45,7 @@ class messageReactionRemoveListener extends Listener { shameemote = this.client.util.resolveEmoji(shameemote, reaction.message.guild.emojis).name; } - if (reaction.emoji.name == shameemote && reaction.count < shamecount) { + if (messageID[reaction.message.id] && reaction.emoji.name == shameemote && reaction.count < shamecount) { let channel = this.client.channels.get(shameboardChannel.shameboard); let message = await channel.messages.get(messageID[reaction.message.id]); message.delete();