From 3c0d6ea5c3644f7093a628c53809f859bdcbebbb Mon Sep 17 00:00:00 2001 From: Abheek Dhawan Date: Sun, 4 Apr 2021 21:27:25 -0500 Subject: [PATCH] Add conditional fields to messageUpdate --- bot.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bot.js b/bot.js index 08daf16..bde9e19 100644 --- a/bot.js +++ b/bot.js @@ -718,11 +718,17 @@ client.on('messageUpdate', (originalMessage, editedMessage) => { .addField("Link", `[Click here!](${editedMessage.url})`) .setAuthor(editedMessage.author ? editedMessage.author.tag : "Unknown", editedMessage.author ? editedMessage.author.avatarURL() : client.user.defaultAvatarURL) .addField("Author", editedMessage.author.tag) - .addField("Message", `<< ${originalMessage}\n>> ${editedMessage}`) .setThumbnail(editedMessage.author.avatarURL()) .setFooter("ID: " + editedMessage.id) .setTimestamp() .setColor('c9ff00'); + + if (editedMessage !== originalMessage) { + editEmbed.addField("Message", `<< ${originalMessage}\n>> ${editedMessage}`)'' + } + if (editedMessage.attachments) { + editEmbed.addField("Attachments", editedMessage.attachments.array().map(`[${a.name}](${a.url})`).join(' • ')) + } collection.findOne({ guild_id: editedMessage.guild.id }, (error, result) => { if (error) { console.error;