mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-06-17 03: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,23 +1,24 @@
|
|||
import { PermissionsBitField, PermissionsString, Snowflake } from "discord.js";
|
||||
import * as t from "io-ts";
|
||||
import { GuildPluginData } from "knub";
|
||||
import z from "zod";
|
||||
import { TemplateSafeValueContainer } from "../../../templateFormatter";
|
||||
import { zSnowflake } from "../../../utils";
|
||||
import { ActionError } from "../ActionError";
|
||||
import { CustomEventsPluginType, TCustomEvent } from "../types";
|
||||
|
||||
export const SetChannelPermissionOverridesAction = t.type({
|
||||
type: t.literal("set_channel_permission_overrides"),
|
||||
channel: t.string,
|
||||
overrides: t.array(
|
||||
t.type({
|
||||
type: t.union([t.literal("member"), t.literal("role")]),
|
||||
id: t.string,
|
||||
allow: t.number,
|
||||
deny: t.number,
|
||||
export const zSetChannelPermissionOverridesAction = z.strictObject({
|
||||
type: z.literal("set_channel_permission_overrides"),
|
||||
channel: zSnowflake,
|
||||
overrides: z.array(
|
||||
z.strictObject({
|
||||
type: z.union([z.literal("member"), z.literal("role")]),
|
||||
id: zSnowflake,
|
||||
allow: z.number(),
|
||||
deny: z.number(),
|
||||
}),
|
||||
),
|
||||
).max(15),
|
||||
});
|
||||
export type TSetChannelPermissionOverridesAction = t.TypeOf<typeof SetChannelPermissionOverridesAction>;
|
||||
export type TSetChannelPermissionOverridesAction = z.infer<typeof zSetChannelPermissionOverridesAction>;
|
||||
|
||||
export async function setChannelPermissionOverridesAction(
|
||||
pluginData: GuildPluginData<CustomEventsPluginType>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue