From ad5ed9cf2c6a473a130cc13453e14f61ab465b16 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Mon, 12 Aug 2019 08:28:04 +0200 Subject: [PATCH] if message come from nsfw channel, add spoiler --- event/listeners/messageReactionAdd.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/event/listeners/messageReactionAdd.js b/event/listeners/messageReactionAdd.js index 5ce3d6d..1725f33 100644 --- a/event/listeners/messageReactionAdd.js +++ b/event/listeners/messageReactionAdd.js @@ -59,17 +59,27 @@ class MessageReactionAddListener extends Listener { channel = client.channels.get(shameboardChannel['shameboard']); } - const Embed = new MessageEmbed() + let Embed = new MessageEmbed() .setColor(reaction.message.member.displayHexColor) .setAuthor(reaction.message.author.username, reaction.message.author.displayAvatarURL()) - .setDescription(messageContent) .addField('Jump to', `[message](https://discordapp.com/channels/${reaction.message.guild.id}/${reaction.message.channel.id}/${reaction.message.id})`, true) .addField('Channel', reaction.message.channel, true) .setFooter(reaction.count + ' ' + emote) .setTimestamp(); - return channel.send({files: messageAttachments, embed: Embed}) - .catch(() => channel.send(messageAttachments, { embed: Embed})); + if (reaction.message.channel.nsfw) { + Embed.setDescription(`||${messageContent}||`); + if (messageAttachments != '') { + return channel.send(`||${messageAttachments}||`, {embed: Embed}); + } + else { + return channel.send({embed: Embed}); + } + } else { + Embed.setDescription(messageContent); + return channel.send({files: messageAttachments, embed: Embed}) + .catch(() => channel.send(messageAttachments, { embed: Embed})); + } } } }