mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-05 15:11:15 +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.
34 lines
1.2 KiB
TypeScript
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);
|
|
}
|
|
}
|