From 11910dad505f108ff2fa6b247b878b869cc0eebb Mon Sep 17 00:00:00 2001 From: loicbersier Date: Tue, 15 Jan 2019 19:22:23 +0100 Subject: [PATCH] Dosen't send embed when empty message --- event/listeners/messageReactionAdd.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/event/listeners/messageReactionAdd.js b/event/listeners/messageReactionAdd.js index 524666af..542a10fd 100644 --- a/event/listeners/messageReactionAdd.js +++ b/event/listeners/messageReactionAdd.js @@ -25,6 +25,9 @@ class MessageReactionAddListener extends Listener { let starboardChannel = reload(`../../board/star${reaction.message.guild.id}.json`); const channel = this.client.channels.get(starboardChannel['starboard']); + if (!messageContent) + return channel.send(`${reaction.message.author.username}, in: ${reaction.message.channel} ID: ${reaction.message.id} \n${messageAttachments}`); + const starEmbed = new MessageEmbed() .setColor(reaction.message.member.displayHexColor) .setDescription(messageContent) @@ -32,7 +35,7 @@ class MessageReactionAddListener extends Listener { .setTimestamp(); channel.send({ embed: starEmbed}); - return channel.send(`From: ${reaction.message.channel} ID: ${reaction.message.id} \n${messageAttachments}`); + return channel.send(`in: ${reaction.message.channel} ID: ${reaction.message.id} \n${messageAttachments}`); } //Shameboard if (reaction.emoji.name === '✡' && reaction.count === 4) { @@ -44,6 +47,9 @@ class MessageReactionAddListener extends Listener { let shameboardChannel = reload(`../../board/shame${reaction.message.guild.id}.json`); const channel = this.client.channels.get(shameboardChannel['shameboard']); + if (!messageContent) + return channel.send(`${reaction.message.author.username}, in: ${reaction.message.channel} ID: ${reaction.message.id} \n${messageAttachments}`); + const shameEmbed = new MessageEmbed() .setColor(reaction.message.member.displayHexColor) .setDescription(messageContent) @@ -51,7 +57,7 @@ class MessageReactionAddListener extends Listener { .setTimestamp(); channel.send({ embed: shameEmbed}); - return channel.send(`From: ${reaction.message.channel} ID: ${reaction.message.id} \n${messageAttachments}`); + return channel.send(`in: ${reaction.message.channel} ID: ${reaction.message.id} \n${messageAttachments}`); } } }