From bdf9df515c37ff0d645554af1e116f186b37bf01 Mon Sep 17 00:00:00 2001 From: Abheek Dhawan Date: Fri, 2 Apr 2021 21:28:58 -0500 Subject: [PATCH] Fallback to [NONE] if the reacted message has no text --- index.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 96c8eb8..5ac5a2a 100644 --- a/index.js +++ b/index.js @@ -469,7 +469,10 @@ client.on('messageReactionAdd', (messageReaction, user) => { const userTag = user.tag; const emoji = messageReaction.emoji.name; const numEmoji = messageReaction.count; - const messageContent = messageReaction.message.content; + let messageContent = messageReaction.message.content; + if (!messageContent) { + messageContent = "[NONE]"; + } let channelCategory; const messageReactionAddEmbed = new Discord.MessageEmbed() .setTitle("Reaction Added") @@ -492,7 +495,10 @@ client.on('messageReactionAdd', (messageReaction, user) => { client.on('messageReactionRemove', (messageReaction, user) => { const userTag = user.tag; const emoji = messageReaction.emoji.name; - const messageContent = messageReaction.message.content; + let messageContent = messageReaction.message.content; + if (!messageContent) { + messageContent = "[NONE]"; + } let channelCategory; const messageReactionRemoveEmbed = new Discord.MessageEmbed() .setTitle("Reaction Removed")