From 95d7172d6a55ea81085c38092744bda13704b2e3 Mon Sep 17 00:00:00 2001 From: AnxietyisReal <96593068+AnxietyisReal@users.noreply.github.com> Date: Sat, 24 Dec 2022 22:13:22 +1100 Subject: [PATCH] revise messageDelete to hide content field if empty --- src/events/messageDelete.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/events/messageDelete.ts b/src/events/messageDelete.ts index 26029b2..0ed8c94 100644 --- a/src/events/messageDelete.ts +++ b/src/events/messageDelete.ts @@ -8,7 +8,12 @@ export default { if (msg.guild?.id != client.config.mainServer.id) return; if (msg.partial) return; if (msg.author.bot) return; - const embed = new client.embed().setColor(client.config.embedColorRed).setTimestamp().setAuthor({name: `Author: ${msg.author.tag} (${msg.author.id})`, iconURL: `${msg.author.displayAvatarURL()}`}).setTitle('Message deleted').setDescription(`<@${msg.author.id}>\nContent:\n\`\`\`\n${msg?.content}\n\`\`\`\nChannel: <#${msg.channelId}>`) + const embed = new client.embed().setColor(client.config.embedColorRed).setTimestamp().setAuthor({name: `Author: ${msg.author.tag} (${msg.author.id})`, iconURL: `${msg.author.displayAvatarURL()}`}).setTitle('Message deleted').setDescription(`<@${msg.author.id}>\n\`${msg.author.id}\``); + if (msg.content.length != 0) embed.addFields({name: 'Content', value: `\`\`\`\n${msg.content.slice(0,1020)}\n\`\`\``}); + embed.addFields( + { name: 'Channel', value: `<#${msg.channelId}>` }, + { name: 'Sent at', value: `\n` } + ) const attachments: Array = []; msg.attachments.forEach((x) => attachments.push(x.url)); channel.send({embeds: [embed], files: attachments})