3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-07-10 12:37:19 +00:00

fix parsing of file extension in match_attachment_type trigger

This commit is contained in:
Almeida 2023-09-06 23:02:05 +01:00
parent 025e67d6b6
commit 53326794e3
No known key found for this signature in database
GPG key ID: C8306C9B20E8A001

View file

@ -1,5 +1,6 @@
import { escapeInlineCode, Snowflake } from "discord.js"; import { escapeInlineCode, Snowflake } from "discord.js";
import * as t from "io-ts"; import * as t from "io-ts";
import { extname } from "path";
import { asSingleLine, messageSummary, verboseChannelMention } from "../../../utils"; import { asSingleLine, messageSummary, verboseChannelMention } from "../../../utils";
import { automodTrigger } from "../helpers"; import { automodTrigger } from "../helpers";
@ -33,7 +34,7 @@ export const MatchAttachmentTypeTrigger = automodTrigger<MatchResultType>()({
} }
for (const attachment of context.message.data.attachments) { for (const attachment of context.message.data.attachments) {
const attachmentType = attachment.url.split(".").pop()!.toLowerCase(); const attachmentType = extname(new URL(attachment.url).pathname).slice(1).toLowerCase();
const blacklist = trigger.blacklist_enabled const blacklist = trigger.blacklist_enabled
? (trigger.filetype_blacklist || []).map((_t) => _t.toLowerCase()) ? (trigger.filetype_blacklist || []).map((_t) => _t.toLowerCase())