refactor: replace io-ts with zod
This commit is contained in:
parent
fafaefa1fb
commit
28692962bc
161 changed files with 1450 additions and 2105 deletions
|
@ -1,19 +1,15 @@
|
|||
import { ChannelType, GuildTextBasedChannel, Snowflake } from "discord.js";
|
||||
import * as t from "io-ts";
|
||||
import { convertDelayStringToMS, isDiscordAPIError, tDelayString, tNullable } from "../../../utils";
|
||||
import z from "zod";
|
||||
import { convertDelayStringToMS, isDiscordAPIError, zDelayString, zSnowflake } from "../../../utils";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||
import { automodAction } from "../helpers";
|
||||
|
||||
export const SetSlowmodeAction = automodAction({
|
||||
configType: t.type({
|
||||
channels: t.array(t.string),
|
||||
duration: tNullable(tDelayString),
|
||||
configSchema: z.strictObject({
|
||||
channels: z.array(zSnowflake),
|
||||
duration: zDelayString.nullable().default("10s"),
|
||||
}),
|
||||
|
||||
defaultConfig: {
|
||||
duration: "10s",
|
||||
},
|
||||
|
||||
async apply({ pluginData, actionConfig }) {
|
||||
const slowmodeMs = Math.max(actionConfig.duration ? convertDelayStringToMS(actionConfig.duration)! : 0, 0);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue