3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-07-07 02:57:20 +00:00

Merge remote-tracking branch 'origin/master' into iots_to_zod

This commit is contained in:
Dragory 2024-01-27 14:12:06 +02:00
commit 59c5176cbd
No known key found for this signature in database
39 changed files with 1420 additions and 2208 deletions

View file

@ -5,6 +5,7 @@ interface AntiraidLevelTriggerResult {}
const configSchema = z.strictObject({
level: z.nullable(z.string().max(100)),
only_on_change: z.nullable(z.boolean()),
});
export const AntiraidLevelTrigger = automodTrigger<AntiraidLevelTriggerResult>()({
@ -19,6 +20,14 @@ export const AntiraidLevelTrigger = automodTrigger<AntiraidLevelTriggerResult>()
return;
}
if (
triggerConfig.only_on_change &&
context.antiraid.oldLevel !== undefined &&
context.antiraid.level === context.antiraid.oldLevel
) {
return;
}
return {
extra: {},
};

View file

@ -1,5 +1,6 @@
import { escapeInlineCode, Snowflake } from "discord.js";
import z from "zod";
import { extname } from "path";
import { asSingleLine, messageSummary, verboseChannelMention } from "../../../utils";
import { automodTrigger } from "../helpers";
@ -44,7 +45,7 @@ export const MatchAttachmentTypeTrigger = automodTrigger<MatchResultType>()({
}
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
? (trigger.filetype_blacklist || []).map((_t) => _t.toLowerCase())

View file

@ -41,7 +41,7 @@ export const MatchWordsTrigger = automodTrigger<MatchResultType>()({
const looseMatchingThreshold = Math.min(Math.max(trigger.loose_matching_threshold, 1), 64);
const patterns = trigger.words.map((word) => {
let pattern = trigger.loose_matching
? [...word].map((c) => escapeStringRegexp(c)).join(`(?:\\s*|.{0,${looseMatchingThreshold})`)
? [...word].map((c) => escapeStringRegexp(c)).join(`(?:\\s*|.{0,${looseMatchingThreshold}})`)
: escapeStringRegexp(word);
if (trigger.only_full_words) {