From e7afef5d631dda75c55cb7ee5d1fd8756a895c31 Mon Sep 17 00:00:00 2001 From: DrSmoothl <1787882683@qq.com> Date: Thu, 21 May 2026 08:10:53 +0800 Subject: [PATCH] fix(proto): correct OidbGroupReaction field numbers (off-by-one) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `set_msg_emoji_like` was failing with "invalid ReqBody.EmojiType: value must be greater than 0" because `OidbGroupReaction` had every field number off by one — `type` was at field 4, but the server reads `EmojiType` at field 5. The mistake covered all four fields: field what was should be ───── ──────── ─── ───────── 2 groupUin 1 2 3 sequence 2 3 4 code 3 4 5 type 4 5 Cross-checked with Lagrange.Core V2's `OidbSvcTrpcTcp0x9082.cs` — their definition starts at field 2 and runs through 7. The OIDB envelope wraps the body at field 4, so the inner body's own fields must start at 2 to avoid collision with the wrapper. (The previous 1..4 layout happened to encode SOMETHING wire-valid, just not what the server's `OidbSvcTrpcTcp0x9082` validator expected.) Also added the trailing `field6` and `field7` unused booleans that Lagrange serialises as `false`. The server currently tolerates them missing; including them keeps SnowLuma byte-identical with Lagrange in case the validator gets stricter. The reaction-type heuristic stays the same (`code.length > 3 ? 2 : 1` — Lagrange uses the same `IsEmoji => Code.Length > 3` check in `GroupAddReactionEvent.cs`). --- packages/core/src/bridge/apis/interaction.ts | 13 ++++++++----- packages/proto-defs/src/oidb-actions/base.ts | 20 ++++++++++++++++---- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/packages/core/src/bridge/apis/interaction.ts b/packages/core/src/bridge/apis/interaction.ts index 5c9a3848..6893f219 100644 --- a/packages/core/src/bridge/apis/interaction.ts +++ b/packages/core/src/bridge/apis/interaction.ts @@ -45,12 +45,15 @@ export class InteractionApi { const bridge = asBridge(this.ctx); const subCmd = isSet ? 1 : 2; const cmd = isSet ? 'OidbSvcTrpcTcp.0x9082_1' : 'OidbSvcTrpcTcp.0x9082_2'; - // Same heuristic NapCat uses: QQ face ids are 1–3 digits ("76"), - // unicode codepoints are longer ("128516"). Server requires the - // type field to pick the right resolution table; omitting it makes - // unicode reactions silently fail. + // Same heuristic Lagrange.Core V2 uses (`GroupAddReactionEvent.IsEmoji`): + // QQ face ids are 1–3 digits ("76") → type=1, unicode codepoints are + // longer ("128516") → type=2. Server reads the type at field 5; sending + // it at the wrong field number triggers + // "invalid ReqBody.EmojiType: value must be greater than 0". const type = code.length > 3 ? 2 : 1; - const env = makeOidbEnvelope(0x9082, subCmd, { groupUin: groupId, sequence, code, type }); + const env = makeOidbEnvelope(0x9082, subCmd, { + groupUin: groupId, sequence, code, type, field6: false, field7: false, + }); await runOidb(bridge, cmd, protobuf_encode>(env)); } diff --git a/packages/proto-defs/src/oidb-actions/base.ts b/packages/proto-defs/src/oidb-actions/base.ts index 3773970f..820da07b 100644 --- a/packages/proto-defs/src/oidb-actions/base.ts +++ b/packages/proto-defs/src/oidb-actions/base.ts @@ -289,11 +289,23 @@ export interface C2CRecallRequest { settings?: pb<5, C2CRecallSettings>; field6?: pb<6, bool>; } +// Field numbers are 2..7 — NOT 1..4. The 0x9082 request body is nested +// inside the OIDB envelope's `body` (which itself uses fields 1-5,11,12), +// so the inner offsets start at 2 to match Lagrange.Core V2's +// `OidbSvcTrpcTcp0x9082` definition. Sending `type` at field 4 instead of +// 5 makes the server read `EmojiType` as zero and reject with +// "ReqBody.EmojiType: value must be greater than 0". +// +// Field6/Field7 are unused booleans that Lagrange serialises as `false`; +// the server tolerates them missing, but we emit them to stay byte- +// identical with Lagrange in case the validator gets stricter. export interface OidbGroupReaction { - groupUin?: pb<1, uint_32>; - sequence?: pb<2, uint_32>; - code?: pb<3, string>; - type?: pb<4, uint_32>; + groupUin?: pb<2, uint_32>; + sequence?: pb<3, uint_32>; + code?: pb<4, string>; + type?: pb<5, uint_32>; + field6?: pb<6, bool>; + field7?: pb<7, bool>; } export interface GroupReadedReportItem { groupUin?: pb<1, uint_64>;