mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-13 00:10:27 +00:00
Moved action example files into a new 'example' directory and updated all imports accordingly. Removed the monolithic 'examples.ts' and redefined ActionExamples in OneBotAction.ts to only include common error codes. This improves code organization and maintainability.
40 lines
1.7 KiB
TypeScript
40 lines
1.7 KiB
TypeScript
import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
|
import { ActionName } from '@/napcat-onebot/action/router';
|
|
import { Static, Type } from '@sinclair/typebox';
|
|
import { GoCQHTTPActionsExamples } from '../example/GoCQHTTPActionsExamples';
|
|
|
|
const PayloadSchema = Type.Object({
|
|
group_id: Type.String({ description: '群号' }),
|
|
});
|
|
|
|
type PayloadType = Static<typeof PayloadSchema>;
|
|
|
|
const ReturnSchema = Type.Object({
|
|
can_at_all: Type.Boolean({ description: '是否可以艾特全体' }),
|
|
remain_at_all_count_for_group: Type.Number({ description: '群艾特全体剩余次数' }),
|
|
remain_at_all_count_for_uin: Type.Number({ description: '个人艾特全体剩余次数' }),
|
|
}, { description: '群艾特全体剩余次数' });
|
|
|
|
type ReturnType = Static<typeof ReturnSchema>;
|
|
|
|
export class GoCQHTTPGetGroupAtAllRemain extends OneBotAction<PayloadType, ReturnType> {
|
|
override actionName = ActionName.GoCQHTTP_GetGroupAtAllRemain;
|
|
override payloadSchema = PayloadSchema;
|
|
override returnSchema = ReturnSchema;
|
|
override actionSummary = '获取群艾特全体剩余次数';
|
|
override actionDescription = '获取指定群聊中艾特全体成员的剩余次数';
|
|
override actionTags = ['Go-CQHTTP'];
|
|
override payloadExample = GoCQHTTPActionsExamples.GetGroupAtAllRemain.payload;
|
|
override returnExample = GoCQHTTPActionsExamples.GetGroupAtAllRemain.response;
|
|
|
|
async _handle (payload: PayloadType) {
|
|
const ret = await this.core.apis.GroupApi.getGroupRemainAtTimes(payload.group_id.toString());
|
|
const data = {
|
|
can_at_all: ret.atInfo.canAtAll,
|
|
remain_at_all_count_for_group: ret.atInfo.RemainAtAllCountForGroup,
|
|
remain_at_all_count_for_uin: ret.atInfo.RemainAtAllCountForUin,
|
|
};
|
|
return data;
|
|
}
|
|
}
|