NapCatQQ/packages/napcat-onebot/action/group/DelGroupNotice.ts
手瓜一十雪 1fa0980709 Refactor action examples structure and imports
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.
2026-01-27 16:45:44 +08:00

34 lines
1.2 KiB
TypeScript

import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
import { ActionName } from '@/napcat-onebot/action/router';
import { Static, Type } from '@sinclair/typebox';
import { GroupActionsExamples } from '../example/GroupActionsExamples';
const PayloadSchema = Type.Object({
group_id: Type.String({ description: '群号' }),
notice_id: Type.String({ description: '公告ID' }),
});
type PayloadType = Static<typeof PayloadSchema>;
const ReturnSchema = Type.Any({ description: '操作结果' });
type ReturnType = Static<typeof ReturnSchema>;
export class DelGroupNotice extends OneBotAction<PayloadType, ReturnType> {
override actionName = ActionName.DelGroupNotice;
override payloadSchema = PayloadSchema;
override returnSchema = ReturnSchema;
override actionSummary = '删除群公告';
override actionDescription = '删除群聊中的公告';
override actionTags = ['群组接口'];
override payloadExample = GroupActionsExamples.DelGroupNotice.payload;
override returnExample = GroupActionsExamples.DelGroupNotice.response;
async _handle (payload: PayloadType) {
const group = payload.group_id.toString();
const noticeId = payload.notice_id;
return await this.core.apis.GroupApi.deleteGroupBulletin(group, noticeId);
}
}