Add action metadata to OneBot action classes

Added or updated actionSummary, actionTags, payloadExample, and returnExample properties for all OneBot action classes in the napcat-onebot package. This improves API documentation and discoverability by providing concise summaries, categorization tags, and usage examples for each action.
This commit is contained in:
手瓜一十雪
2026-01-25 19:19:03 +08:00
parent 5b80a8576f
commit 60a9114495
86 changed files with 809 additions and 136 deletions

View File

@@ -2,8 +2,6 @@ import { OB11MessageMixType } from '@/napcat-onebot/types';
import { ContextMode, normalize, ReturnDataType, SendMsgBase, SendMsgPayload } from '@/napcat-onebot/action/msg/SendMsg';
import { ActionName } from '@/napcat-onebot/action/router';
import { GoCQHTTPActionsExamples } from './examples';
// 未验证
type GoCQHTTPSendForwardMsgPayload = SendMsgPayload & { messages?: OB11MessageMixType; };
@@ -18,8 +16,13 @@ export class GoCQHTTPSendForwardMsg extends GoCQHTTPSendForwardMsgBase {
override actionSummary = '发送合并转发消息';
override actionDescription = '发送合并转发消息';
override actionTags = ['Go-CQHTTP'];
override payloadExample = GoCQHTTPActionsExamples.SendForwardMsg.payload;
override returnExample = GoCQHTTPActionsExamples.SendForwardMsg.response;
override payloadExample = {
group_id: '123456789',
messages: []
};
override returnExample = {
message_id: 123456
};
protected override async check (payload: GoCQHTTPSendForwardMsgPayload) {
if (payload.messages) payload.message = normalize(payload.messages);
@@ -28,6 +31,15 @@ export class GoCQHTTPSendForwardMsg extends GoCQHTTPSendForwardMsgBase {
}
export class GoCQHTTPSendPrivateForwardMsg extends GoCQHTTPSendForwardMsgBase {
override actionName = ActionName.GoCQHTTP_SendPrivateForwardMsg;
override actionSummary = '发送私聊合并转发消息';
override actionTags = ['Go-CQHTTP'];
override payloadExample = {
user_id: '123456789',
messages: []
};
override returnExample = {
message_id: 123456
};
override async _handle (payload: GoCQHTTPSendForwardMsgPayload): Promise<ReturnDataType> {
return this.base_handle(payload, ContextMode.Private);
}
@@ -35,6 +47,15 @@ export class GoCQHTTPSendPrivateForwardMsg extends GoCQHTTPSendForwardMsgBase {
export class GoCQHTTPSendGroupForwardMsg extends GoCQHTTPSendForwardMsgBase {
override actionName = ActionName.GoCQHTTP_SendGroupForwardMsg;
override actionSummary = '发送群合并转发消息';
override actionTags = ['Go-CQHTTP'];
override payloadExample = {
group_id: '123456789',
messages: []
};
override returnExample = {
message_id: 123456
};
override async _handle (payload: GoCQHTTPSendForwardMsgPayload): Promise<ReturnDataType> {
return this.base_handle(payload, ContextMode.Group);
}