From 9335843246e3b7a17944861f3ac8731a259732c2 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: Fri, 30 Oct 2026 14:59:39 +0800 Subject: [PATCH] fix: #2106 --- packages/napcat-onebot/index.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/napcat-onebot/index.ts b/packages/napcat-onebot/index.ts index 838af29b6..06fae0cb2 100644 --- a/packages/napcat-onebot/index.ts +++ b/packages/napcat-onebot/index.ts @@ -365,15 +365,17 @@ export class NapCatOneBot11Adapter { msgListener.onAddSendMsg = async (msg) => { try { if (msg.sendStatus === SendStatusType.KSEND_STATUS_SENDING) { - const [updatemsgs] = await this.core.eventWrapper.registerListen('NodeIKernelMsgListener/onMsgInfoListUpdate', (msgList: RawMessage[]) => { - const report = msgList.find((e) => - e.senderUin === this.core.selfInfo.uin && e.sendStatus !== SendStatusType.KSEND_STATUS_SENDING && e.msgId === msg.msgId - ); - return !!report; - }, 1, 10 * 60 * 1000); + const isCompletedSend = (e: RawMessage) => + e.senderUin === this.core.selfInfo.uin && e.msgId === msg.msgId && + (e.sendStatus === SendStatusType.KSEND_STATUS_SUCCESS || e.sendStatus === SendStatusType.KSEND_STATUS_FAILED); + const [updatemsgs] = await this.core.eventWrapper.registerListen( + 'NodeIKernelMsgListener/onMsgInfoListUpdate', + (msgList: RawMessage[]) => msgList.some(isCompletedSend), + 1, + 10 * 60 * 1000 + ); // 10分钟 超时 - const updatemsg = updatemsgs.find((e) => e.msgId === msg.msgId); - // updatemsg?.sendStatus == SendStatusType.KSEND_STATUS_SUCCESS_NOSEQ NOSEQ一般是服务器未下发SEQ 这意味着这条消息不应该推送network + const updatemsg = updatemsgs.find(isCompletedSend); if (updatemsg?.sendStatus === SendStatusType.KSEND_STATUS_SUCCESS) { updatemsg.id = MessageUnique.createUniqueMsgId( {