mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-12 16:00:27 +00:00
迁移类型校验到zod
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
import { z } from 'zod';
|
||||
|
||||
const SchemaData = Type.Object({
|
||||
times: Type.Union([Type.Number(), Type.String()], { default: 1 }),
|
||||
user_id: Type.Union([Type.Number(), Type.String()])
|
||||
const SchemaData = z.object({
|
||||
times: z.union([z.number(), z.string()]).default(1),
|
||||
user_id: z.union([z.number(), z.string()])
|
||||
});
|
||||
|
||||
type Payload = Static<typeof SchemaData>;
|
||||
type Payload = z.infer<typeof SchemaData>;
|
||||
|
||||
export default class SendLike extends OneBotAction<Payload, null> {
|
||||
override actionName = ActionName.SendLike;
|
||||
|
||||
Reference in New Issue
Block a user