迁移类型校验到zod

This commit is contained in:
手瓜一十雪
2025-04-13 20:05:11 +08:00
parent 4084e431ec
commit 8a116d2d7b
101 changed files with 951 additions and 945 deletions

View File

@@ -2,15 +2,14 @@ import { OneBotAction } from '@/onebot/action/OneBotAction';
import { OB11Message, OB11MessageData, OB11MessageDataType, OB11MessageForward, OB11MessageNodePlain as OB11MessageNode } from '@/onebot';
import { ActionName } from '@/onebot/action/router';
import { MessageUnique } from '@/common/message-unique';
import { Static, Type } from '@sinclair/typebox';
import { ChatType, ElementType, MsgSourceType, NTMsgType, RawMessage } from '@/core';
import { z } from 'zod';
const SchemaData = Type.Object({
message_id: Type.Optional(Type.Union([Type.Number(), Type.String()])),
id: Type.Optional(Type.Union([Type.Number(), Type.String()])),
const SchemaData = z.object({
message_id: z.union([z.number(), z.string()]).optional(),
id: z.union([z.number(), z.string()]).optional(),
});
type Payload = Static<typeof SchemaData>;
type Payload = z.infer<typeof SchemaData>;
export class GoCQHTTPGetForwardMsgAction extends OneBotAction<Payload, {
messages: OB11Message[] | undefined;