3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-16 22:21:51 +00:00

matchAttachmentType fix

This commit is contained in:
Dragory 2021-08-18 22:44:54 +03:00
parent 870b638225
commit f208dc3013
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1

View file

@ -28,19 +28,14 @@ export const MatchAttachmentTypeTrigger = automodTrigger<MatchResultType>()({
return; return;
} }
if (!context.message.data.attachments) return null; if (!context.message.data.attachments) {
const attachments: any[] = context.message.data.attachments; return null;
}
for (const attachment of attachments) { for (const attachment of context.message.data.attachments) {
// FIXME: Hotfix const attachmentType = attachment.url
if (!attachment.filename) {
console.warn("No attachment filename:", attachment);
continue;
}
const attachmentType = attachment.filename
.split(".") .split(".")
.pop() .pop()!
.toLowerCase(); .toLowerCase();
const blacklist = trigger.blacklist_enabled const blacklist = trigger.blacklist_enabled