diff --git a/backend/src/plugins/Automod/AutomodPlugin.ts b/backend/src/plugins/Automod/AutomodPlugin.ts index eb2484dd..8170f632 100644 --- a/backend/src/plugins/Automod/AutomodPlugin.ts +++ b/backend/src/plugins/Automod/AutomodPlugin.ts @@ -73,6 +73,10 @@ const configPreprocessor: ConfigPreprocessorFn = options => { rule["enabled"] = true; } + if (rule["allow_further_rules"] == null) { + rule["allow_further_rules"] = false; + } + if (rule["affects_bots"] == null) { rule["affects_bots"] = false; } diff --git a/backend/src/plugins/Automod/functions/runAutomod.ts b/backend/src/plugins/Automod/functions/runAutomod.ts index bf22cc5e..65ff8b0a 100644 --- a/backend/src/plugins/Automod/functions/runAutomod.ts +++ b/backend/src/plugins/Automod/functions/runAutomod.ts @@ -72,12 +72,13 @@ export async function runAutomod(pluginData: GuildPluginData, matchResult.fullSummary = `Triggered automod rule **${ruleName}**\n${matchResult.summary}`.trim(); - break triggerLoop; + if (!rule.allow_further_rules) break triggerLoop; } } } if (matchResult) { + console.log("matchResult exists"); for (const [actionName, actionConfig] of Object.entries(rule.actions)) { if (actionConfig == null || actionConfig === false) { continue; @@ -94,7 +95,7 @@ export async function runAutomod(pluginData: GuildPluginData, }); } - break; + if (!rule.allow_further_rules) break; } } } diff --git a/backend/src/plugins/Automod/types.ts b/backend/src/plugins/Automod/types.ts index 3981860d..2f8107fc 100644 --- a/backend/src/plugins/Automod/types.ts +++ b/backend/src/plugins/Automod/types.ts @@ -26,6 +26,7 @@ export const Rule = t.type({ triggers: t.array(t.partial(AvailableTriggers.props)), actions: t.partial(AvailableActions.props), cooldown: tNullable(t.string), + allow_further_rules: t.boolean, }); export type TRule = t.TypeOf;