mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-11 15:30:25 +00:00
24 lines
802 B
TypeScript
24 lines
802 B
TypeScript
import BaseAction from '../BaseAction';
|
|
import { ActionName } from '../types';
|
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
|
|
|
const SchemaData = {
|
|
type: 'object',
|
|
properties: {
|
|
category: { type: ['number', 'string'] },
|
|
count: { type: ['number', 'string'] },
|
|
},
|
|
required: ['category', 'count'],
|
|
} as const satisfies JSONSchema;
|
|
|
|
type Payload = FromSchema<typeof SchemaData>;
|
|
|
|
export class GetCollectionList extends BaseAction<Payload, any> {
|
|
actionName = ActionName.GetCollectionList;
|
|
PayloadSchema = SchemaData;
|
|
async _handle(payload: Payload) {
|
|
const NTQQCollectionApi = this.CoreContext.apis.CollectionApi;
|
|
return await NTQQCollectionApi.getAllCollection(parseInt(payload.category.toString()), +(payload.count ?? 1));
|
|
}
|
|
}
|