3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-06-08 16:15:04 +00:00

Fix automod cooldown logic (#442)

* fix automod cooldowns

Signed-off-by: GitHub <noreply@github.com>

* almeida fixes

Signed-off-by: GitHub <noreply@github.com>

* https://shr2.i0.tf/82e683c8/bd310b9c-7492-44f0-aed5-af6a22a3c196.png

Signed-off-by: GitHub <noreply@github.com>

---------

Signed-off-by: GitHub <noreply@github.com>
This commit is contained in:
Tiago R 2024-01-07 21:12:50 +00:00 committed by GitHub
parent 094e94f0f4
commit f58e7f5eb7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 26 deletions

View file

@ -0,0 +1,10 @@
import { GuildPluginData } from "knub";
import { convertDelayStringToMS } from "../../../utils";
import { AutomodContext, AutomodPluginType, TRule } from "../types";
export function applyCooldown(pluginData: GuildPluginData<AutomodPluginType>, rule: TRule, context: AutomodContext) {
const cooldownKey = `${rule.name}-${context.user?.id}`;
const cooldownTime = convertDelayStringToMS(rule.cooldown, "s");
if (cooldownTime) pluginData.state.cooldownManager.setCooldown(cooldownKey, cooldownTime);
}