From 9dd020716f597f9cb1ccb4823175896c22572e0e Mon Sep 17 00:00:00 2001 From: Rasmus Gerdin Date: Mon, 24 Aug 2020 17:40:23 +0200 Subject: [PATCH] fix: msg content checks on messageUpdate event Fixes #141. Fixes RTBYTE-H in Sentry. --- src/events/rtbyteMessageUpdate.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/events/rtbyteMessageUpdate.js b/src/events/rtbyteMessageUpdate.js index 729e262f..fb1102d0 100644 --- a/src/events/rtbyteMessageUpdate.js +++ b/src/events/rtbyteMessageUpdate.js @@ -28,11 +28,11 @@ module.exports = class extends Event { .setAuthor(msg.author.tag, msg.author.displayAvatarURL()) .setColor(this.client.settings.get('colors.blue')) .setDescription(`${msg.channel}\n[${msg.language.get('CLICK_TO_VIEW')}](${msg.url})`) - .addField(msg.language.get('GUILD_LOG_BEFORE'), truncate(old.content)) - .addField(msg.language.get('GUILD_LOG_AFTER'), truncate(msg.content)) .setTimestamp() .setFooter(msg.language.get('GUILD_LOG_MESSAGEUPDATE')); + if (old.content) embed.addField(msg.language.get('GUILD_LOG_BEFORE'), truncate(old.content)); + if (msg.content) embed.addField(msg.language.get('GUILD_LOG_AFTER'), truncate(msg.content)); const logChannel = await this.client.channels.cache.get(msg.guild.settings.get('channels.log')); if (logChannel) await logChannel.send('', { disableEveryone: true, embed: embed });