feat(onebot): add group_name to group message events (#212)
Group message events (message + message_sent) now carry group_name — a non-standard but common OneBot extension. The name comes from the message's own wire field (ResponseGrp field 7, accurate even right after a rename), falling back to the identity group cache, else '' when neither is available. It's resolved in the group-message decoder, where both the wire head and the identity cache are already at hand, so the converter just passes it through (no ConverterContext change). Verified live (tempserver): real inbound group messages from a non-self account carry group_name set to the actual group name.
This commit is contained in:
5 files changed
+15
-3
No files matched your search
@@ -54,6 +54,7 @@ function makeGroupMessage(senderUin: number): GroupMessage {
|
||||
time: 1700000000,
|
||||
selfUin: SELF_ID,
|
||||
groupId: 99999,
|
||||
groupName: 'Test Group 测试群',
|
||||
senderUin,
|
||||
senderNick: senderUin === SELF_ID ? 'me' : 'peer',
|
||||
senderCard: '',
|
||||
@@ -100,6 +101,7 @@ describe('convertEvent — message kinds', () => {
|
||||
expect(out!.message_type).toBe('group');
|
||||
expect(out!.sub_type).toBe('normal');
|
||||
expect(out!.group_id).toBe(GROUP_ID);
|
||||
expect(out!.group_name).toBe('Test Group 测试群');
|
||||
});
|
||||
|
||||
it('group_message self → post_type "message_sent"', async () => {
|
||||
|
||||
Reference in new issue
Block a user