fix(proto): correct OidbGroupReaction field numbers (off-by-one)
`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`).
This commit is contained in:
2 files changed
+24
-9
No files matched your search
@@ -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<OidbGroupReaction>(0x9082, subCmd, { groupUin: groupId, sequence, code, type });
|
||||
const env = makeOidbEnvelope<OidbGroupReaction>(0x9082, subCmd, {
|
||||
groupUin: groupId, sequence, code, type, field6: false, field7: false,
|
||||
});
|
||||
await runOidb(bridge, cmd, protobuf_encode<OidbBase<OidbGroupReaction>>(env));
|
||||
}
|
||||
|
||||
|
||||
@@ -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>;
|
||||
|
||||
Reference in new issue
Block a user