automod: add cooldown support
This commit is contained in:
parent
5882bbda4e
commit
7fb7787583
4 changed files with 36 additions and 2 deletions
|
@ -4,6 +4,7 @@ import { availableTriggers } from "../triggers/availableTriggers";
|
|||
import { availableActions } from "../actions/availableActions";
|
||||
import { AutomodTriggerMatchResult } from "../helpers";
|
||||
import { CleanAction } from "../actions/clean";
|
||||
import { checkAndUpdateCooldown } from "./checkAndUpdateCooldown";
|
||||
|
||||
export async function runAutomod(pluginData: PluginData<AutomodPluginType>, context: AutomodContext) {
|
||||
const userId = context.user?.id || context.message?.user_id;
|
||||
|
@ -24,6 +25,10 @@ export async function runAutomod(pluginData: PluginData<AutomodPluginType>, cont
|
|||
if (rule.enabled === false) continue;
|
||||
if (!rule.affects_bots && user.bot) continue;
|
||||
|
||||
if (rule.cooldown && checkAndUpdateCooldown(pluginData, rule, context)) {
|
||||
return;
|
||||
}
|
||||
|
||||
let matchResult: AutomodTriggerMatchResult<any>;
|
||||
let contexts: AutomodContext[];
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue