feat: added an gocqhttp extended api send_forward_msg

This commit is contained in:
MisakaTAT 2024-03-25 17:50:54 +08:00
parent 4461c7ed47
commit cd50df3a56
3 changed files with 13 additions and 7 deletions

View File

@ -2,17 +2,21 @@ import SendMsg, {convertMessage2List} from "../msg/SendMsg";
import {OB11PostSendMsg} from "../../types";
import {ActionName} from "../types";
export class GoCQHTTPSendGroupForwardMsg extends SendMsg {
actionName = ActionName.GoCQHTTP_SendGroupForwardMsg;
export class GoCQHTTPSendForwardMsg extends SendMsg {
actionName = ActionName.GoCQHTTP_SendForwardMsg;
protected async check(payload: OB11PostSendMsg) {
if (payload.messages){
payload.message = convertMessage2List(payload.messages);
}
if (payload.user_id) this.actionName = ActionName.GoCQHTTP_SendPrivateForwardMsg;
if (payload.group_id) this.actionName = ActionName.GoCQHTTP_SendGroupForwardMsg;
if (payload.messages) payload.message = convertMessage2List(payload.messages);
return super.check(payload);
}
}
export class GoCQHTTPSendPrivateForwardMsg extends GoCQHTTPSendGroupForwardMsg {
export class GoCQHTTPSendPrivateForwardMsg extends GoCQHTTPSendForwardMsg {
actionName = ActionName.GoCQHTTP_SendPrivateForwardMsg;
}
export class GoCQHTTPSendGroupForwardMsg extends GoCQHTTPSendForwardMsg {
actionName = ActionName.GoCQHTTP_SendGroupForwardMsg;
}

View File

@ -14,7 +14,7 @@ import GetVersionInfo from "./system/GetVersionInfo";
import CanSendRecord from "./system/CanSendRecord";
import CanSendImage from "./system/CanSendImage";
import GetStatus from "./system/GetStatus";
import {GoCQHTTPSendGroupForwardMsg, GoCQHTTPSendPrivateForwardMsg} from "./go-cqhttp/SendForwardMsg";
import {GoCQHTTPSendForwardMsg, GoCQHTTPSendGroupForwardMsg, GoCQHTTPSendPrivateForwardMsg} from "./go-cqhttp/SendForwardMsg";
import GoCQHTTPGetStrangerInfo from "./go-cqhttp/GetStrangerInfo";
import SendLike from "./user/SendLike";
import SetGroupAddRequest from "./group/SetGroupAddRequest";
@ -73,6 +73,7 @@ export const actionHandlers = [
new CleanCache(),
//以下为go-cqhttp api
new GoCQHTTPSendForwardMsg(),
new GoCQHTTPSendGroupForwardMsg(),
new GoCQHTTPSendPrivateForwardMsg(),
new GoCQHTTPGetStrangerInfo(),

View File

@ -51,6 +51,7 @@ export enum ActionName {
GetRecord = "get_record",
CleanCache = "clean_cache",
// 以下为go-cqhttp api
GoCQHTTP_SendForwardMsg = "send_forward_msg",
GoCQHTTP_SendGroupForwardMsg = "send_group_forward_msg",
GoCQHTTP_SendPrivateForwardMsg = "send_private_forward_msg",
GoCQHTTP_GetStrangerInfo = "get_stranger_info",