fix(protocol): make set_group_search actually apply search flags (#191)

旧实现走 OIDB 0x89a_0 但 settings 发空字节 → 服务端返 ok 却 no-op;action 也只收
group_id,没有设置搜索方式的参数(报告属实)。

真机 RE 定稿(tempserver,bot 为管理员的实群逐字段扫描 + GET 读回):
- 修改命令 = 0x89a_0(全量抓包确认,与 MuteAll 同命令,靠 body 形状区分)。结构
  = {1:groupUin, 2: 只含被改字段的 GroupDetailInfo modify 子消息}。这是与 0x88D_0
  群详情 GET **不同的消息域**(mute/shutUpTime 在此=tag17,在 GET 里却是字符串),
  所以标签不能照搬 GET。
- 在 modify 子消息里逐 tag 试写、经 0x88D_0 GET 读回效果,定位:
  noFingerOpen(关键词/群指纹搜索)=tag 35,noCodeFingerOpen(群号搜索/总开关)=tag 36;
  再对照客户端「被搜索方式」三选下拉(私密/群号/群号+关键词)核实语义与 0/1 取值。
- proto-defs:settings 改为 Oidb0x89a_0SearchSettings 子消息,两 flag 用 pb_optional
  (显式存在)——否则 proto3 丢 0 值,导致关闭(=0)被静默忽略。undefined 仍省略。
- set-search/bridge/action:透传 no_finger_open / no_code_finger_open;只下发提供的
  字段(同 NapCat filter 机制、与 modify-group-ext-info 一致)。catalog regen。
- 编码测试锁定:0 值必发 tag 35/36、未提供则省略、命令为 0x89a_0。

typecheck 12 包干净;protocol 585 / onebot 521 / core 472 全绿。
This commit is contained in:
DrSmoothl committed 2026-07-03 17:37:55 +08:00
1 parent 884db940df
commit 7744e24af2
7 files changed
+152 -16

No files matched your search

+21 -1
View File
@@ -31,9 +31,29 @@ export interface Oidb0x89a_0AddOption {
settings?: pb<2, Oidb0x89a_0AddOptionSettings>;
field12?: pb<12, uint_32>;
}
// The `settings` payload is the GroupDetailInfo "modify" sub-message carrying
// only the fields being changed (the NT GroupDetailFilter is client-side — it
// just gates which fields the encoder emits, like modify-group-ext-info). This
// is a DIFFERENT message domain from the 0x88D_0 group-detail GET: mute/
// shutUpTime is tag 17 here (Lagrange/MuteAll) but a string in the GET, so the
// tags do NOT match the GET's groupInfo. Tags RE'd empirically on a live group
// (bot as admin) by sweeping this sub-message tag-by-tag and reading the effect
// back through the 0x88D_0 GET (82/83), then confirming against the client's
// 3-state "被搜索方式" dropdown (私密 / 群号 / 群号+关键词):
// noFingerOpen (关键词/群指纹搜索) = tag 35 → GET 82
// noCodeFingerOpen (群号搜索 / 总开关) = tag 36 → GET 83
// Value 0 = that mode open/enabled, 1 = disabled ("no…Open"); keyword search
// additionally requires code search on. Matches NapCat modifyGroupDetailInfoV2.
export interface Oidb0x89a_0SearchSettings {
// pb_optional (explicit presence): a value of 0 (mode enabled) MUST be sent,
// so these can't use plain pb<> — proto3 would drop the zero and the request
// would silently no-op. undefined is still elided (field left unchanged).
noFingerOpen?: pb_optional<35, uint_32>;
noCodeFingerOpen?: pb_optional<36, uint_32>;
}
export interface Oidb0x89a_0Search {
groupUin?: pb<1, uint_64>;
settings?: pb<2, bytes>;
settings?: pb<2, Oidb0x89a_0SearchSettings>;
field12?: pb<12, uint_32>;
}
export interface OidbKickMember {