迁移类型校验到zod

This commit is contained in:
手瓜一十雪 committed 2025-04-13 20:05:11 +08:00
1 parent d4ab191f34
commit 2147c4ffee
101 files changed
+951 -945

No files matched your search

+4 -4
View File
@@ -3,16 +3,16 @@ import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '@/onebot/action/router';
import { MessageUnique } from '@/common/message-unique';
import { RawMessage } from '@/core';
import { Static, Type } from '@sinclair/typebox';
import { z } from 'zod';
import { NetworkAdapterConfig } from '@/onebot/config/config';
export type ReturnDataType = OB11Message
const SchemaData = Type.Object({
message_id: Type.Union([Type.Number(), Type.String()]),
const SchemaData = z.object({
message_id: z.union([z.number(), z.string()]),
});
type Payload = Static<typeof SchemaData>;
type Payload = z.infer<typeof SchemaData>;
class GetMsg extends OneBotAction<Payload, OB11Message> {
override actionName = ActionName.GetMsg;