Refactor action example imports and add example files

Moved action example data to dedicated 'examples.ts' files for each action category (extends, file, go-cqhttp, group, msg, system, user). Updated all action classes to import and use the new example modules, improving code organization and maintainability. Also added missing actionTags and actionDescription where appropriate.
This commit is contained in:
手瓜一十雪
2026-01-25 17:55:07 +08:00
parent fd1808e36a
commit 335c83a3d5
38 changed files with 471 additions and 20 deletions

View File

@@ -3,6 +3,7 @@ import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
import { ActionName } from '@/napcat-onebot/action/router';
import { unlink } from 'node:fs/promises';
import { Static, Type } from '@sinclair/typebox';
import { GoCQHTTPActionsExamples } from './examples';
export const SendGroupNoticePayloadSchema = Type.Object({
group_id: Type.String({ description: '群号' }),
@@ -21,6 +22,10 @@ export class SendGroupNotice extends OneBotAction<SendGroupNoticePayload, void>
override actionName = ActionName.GoCQHTTP_SendGroupNotice;
override payloadSchema = SendGroupNoticePayloadSchema;
override returnSchema = Type.Null();
override actionDescription = '发送群公告';
override actionTags = ['Go-CQHTTP'];
override payloadExample = GoCQHTTPActionsExamples.SendGroupNotice.payload;
async _handle (payload: SendGroupNoticePayload) {
let UploadImage: { id: string, width: number, height: number; } | undefined;
if (payload.image) {