3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-17 15:15:02 +00:00

fix: clamp counter values in config

This commit is contained in:
Dragory 2024-01-27 14:57:57 +02:00
parent 48507499bc
commit 6840fb4646
No known key found for this signature in database
3 changed files with 10 additions and 6 deletions

View file

@ -1,4 +1,5 @@
import z from "zod";
import { MAX_COUNTER_VALUE, MIN_COUNTER_VALUE } from "../../../data/GuildCounters";
import { zBoundedCharacters } from "../../../utils";
import { CountersPlugin } from "../../Counters/CountersPlugin";
import { LogsPlugin } from "../../Logs/LogsPlugin";
@ -7,7 +8,7 @@ import { automodAction } from "../helpers";
export const SetCounterAction = automodAction({
configSchema: z.strictObject({
counter: zBoundedCharacters(0, 100),
value: z.number(),
value: z.number().min(MIN_COUNTER_VALUE).max(MAX_COUNTER_VALUE),
}),
async apply({ pluginData, contexts, actionConfig, ruleName }) {