mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-01-09 13:03:37 +08:00
21 lines
828 B
TypeScript
21 lines
828 B
TypeScript
import { type NTQQCollectionApi } from 'napcat-core/apis/collection';
|
|
import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
|
import { ActionName } from '@/napcat-onebot/action/router';
|
|
import { Type, Static } from '@sinclair/typebox';
|
|
|
|
const SchemaData = Type.Object({
|
|
category: Type.Union([Type.Number(), Type.String()]),
|
|
count: Type.Union([Type.Union([Type.Number(), Type.String()])], { default: 1 }),
|
|
});
|
|
|
|
type Payload = Static<typeof SchemaData>;
|
|
|
|
export class GetCollectionList extends OneBotAction<Payload, Awaited<ReturnType<NTQQCollectionApi['getAllCollection']>>> {
|
|
override actionName = ActionName.GetCollectionList;
|
|
override payloadSchema = SchemaData;
|
|
|
|
async _handle (payload: Payload) {
|
|
return await this.core.apis.CollectionApi.getAllCollection(+payload.category, +payload.count);
|
|
}
|
|
}
|