mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-07-07 11:07:19 +00:00
fix automod cooldowns
Signed-off-by: GitHub <noreply@github.com>
This commit is contained in:
parent
8a4a2d3647
commit
08a19eee81
3 changed files with 21 additions and 13 deletions
14
backend/src/plugins/Automod/functions/checkCooldown.ts
Normal file
14
backend/src/plugins/Automod/functions/checkCooldown.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { AutomodContext, AutomodPluginType, TRule } from "../types";
|
||||
|
||||
export function checkCooldown(pluginData: GuildPluginData<AutomodPluginType>, rule: TRule, context: AutomodContext) {
|
||||
const cooldownKey = `${rule.name}-${context.user?.id}`;
|
||||
|
||||
if (cooldownKey) {
|
||||
if (pluginData.state.cooldownManager.isOnCooldown(cooldownKey)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue