NapCatQQ/packages/napcat-onebot/action/go-cqhttp/SendForwardMsg.ts
2025-11-13 15:10:47 +08:00

33 lines
1.3 KiB
TypeScript

import { ContextMode, normalize, ReturnDataType, SendMsgBase } from '@/napcat-onebot/action/msg/SendMsg';
import { OB11PostSendMsg } from '@/napcat-onebot/types';
import { ActionName } from '@/napcat-onebot/action/router';
// 未验证
export class GoCQHTTPSendForwardMsgBase extends SendMsgBase {
protected override async check (payload: OB11PostSendMsg) {
if (payload.messages) payload.message = normalize(payload.messages);
return super.check(payload);
}
}
export class GoCQHTTPSendForwardMsg extends GoCQHTTPSendForwardMsgBase {
override actionName = ActionName.GoCQHTTP_SendForwardMsg;
protected override async check (payload: OB11PostSendMsg) {
if (payload.messages) payload.message = normalize(payload.messages);
return super.check(payload);
}
}
export class GoCQHTTPSendPrivateForwardMsg extends GoCQHTTPSendForwardMsgBase {
override actionName = ActionName.GoCQHTTP_SendPrivateForwardMsg;
override async _handle (payload: OB11PostSendMsg): Promise<ReturnDataType> {
return this.base_handle(payload, ContextMode.Private);
}
}
export class GoCQHTTPSendGroupForwardMsg extends GoCQHTTPSendForwardMsgBase {
override actionName = ActionName.GoCQHTTP_SendGroupForwardMsg;
override async _handle (payload: OB11PostSendMsg): Promise<ReturnDataType> {
return this.base_handle(payload, ContextMode.Group);
}
}