From 8dde7ef8e2ccade59afdcac2682537f9571dfe82 Mon Sep 17 00:00:00 2001 From: DrSmoothl <1787882683@qq.com> Date: Sun, 5 Jul 2026 14:14:09 +0800 Subject: [PATCH] fix(onebot): seed self nickname on synthetic self-sent events MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit get_msg / get_group_msg_history returned an empty sender.nickname for the bot's own group file / video sends. Those publish via OIDB (0x6d9_4 / c2c finalize) rather than PbSendMsg, so the QQ server never echoes them back — and the echo is what normally overwrites the synthetic self-sent store's placeholder nickname. For a plain text send the echo arrives and fills it, which is why only file/video surfaced empty. Seed the synthetic event's sender.nickname from the bot's own identity.nickname (we are the sender, so we know it). A normal text send's echo still overwrites it with the same value. Verified on-target: a self-sent group video now shows the bot nickname in history. --- packages/onebot/src/modules/message-actions.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/onebot/src/modules/message-actions.ts b/packages/onebot/src/modules/message-actions.ts index 5fc245ce..8c2385a9 100644 --- a/packages/onebot/src/modules/message-actions.ts +++ b/packages/onebot/src/modules/message-actions.ts @@ -502,7 +502,12 @@ async function cacheSelfSentMessage( font: 0, sender: { user_id: selfId, - nickname: '', + // This is the bot itself — seed our own nickname so a self-sent message + // that the server never echoes back (notably group file / video sends, + // which publish via OIDB rather than PbSendMsg) doesn't surface an empty + // sender.nickname in get_msg / get_group_msg_history. For a normal text + // send the echo still overwrites this with the same value. + nickname: ref.bridge.identity.nickname || '', sex: 'unknown', age: 0, },