From 71bb4f68f3c856666c985485bd2d3b67c89919d5 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: Sat, 3 Jan 2026 16:01:24 +0800 Subject: [PATCH] Improve senderUin handling in sendMsg method If senderUin is missing or '0', attempt to retrieve it using senderUid before returning. This ensures messages are not dropped when senderUid is available but senderUin is not. --- packages/napcat-onebot/api/msg.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/napcat-onebot/api/msg.ts b/packages/napcat-onebot/api/msg.ts index ee3446f7..417f8d38 100644 --- a/packages/napcat-onebot/api/msg.ts +++ b/packages/napcat-onebot/api/msg.ts @@ -984,8 +984,20 @@ export class OneBotMsgApi { disableGetUrl: boolean = false, quick_reply: boolean = false ) { - if (msg.senderUin === '0' || msg.senderUin === '') return; - if (msg.peerUin === '0' || msg.peerUin === '') return; + if ((msg.senderUin === '0' || msg.senderUin === '')) { + if (msg.senderUid && msg.senderUid !== '' && msg.senderUid !== '0') { + msg.senderUin = await this.core.apis.UserApi.getUinByUidV2(msg.senderUid); + } else { + return undefined; + } + } + if (msg.peerUin === '0' || msg.peerUin === '') { + if (msg.peerUid && msg.peerUid !== '' && msg.peerUid !== '0') { + msg.peerUin = await this.core.apis.UserApi.getUinByUidV2(msg.peerUid); + } else { + return undefined; + } + } const resMsg = this.initializeMessage(msg);