mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-05 15:11:15 +00:00
Replaced generic ActionExamples imports with more specific examples modules (FileActionsExamples, GroupActionsExamples, GoCQHTTPActionsExamples) across file, group, and go-cqhttp actions. Added or updated actionSummary, actionDescription, actionTags, payloadExample, and returnExample properties for improved API documentation and clarity.
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 './examples';
|
|
|
|
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;
|
|
}
|
|
}
|