mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
automod: make match_attachment_type case-insensitive
This commit is contained in:
parent
f916e8c156
commit
a5c40a58bf
1 changed files with 14 additions and 3 deletions
|
@ -37,9 +37,16 @@ export const MatchAttachmentTypeTrigger = automodTrigger<MatchResultType>()({
|
|||
const attachments: any[] = context.message.data.attachments;
|
||||
|
||||
for (const attachment of attachments) {
|
||||
const attachmentType = attachment.filename.split(`.`).pop();
|
||||
const attachmentType = attachment.filename
|
||||
.split(".")
|
||||
.pop()
|
||||
.toLowerCase();
|
||||
|
||||
if (trigger.blacklist_enabled && trigger.filetype_blacklist.includes(attachmentType)) {
|
||||
const blacklist = trigger.blacklist_enabled
|
||||
? (trigger.filetype_blacklist || []).map(_t => _t.toLowerCase())
|
||||
: null;
|
||||
|
||||
if (blacklist && blacklist.includes(attachmentType)) {
|
||||
return {
|
||||
extra: {
|
||||
matchedType: attachmentType,
|
||||
|
@ -48,7 +55,11 @@ export const MatchAttachmentTypeTrigger = automodTrigger<MatchResultType>()({
|
|||
};
|
||||
}
|
||||
|
||||
if (trigger.whitelist_enabled && !trigger.filetype_whitelist.includes(attachmentType)) {
|
||||
const whitelist = trigger.whitelist_enabled
|
||||
? (trigger.filetype_whitelist || []).map(_t => _t.toLowerCase())
|
||||
: null;
|
||||
|
||||
if (whitelist && !whitelist.includes(attachmentType)) {
|
||||
return {
|
||||
extra: {
|
||||
matchedType: attachmentType,
|
||||
|
|
Loading…
Add table
Reference in a new issue