diff --git a/packages/core/src/bridge/bridge-contacts.ts b/packages/core/src/bridge/bridge-contacts.ts index 63c2bbaa..23f537f1 100644 --- a/packages/core/src/bridge/bridge-contacts.ts +++ b/packages/core/src/bridge/bridge-contacts.ts @@ -208,9 +208,10 @@ export async function fetchGroupMemberList(bridge: Bridge, groupId: number): Pro export async function fetchUserProfile(bridge: Bridge, uin: number): Promise { const keys = [20002, 27394, 20009, 20031, 101, 103, 102, 20020, 20003, 20026, 105, 27372, 27406, 20037]; + // Only `uin` and `keys` — see OidbUserInfoRequestSchema for why + // sending field 2 makes the server reject the request. const body = { uin, - field2: 0, keys: keys.map(k => ({ key: k })), }; diff --git a/packages/core/src/bridge/proto/oidb-action.ts b/packages/core/src/bridge/proto/oidb-action.ts index b4b28a1a..ec521dff 100644 --- a/packages/core/src/bridge/proto/oidb-action.ts +++ b/packages/core/src/bridge/proto/oidb-action.ts @@ -190,10 +190,14 @@ export const OidbUserInfoKeySchema = { key: { field: 1, type: 'uint32' as const }, } satisfies ProtoSchema; +// Field 2 USED to be `field2: uint32 = 0`, but newer QQ NT versions +// reinterpret field 2 as `uid: string` / `openid: string` and reject +// the request with "one of uid/openid is invaild" when a varint 0 +// shows up there. NapCat's schema (Oidb.0XFE1_2.ts) only emits `uin` +// and `key[]`, so we match that exactly. export const OidbUserInfoRequestSchema = { - uin: { field: 1, type: 'uint32' as const }, - field2: { field: 2, type: 'uint32' as const }, - keys: { field: 3, type: 'repeated_message' as const, schema: OidbUserInfoKeySchema }, + uin: { field: 1, type: 'uint32' as const }, + keys: { field: 3, type: 'repeated_message' as const, schema: OidbUserInfoKeySchema }, } satisfies ProtoSchema; export const OidbTwoNumberSchema = {