From eb1b04bc42c104031da22b5b96ae6742f49dd3a9 Mon Sep 17 00:00:00 2001 From: AnxietyisReal <96593068+AnxietyisReal@users.noreply.github.com> Date: Sat, 26 Nov 2022 13:00:41 -0800 Subject: [PATCH] Sort of fix attachment errors --- src/events/messageDelete.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/events/messageDelete.ts b/src/events/messageDelete.ts index 53dc2d3..26029b2 100644 --- a/src/events/messageDelete.ts +++ b/src/events/messageDelete.ts @@ -9,10 +9,8 @@ export default { 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}>`) - let image; - if (msg.attachments?.first()?.width && ['png', 'jpeg', 'jpg', 'gif', 'webp'].some(x=>((msg.attachments.first() as Discord.Attachment).name as string).endsWith(x))) { - image = msg.attachments?.first().attachment - } - channel.send({embeds: [embed], files: [image]}) + const attachments: Array = []; + msg.attachments.forEach((x) => attachments.push(x.url)); + channel.send({embeds: [embed], files: attachments}) } }