From 5db201c34241ee7441c3d9f44900f489908cb224 Mon Sep 17 00:00:00 2001 From: Alen Date: Sat, 27 Jul 2024 04:01:22 +0800 Subject: [PATCH 1/2] =?UTF-8?q?BUG=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复创建reply消息体时向NTQQMsgApi.getMsgsByMsgId提交空值查询会导致QQ崩溃的BUG --- src/onebot11/action/msg/SendMsg/create-send-elements.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/onebot11/action/msg/SendMsg/create-send-elements.ts b/src/onebot11/action/msg/SendMsg/create-send-elements.ts index 915732b8..9769db8c 100644 --- a/src/onebot11/action/msg/SendMsg/create-send-elements.ts +++ b/src/onebot11/action/msg/SendMsg/create-send-elements.ts @@ -12,7 +12,7 @@ import { SignMusicWrapper } from '@/core'; import { getGroupMember } from '@/core/data'; -import { logDebug, logError } from '@/common/utils/log'; +import { logDebug, logError, logWarn } from '@/common/utils/log'; import { uri2local } from '@/common/utils/file'; import { ob11Config } from '@/onebot11/config'; import { RequestUtil } from '@/common/utils/request'; @@ -88,6 +88,10 @@ const _handlers: { [OB11MessageDataType.reply]: async ({ data: { id } }) => { const replyMsgM = MessageUnique.getMsgIdAndPeerByShortId(parseInt(id)); + if (!replyMsgM) { + logWarn('回复消息不存在', id); + return undefined; + } const replyMsg = (await NTQQMsgApi.getMsgsByMsgId(replyMsgM?.Peer!, [replyMsgM?.MsgId!])).msgList[0]; return replyMsg ? SendMsgElementConstructor.reply(replyMsg.msgSeq, replyMsg.msgId, replyMsg.senderUin!, replyMsg.senderUin!) : From 990a31e9615ced7393ab15ab4ec1eaf9ee629da3 Mon Sep 17 00:00:00 2001 From: Alen Date: Sat, 27 Jul 2024 04:10:01 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根据GOCQ标准将获取群历史消息中的msg_seq改为非必要参数,默认为0 --- src/onebot11/action/go-cqhttp/GetGroupMsgHistory.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/onebot11/action/go-cqhttp/GetGroupMsgHistory.ts b/src/onebot11/action/go-cqhttp/GetGroupMsgHistory.ts index e264cd32..c1f43021 100644 --- a/src/onebot11/action/go-cqhttp/GetGroupMsgHistory.ts +++ b/src/onebot11/action/go-cqhttp/GetGroupMsgHistory.ts @@ -18,7 +18,7 @@ const SchemaData = { message_seq: { type: 'number' }, count: { type: 'number' } }, - required: ['group_id', 'message_seq', 'count'] + required: ['group_id', 'count'] } as const satisfies JSONSchema; type Payload = FromSchema; @@ -31,7 +31,7 @@ export default class GoCQHTTPGetGroupMsgHistory extends BaseAction