mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
29 lines
854 B
TypeScript
29 lines
854 B
TypeScript
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
|
import { ActionName } from '@/onebot/action/router';
|
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
|
|
|
const SchemaData = {
|
|
type: 'object',
|
|
properties: {
|
|
rawData: { type: 'string' },
|
|
brief: { type: 'string' },
|
|
},
|
|
required: ['brief', 'rawData'],
|
|
} as const satisfies JSONSchema;
|
|
|
|
type Payload = FromSchema<typeof SchemaData>;
|
|
|
|
export class CreateCollection extends OneBotAction<Payload, any> {
|
|
actionName = ActionName.CreateCollection;
|
|
payloadSchema = SchemaData;
|
|
|
|
async _handle(payload: Payload) {
|
|
return await this.core.apis.CollectionApi.createCollection(
|
|
this.core.selfInfo.uin,
|
|
this.core.selfInfo.uid,
|
|
this.core.selfInfo.nick,
|
|
payload.brief, payload.rawData,
|
|
);
|
|
}
|
|
}
|