mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-06 13:05:09 +00:00
迁移类型校验到zod
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
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({
|
||||
face_id: Type.Union([Type.Number(), Type.String()]),// 参考 face_config.json 的 QSid
|
||||
face_type: Type.Union([Type.Number(), Type.String()], { default: '1' }),
|
||||
wording: Type.String({ default: ' ' }),
|
||||
const SchemaData = z.object({
|
||||
face_id: z.union([z.number(), z.string()]),// 参考 face_config.json 的 QSid
|
||||
face_type: z.union([z.number(), z.string()]).default('1'),
|
||||
wording: z.string().default(' '),
|
||||
});
|
||||
|
||||
type Payload = Static<typeof SchemaData>;
|
||||
type Payload = z.infer<typeof SchemaData>;
|
||||
|
||||
export class SetDiyOnlineStatus extends OneBotAction<Payload, string> {
|
||||
override actionName = ActionName.SetDiyOnlineStatus;
|
||||
|
||||
Reference in New Issue
Block a user