release / check-version (push) Canceled after 0s
release / build-linux (arm64, linux) (push) Canceled after 0s
release / build-linux (x64, linux) (push) Canceled after 0s
release / build-win32 (x64, win32) (push) Canceled after 0s
release / release-napcat (push) Canceled after 0s
24 lines
748 B
TypeScript
24 lines
748 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 ret = await NTQQGroupApi.GetGroupFileCount([payload.group_id?.toString()]);
|
|
return { count: ret.groupFileCounts[0] };
|
|
}
|
|
}
|