mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
fix parsing of file extension in match_attachment_type trigger (#425)
This commit is contained in:
parent
d162418be5
commit
047ab872df
1 changed files with 2 additions and 1 deletions
|
@ -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())
|
||||||
|
|
Loading…
Add table
Reference in a new issue