fix: 延迟调整

This commit is contained in:
手瓜一十雪 2024-07-28 23:53:45 +08:00
parent 67b47e39b4
commit 0e60d4b198

View File

@ -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]; 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) { if (!replyMsg || replyMsg.msgRandom !== records.msgRandom) {
logWarn(`消息比对失败,准备重新尝试 Info: CurrentMsgRandom:${replyMsg?.msgRandom}/TargetMsgRandom:${records.msgRandom}`); //logWarn(`消息比对失败,准备重新尝试 Info: CurrentMsgRandom:${replyMsg?.msgRandom}/TargetMsgRandom:${records.msgRandom}`);
await sleep(500); await sleep(700);
replyMsg = (await NTQQMsgApi.getMsgsByMsgId(peer, MessageUnique.getRecentMsgIds(peer, 50))).msgList.find((msg) => msg.msgRandom == records.msgRandom && msg.msgSeq == element.replyElement.replayMsgSeq); 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) { if (!replyMsg || replyMsg.msgRandom !== records.msgRandom) {
logWarn(`消息比对失败,准备重新尝试 Info: CurrentMsgRandom:${replyMsg?.msgRandom}/TargetMsgRandom:${records.msgRandom}`); //logWarn(`消息比对失败,准备重新尝试 Info: CurrentMsgRandom:${replyMsg?.msgRandom}/TargetMsgRandom:${records.msgRandom}`);
await sleep(500); await sleep(700);
replyMsg = (await NTQQMsgApi.queryMsgsWithFilterExWithSeq( replyMsg = (await NTQQMsgApi.queryMsgsWithFilterExWithSeq(
peer, peer,
element.replyElement.replayMsgSeq, element.replyElement.replayMsgSeq,
@ -166,8 +166,15 @@ export class OB11Constructor {
records.senderUid records.senderUid
)).msgList[0]; )).msgList[0];
} }
// 最后尝试第一次的方法
if (!replyMsg || replyMsg.msgRandom !== records.msgRandom) { 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('回复消息消息验证失败') throw new Error('回复消息消息验证失败')
} }
if (replyMsg) { if (replyMsg) {