From f208dc3013d477c4214116ecbe8eed95fe99f9be Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Wed, 18 Aug 2021 22:44:54 +0300 Subject: [PATCH] matchAttachmentType fix --- .../Automod/triggers/matchAttachmentType.ts | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/backend/src/plugins/Automod/triggers/matchAttachmentType.ts b/backend/src/plugins/Automod/triggers/matchAttachmentType.ts index 4ae2b65e..0eb7e764 100644 --- a/backend/src/plugins/Automod/triggers/matchAttachmentType.ts +++ b/backend/src/plugins/Automod/triggers/matchAttachmentType.ts @@ -28,19 +28,14 @@ export const MatchAttachmentTypeTrigger = automodTrigger()({ return; } - if (!context.message.data.attachments) return null; - const attachments: any[] = context.message.data.attachments; + if (!context.message.data.attachments) { + return null; + } - for (const attachment of attachments) { - // FIXME: Hotfix - if (!attachment.filename) { - console.warn("No attachment filename:", attachment); - continue; - } - - const attachmentType = attachment.filename + for (const attachment of context.message.data.attachments) { + const attachmentType = attachment.url .split(".") - .pop() + .pop()! .toLowerCase(); const blacklist = trigger.blacklist_enabled