mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
25 lines
816 B
TypeScript
25 lines
816 B
TypeScript
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
|
import BaseAction from '../BaseAction';
|
|
import { ActionName } from '../types';
|
|
import { NTQQGroupApi, NTQQUserApi } from '@/core/apis';
|
|
|
|
const SchemaData = {
|
|
type: 'object',
|
|
properties: {
|
|
group_id: { type: ['string', 'number'] },
|
|
},
|
|
required: ['group_id']
|
|
} as const satisfies JSONSchema;
|
|
|
|
type Payload = FromSchema<typeof SchemaData>;
|
|
|
|
export class GetGroupFileCount extends BaseAction<Payload, { count: number }> {
|
|
actionName = ActionName.GetGroupFileCount;
|
|
PayloadSchema = SchemaData;
|
|
protected async _handle(payload: Payload) {
|
|
const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi;
|
|
const ret = await NTQQGroupApi.GetGroupFileCount([payload.group_id?.toString()]);
|
|
return { count: ret.groupFileCounts[0] };
|
|
}
|
|
}
|