fix: typo

This commit is contained in:
手瓜一十雪 2024-07-28 23:49:04 +08:00
parent 8f54310f63
commit 67b47e39b4
2 changed files with 12 additions and 12 deletions

View File

@ -72,8 +72,9 @@ class LimitedHashTable<K, V> {
return undefined;
}
const result: { key: K; value: V }[] = [];
for (let i = 0; i < Math.min(size, keyList.length); i++) {
const key = keyList[i];
const listSize = Math.min(size, keyList.length);
for (let i = 0; i < listSize; i++) {
const key = keyList[listSize - i];
result.push({ key, value: this.keyToValue.get(key)! });
}
return result;
@ -92,8 +93,8 @@ class MessageUniqueWrapper {
if (!heads) {
return [];
}
let date = heads.map((t) => MessageUnique.getMsgIdAndPeerByShortId(t.value));
let ret = date.filter((t) => t?.Peer.chatType === Peer.chatType && t?.Peer.peerUid === Peer.peerUid);
let data = heads.map((t) => MessageUnique.getMsgIdAndPeerByShortId(t.value));
let ret = data.filter((t) => t?.Peer.chatType === Peer.chatType && t?.Peer.peerUid === Peer.peerUid);
return ret.map((t) => t?.MsgId).filter((t) => t !== undefined);
}
createMsg(peer: Peer, msgId: string): number | undefined {

View File

@ -147,10 +147,15 @@ export class OB11Constructor {
peerUid: msg.peerUid,
guildId: '',
};
let replyMsg: RawMessage | undefined;
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);
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);
@ -161,12 +166,6 @@ export class OB11Constructor {
records.senderUid
)).msgList[0];
}
if (!replyMsg || replyMsg.msgRandom !== records.msgRandom) {
logWarn(`消息比对失败,准备重新尝试 Info: CurrentMsgRandom:${replyMsg?.msgRandom}/TargetMsgRandom:${records.msgRandom}`);
await sleep(500);
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}`);
throw new Error('回复消息消息验证失败')