Skip to content

Commit 4f97d15

Browse files
committed
feat: add include_custom_invite_codes/exclude_custom_invite_codes to match_words automod trigger
1 parent 14efcc0 commit 4f97d15

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

backend/src/plugins/Automod/triggers/matchInvites.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ const configSchema = z.strictObject({
1515
exclude_guilds: z.array(zSnowflake).max(255).optional(),
1616
include_invite_codes: z.array(z.string().max(32)).max(255).optional(),
1717
exclude_invite_codes: z.array(z.string().max(32)).max(255).optional(),
18+
include_custom_invite_codes: z.array(z.string().max(32)).max(255).transform(arr => arr.map(str => str.toLowerCase())).optional(),
19+
exclude_custom_invite_codes: z.array(z.string().max(32)).max(255).transform(arr => arr.map(str => str.toLowerCase())).optional(),
1820
allow_group_dm_invites: z.boolean().default(false),
1921
match_messages: z.boolean().default(true),
2022
match_embeds: z.boolean().default(false),
@@ -45,6 +47,12 @@ export const MatchInvitesTrigger = automodTrigger<MatchResultType>()({
4547
if (trigger.exclude_invite_codes && !trigger.exclude_invite_codes.includes(code)) {
4648
return { extra: { type, code } };
4749
}
50+
if (trigger.include_custom_invite_codes && trigger.include_custom_invite_codes.includes(code.toLowerCase())) {
51+
return { extra: { type, code } };
52+
}
53+
if (trigger.exclude_custom_invite_codes && !trigger.exclude_custom_invite_codes.includes(code.toLowerCase())) {
54+
return { extra: { type, code } };
55+
}
4856
}
4957

5058
for (const code of uniqueInviteCodes) {

0 commit comments

Comments
 (0)