fix(protocol): set_group_special_title — send uinName so the title actually applies

The 0x8FC_2 body omitted uinName (tag 7), so the server accepted the request
(errorCode 0) but silently never applied the title — looking like the feature
was unsupported. Both NapCat (Oidb.0x8FC_2: uinName=title) and Lagrange
(0x8FC body @7 UinName=title) set it; mirror them by sending uinName = title.

No RE needed — two independent packet-based implementations agree on the field.

Note: setting a special title is group-owner-only, so on-target validation
requires a group the bot owns.
This commit is contained in:
DrSmoothl committed 2026-06-22 21:53:33 +08:00
1 parent 1bd126562f
commit b918450483
3 files changed
+9

No files matched your search

@@ -119,6 +119,10 @@ export interface OidbSpecialTitleBody {
targetUid?: pb<1, string>;
specialTitle?: pb<5, string>;
expireTime?: pb<6, int_32>;
// The server requires uinName (tag 7) set to the same title, else it accepts
// the request (errorCode 0) but silently never applies it. Both NapCat and
// Lagrange send uinName = title (Lagrange 0x8FC body @7, NapCat Oidb.0x8FC_2).
uinName?: pb<7, string>;
}
export interface OidbSpecialTitle {
groupUin?: pb<1, uint_32>;
@@ -20,6 +20,9 @@ export namespace SetSpecialTitle {
targetUid: await ctx.resolveUserUid(p.userId, p.groupId),
specialTitle: p.title,
expireTime: -1,
// Must mirror specialTitle, or the server accepts the request (errorCode 0)
// but silently never applies the title (see OidbSpecialTitleBody note).
uinName: p.title,
},
});
@@ -30,6 +30,8 @@ describe('SetSpecialTitle namespace', () => {
expect(env.body?.groupUin).toBe(12345);
expect(env.body?.body?.targetUid).toBe('resolved-uid');
expect(env.body?.body?.specialTitle).toBe('crown');
// uinName (tag 7) must mirror specialTitle or the server silently no-ops.
expect(env.body?.body?.uinName).toBe('crown');
// -1 (int_32) round-trips as 0xFFFFFFFF after the proton decoder reinterprets.
expect(env.body?.body?.expireTime).toBe(0xFFFFFFFF);
});