test(onebot): confirm profile_like decode against real captures
Validated the 0x210/39 ProfileLikeTip field layout byte-exact against three real captured like pushes (detail.txt='赞了我的资料卡N次', f3=uin, f5=nick). Drop the pending-validation caveat; test now uses the real txt shape.
This commit is contained in:
3 files changed
+10
-9
No files matched your search
@@ -322,15 +322,16 @@ describe('parseMsgPush Event0x210 subType=39 (profile like → 名片赞)', () =
|
||||
}
|
||||
|
||||
it('emits friend_profile_like with liker uin, nick and parsed count', () => {
|
||||
// txt shape taken from a real capture: "赞了我的资料卡N次".
|
||||
const [event] = parseMsgPush(
|
||||
makeLikePacket({ uin: 1787882683, nick: '東雪蓮', txt: '赞了你3次' }),
|
||||
makeLikePacket({ uin: 1206069534, nick: '墨白灵MotricLuck', txt: '赞了我的资料卡2次' }),
|
||||
makeIdentity(),
|
||||
) as FriendProfileLikeEvent[];
|
||||
|
||||
expect(event.kind).toBe('friend_profile_like');
|
||||
expect(event.operatorUin).toBe(1787882683);
|
||||
expect(event.operatorNick).toBe('東雪蓮');
|
||||
expect(event.times).toBe(3);
|
||||
expect(event.operatorUin).toBe(1206069534);
|
||||
expect(event.operatorNick).toBe('墨白灵MotricLuck');
|
||||
expect(event.times).toBe(2);
|
||||
expect(event.time).toBe(1710001111);
|
||||
});
|
||||
|
||||
|
||||
@@ -284,9 +284,9 @@ export interface GroupSpecialTitleChange {
|
||||
|
||||
// Profile-like ("名片赞") notify — Event 0x210 subType 39, whose body.msgContent
|
||||
// decodes as this ProfileLikeTip. subType 39 is multiplexed; only inner
|
||||
// msgType==0 && subType==203 is a like. NOTE: proto shape sourced from NapCat's
|
||||
// raw-bytes decoder (adaptDecoder.ts) — semantics only; pending a real like
|
||||
// capture to confirm byte-exactly. times is parsed from `detail.txt`.
|
||||
// msgType==0 && subType==203 is a like. Field numbers CONFIRMED byte-exact against
|
||||
// real on-wire captures (detail.txt = "赞了我的资料卡N次", f3=liker uin, f5=nick);
|
||||
// the like count is parsed from `detail.txt`.
|
||||
export interface ProfileLikeDetail {
|
||||
txt?: pb<1, string>;
|
||||
uin?: pb<3, uint_64>;
|
||||
|
||||
@@ -165,8 +165,8 @@ function inputStatusText(eventType: number): string {
|
||||
// subType 39 is multiplexed; body.msgContent decodes as ProfileLikeTip and is a
|
||||
// profile-like ("名片赞") only when inner msgType==0 && subType==203. Other 39
|
||||
// variants (multi-device sync etc.) decode to a non-matching tip → dropped.
|
||||
// `times` is the like count parsed out of `detail.txt`. Proto shape from NapCat's
|
||||
// raw-bytes decoder — pending a real like capture to validate byte-exactly.
|
||||
// `times` is the like count parsed out of `detail.txt` ("赞了我的资料卡N次").
|
||||
// Field layout confirmed byte-exact against real on-wire captures.
|
||||
function decodeProfileLike(ctx: MsgPushContext): QQEventVariant[] {
|
||||
const tip = protobuf_decode<ProfileLikeTip>(ctx.content);
|
||||
// msgType 0 is the proto default → omitted on the wire → decodes as undefined,
|
||||
|
||||
Reference in new issue
Block a user