mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-05 15:11:15 +00:00
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.
63 lines
2.2 KiB
TypeScript
63 lines
2.2 KiB
TypeScript
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';
|
|
|
|
// 未验证
|
|
type GoCQHTTPSendForwardMsgPayload = SendMsgPayload & { messages?: OB11MessageMixType; };
|
|
|
|
export class GoCQHTTPSendForwardMsgBase extends SendMsgBase {
|
|
protected override async check (payload: GoCQHTTPSendForwardMsgPayload) {
|
|
if (payload.messages) payload.message = normalize(payload.messages);
|
|
return super.check(payload);
|
|
}
|
|
}
|
|
export class GoCQHTTPSendForwardMsg extends GoCQHTTPSendForwardMsgBase {
|
|
override actionName = ActionName.GoCQHTTP_SendForwardMsg;
|
|
override actionSummary = '发送合并转发消息';
|
|
override actionDescription = '发送合并转发消息';
|
|
override actionTags = ['Go-CQHTTP'];
|
|
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);
|
|
return super.check(payload);
|
|
}
|
|
}
|
|
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);
|
|
}
|
|
}
|
|
|
|
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);
|
|
}
|
|
}
|