mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-07-06 10:37:19 +00:00
feat: add include_custom_invite_codes/exclude_custom_invite_codes to match_words automod trigger
This commit is contained in:
parent
14efcc06bf
commit
4f97d15b94
1 changed files with 8 additions and 0 deletions
|
@ -15,6 +15,8 @@ const configSchema = z.strictObject({
|
||||||
exclude_guilds: z.array(zSnowflake).max(255).optional(),
|
exclude_guilds: z.array(zSnowflake).max(255).optional(),
|
||||||
include_invite_codes: z.array(z.string().max(32)).max(255).optional(),
|
include_invite_codes: z.array(z.string().max(32)).max(255).optional(),
|
||||||
exclude_invite_codes: z.array(z.string().max(32)).max(255).optional(),
|
exclude_invite_codes: z.array(z.string().max(32)).max(255).optional(),
|
||||||
|
include_custom_invite_codes: z.array(z.string().max(32)).max(255).transform(arr => arr.map(str => str.toLowerCase())).optional(),
|
||||||
|
exclude_custom_invite_codes: z.array(z.string().max(32)).max(255).transform(arr => arr.map(str => str.toLowerCase())).optional(),
|
||||||
allow_group_dm_invites: z.boolean().default(false),
|
allow_group_dm_invites: z.boolean().default(false),
|
||||||
match_messages: z.boolean().default(true),
|
match_messages: z.boolean().default(true),
|
||||||
match_embeds: z.boolean().default(false),
|
match_embeds: z.boolean().default(false),
|
||||||
|
@ -45,6 +47,12 @@ export const MatchInvitesTrigger = automodTrigger<MatchResultType>()({
|
||||||
if (trigger.exclude_invite_codes && !trigger.exclude_invite_codes.includes(code)) {
|
if (trigger.exclude_invite_codes && !trigger.exclude_invite_codes.includes(code)) {
|
||||||
return { extra: { type, code } };
|
return { extra: { type, code } };
|
||||||
}
|
}
|
||||||
|
if (trigger.include_custom_invite_codes && trigger.include_custom_invite_codes.includes(code.toLowerCase())) {
|
||||||
|
return { extra: { type, code } };
|
||||||
|
}
|
||||||
|
if (trigger.exclude_custom_invite_codes && !trigger.exclude_custom_invite_codes.includes(code.toLowerCase())) {
|
||||||
|
return { extra: { type, code } };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const code of uniqueInviteCodes) {
|
for (const code of uniqueInviteCodes) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue