fix: #215 get_forward_msg params missing id(onebot11)

This commit is contained in:
linyuchen 2024-05-24 08:50:22 +08:00
parent 92b49015b0
commit abbd6797c4

View File

@ -6,7 +6,8 @@ import { OB11Constructor } from '../../constructor'
import { ActionName } from '../types' import { ActionName } from '../types'
interface Payload { interface Payload {
message_id: string // long msg id message_id: string // long msg idgocq
id?: string // long msg id, onebot11
} }
interface Response { interface Response {
@ -16,7 +17,11 @@ interface Response {
export class GoCQHTTGetForwardMsgAction extends BaseAction<Payload, any> { export class GoCQHTTGetForwardMsgAction extends BaseAction<Payload, any> {
actionName = ActionName.GoCQHTTP_GetForwardMsg actionName = ActionName.GoCQHTTP_GetForwardMsg
protected async _handle(payload: Payload): Promise<any> { protected async _handle(payload: Payload): Promise<any> {
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) { if (!rootMsg) {
throw Error('msg not found') throw Error('msg not found')
} }