NapCatQQ/packages/napcat-onebot/action/msg/SendPrivateMsg.ts
手瓜一十雪 fd1808e36a Add action examples and enhance action metadata
Introduced a centralized examples.ts file providing payload and return examples for all actions. Updated numerous action classes to include actionDescription, actionTags, payloadExample, and returnExample fields, improving API documentation and discoverability.
2026-01-25 17:45:46 +08:00

25 lines
890 B
TypeScript

import { ContextMode, ReturnDataType, SendMsgBase, SendMsgPayload } from './SendMsg';
import { ActionName, BaseCheckResult } from '@/napcat-onebot/action/router';
import { ActionExamples } from '../examples';
// 未检测参数
class SendPrivateMsg extends SendMsgBase {
override actionName = ActionName.SendPrivateMsg;
override actionDescription = '发送私聊消息';
override actionTags = ['消息接口'];
override payloadExample = ActionExamples.SendPrivateMsg.payload;
override returnExample = ActionExamples.SendPrivateMsg.return;
protected override async check (payload: SendMsgPayload): Promise<BaseCheckResult> {
payload.message_type = 'private';
return super.check(payload);
}
override async _handle (payload: SendMsgPayload): Promise<ReturnDataType> {
return this.base_handle(payload, ContextMode.Private);
}
}
export default SendPrivateMsg;