mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 04:25:01 +00:00
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,17 +1,17 @@
|
|||
import * as t from "io-ts";
|
||||
import { GuildPluginData } from "knub";
|
||||
import z from "zod";
|
||||
import { canActOn } from "../../../pluginUtils";
|
||||
import { renderTemplate, TemplateSafeValueContainer } from "../../../templateFormatter";
|
||||
import { resolveMember } from "../../../utils";
|
||||
import { resolveMember, zSnowflake } from "../../../utils";
|
||||
import { ActionError } from "../ActionError";
|
||||
import { CustomEventsPluginType, TCustomEvent } from "../types";
|
||||
|
||||
export const AddRoleAction = t.type({
|
||||
type: t.literal("add_role"),
|
||||
target: t.string,
|
||||
role: t.union([t.string, t.array(t.string)]),
|
||||
export const zAddRoleAction = z.strictObject({
|
||||
type: z.literal("add_role"),
|
||||
target: zSnowflake,
|
||||
role: z.union([zSnowflake, z.array(zSnowflake)]),
|
||||
});
|
||||
export type TAddRoleAction = t.TypeOf<typeof AddRoleAction>;
|
||||
export type TAddRoleAction = z.infer<typeof zAddRoleAction>;
|
||||
|
||||
export async function addRoleAction(
|
||||
pluginData: GuildPluginData<CustomEventsPluginType>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue