From abbd6797c4b02cc50b91a1a8dde65ef04c6bbef2 Mon Sep 17 00:00:00 2001 From: linyuchen Date: Fri, 24 May 2024 08:50:22 +0800 Subject: [PATCH] fix: #215 get_forward_msg params missing id(onebot11) --- src/onebot11/action/go-cqhttp/GetForwardMsg.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/onebot11/action/go-cqhttp/GetForwardMsg.ts b/src/onebot11/action/go-cqhttp/GetForwardMsg.ts index affe4db..884cdfb 100644 --- a/src/onebot11/action/go-cqhttp/GetForwardMsg.ts +++ b/src/onebot11/action/go-cqhttp/GetForwardMsg.ts @@ -6,7 +6,8 @@ import { OB11Constructor } from '../../constructor' import { ActionName } from '../types' interface Payload { - message_id: string // long msg id + message_id: string // long msg id,gocq + id?: string // long msg id, onebot11 } interface Response { @@ -16,7 +17,11 @@ interface Response { export class GoCQHTTGetForwardMsgAction extends BaseAction { actionName = ActionName.GoCQHTTP_GetForwardMsg protected async _handle(payload: Payload): Promise { - const rootMsg = await dbUtil.getMsgByLongId(payload.message_id) + const message_id = payload.id || payload.message_id + if (!message_id) { + throw Error('message_id不能为空') + } + const rootMsg = await dbUtil.getMsgByLongId(message_id) if (!rootMsg) { throw Error('msg not found') }