mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-06 21:10:23 +00:00
refactor: type-check (#586)
* refactor: type-check * fix: default * refactor: type-check
This commit is contained in:
@@ -1,22 +1,13 @@
|
||||
import { ActionName } from '@/onebot/action/router';
|
||||
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||
import { MessageUnique } from '@/common/message-unique';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
const SchemaData = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
message_id: {
|
||||
oneOf: [
|
||||
{ type: 'number' },
|
||||
{ type: 'string' },
|
||||
],
|
||||
},
|
||||
},
|
||||
required: ['message_id'],
|
||||
} as const satisfies JSONSchema;
|
||||
const SchemaData = Type.Object({
|
||||
message_id: Type.Union([Type.Number(), Type.String()]),
|
||||
});
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
type Payload = Static<typeof SchemaData>;
|
||||
|
||||
class DeleteMsg extends OneBotAction<Payload, void> {
|
||||
actionName = ActionName.DeleteMsg;
|
||||
|
||||
Reference in New Issue
Block a user