From 0e60d4b19845adbccb358563d424c1ac13032c55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Sun, 28 Jul 2024 23:53:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=BB=B6=E8=BF=9F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/onebot11/constructor.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/onebot11/constructor.ts b/src/onebot11/constructor.ts index 1baf0707..17b81a35 100644 --- a/src/onebot11/constructor.ts +++ b/src/onebot11/constructor.ts @@ -152,13 +152,13 @@ export class OB11Constructor { replyMsg = (await NTQQMsgApi.getMsgsBySeqAndCount({ peerUid: msg.peerUid, guildId: '', chatType: msg.chatType }, element.replyElement.replayMsgSeq, 1, true, true)).msgList[0]; if (!replyMsg || replyMsg.msgRandom !== records.msgRandom) { - logWarn(`消息比对失败,准备重新尝试 Info: CurrentMsgRandom:${replyMsg?.msgRandom}/TargetMsgRandom:${records.msgRandom}`); - await sleep(500); + //logWarn(`消息比对失败,准备重新尝试 Info: CurrentMsgRandom:${replyMsg?.msgRandom}/TargetMsgRandom:${records.msgRandom}`); + await sleep(700); replyMsg = (await NTQQMsgApi.getMsgsByMsgId(peer, MessageUnique.getRecentMsgIds(peer, 50))).msgList.find((msg) => msg.msgRandom == records.msgRandom && msg.msgSeq == element.replyElement.replayMsgSeq); } if (!replyMsg || replyMsg.msgRandom !== records.msgRandom) { - logWarn(`消息比对失败,准备重新尝试 Info: CurrentMsgRandom:${replyMsg?.msgRandom}/TargetMsgRandom:${records.msgRandom}`); - await sleep(500); + //logWarn(`消息比对失败,准备重新尝试 Info: CurrentMsgRandom:${replyMsg?.msgRandom}/TargetMsgRandom:${records.msgRandom}`); + await sleep(700); replyMsg = (await NTQQMsgApi.queryMsgsWithFilterExWithSeq( peer, element.replyElement.replayMsgSeq, @@ -166,8 +166,15 @@ export class OB11Constructor { records.senderUid )).msgList[0]; } + + // 最后尝试第一次的方法 if (!replyMsg || replyMsg.msgRandom !== records.msgRandom) { - logWarn(`消息比对失败,准备重新尝试 Info: CurrentMsgRandom:${replyMsg?.msgRandom}/TargetMsgRandom:${records.msgRandom}`); + //logWarn(`消息比对失败,准备重新尝试 Info: CurrentMsgRandom:${replyMsg?.msgRandom}/TargetMsgRandom:${records.msgRandom}`); + await sleep(700); + replyMsg = (await NTQQMsgApi.getMsgsByMsgId(peer, MessageUnique.getRecentMsgIds(peer, 50))).msgList.find((msg) => msg.msgRandom == records.msgRandom && msg.msgSeq == element.replyElement.replayMsgSeq); + } + if (!replyMsg || replyMsg.msgRandom !== records.msgRandom) { + //logWarn(`消息比对失败,准备重新尝试 Info: CurrentMsgRandom:${replyMsg?.msgRandom}/TargetMsgRandom:${records.msgRandom}`); throw new Error('回复消息消息验证失败') } if (replyMsg) {