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;
}
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