fix(onebot): seed self nickname on synthetic self-sent events

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.
This commit is contained in:
DrSmoothl
2026-07-05 14:20:36 +08:00
parent 5f90cc9b6e
commit 8dde7ef8e2
@@ -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,
},