旧实现走 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 全绿。
132 lines
4.0 KiB
TypeScript
132 lines
4.0 KiB
TypeScript
import { defineAction, groupAction, groupUserAction, f } from '../action-kit';
|
|
import { okResponse } from '../types';
|
|
|
|
export const actions = [
|
|
groupUserAction({
|
|
name: 'set_group_kick',
|
|
summary: '踢出群成员',
|
|
params: { reject_add_request: f.bool().default(false) },
|
|
run: async (p, ctx) => {
|
|
await ctx.bridge.apis.groupAdmin.kickMember(p.group_id, p.user_id, p.reject_add_request);
|
|
return okResponse();
|
|
},
|
|
}),
|
|
|
|
groupAction({
|
|
name: 'set_group_kick_members',
|
|
summary: '批量踢出群成员',
|
|
params: { user_id: f.array(f.memberId()).nonEmpty(), reject_add_request: f.bool().default(false) },
|
|
run: async (p, ctx) => {
|
|
await ctx.bridge.apis.groupAdmin.kickMembers(p.group_id, p.user_id, p.reject_add_request);
|
|
return okResponse();
|
|
},
|
|
}),
|
|
|
|
groupUserAction({
|
|
name: 'set_group_ban',
|
|
summary: '禁言群成员(duration=0 解除)',
|
|
params: { duration: f.duration().default(1800) },
|
|
run: async (p, ctx) => {
|
|
await ctx.bridge.apis.groupAdmin.muteMember(p.group_id, p.user_id, p.duration);
|
|
return okResponse();
|
|
},
|
|
}),
|
|
|
|
groupAction({
|
|
name: 'set_group_whole_ban',
|
|
summary: '全员禁言开关',
|
|
params: { enable: f.bool().default(true) },
|
|
run: async (p, ctx) => {
|
|
await ctx.bridge.apis.groupAdmin.muteAll(p.group_id, p.enable);
|
|
return okResponse();
|
|
},
|
|
}),
|
|
|
|
groupAction({
|
|
name: 'set_group_add_option',
|
|
summary: '设置加群选项',
|
|
params: { add_type: f.int({ min: 0 }).default(0) },
|
|
run: async (p, ctx) => {
|
|
await ctx.bridge.apis.groupAdmin.setAddOption(p.group_id, p.add_type);
|
|
return okResponse();
|
|
},
|
|
}),
|
|
|
|
groupAction({
|
|
name: 'set_group_search',
|
|
summary: '设置群被搜索方式(群指纹 / 群号搜索开关)',
|
|
params: {
|
|
no_finger_open: f.int({ min: 0 }).optional(),
|
|
no_code_finger_open: f.int({ min: 0 }).optional(),
|
|
},
|
|
run: async (p, ctx) => {
|
|
await ctx.bridge.apis.groupAdmin.setSearch(p.group_id, p.no_finger_open, p.no_code_finger_open);
|
|
return okResponse();
|
|
},
|
|
}),
|
|
|
|
groupUserAction({
|
|
name: 'set_group_admin',
|
|
summary: '设置/取消管理员',
|
|
params: { enable: f.bool().default(true) },
|
|
run: async (p, ctx) => {
|
|
await ctx.bridge.apis.groupAdmin.setAdmin(p.group_id, p.user_id, p.enable);
|
|
return okResponse();
|
|
},
|
|
}),
|
|
|
|
groupUserAction({
|
|
name: 'set_group_card',
|
|
summary: '设置群名片(空字符串清除)',
|
|
params: { card: f.string().default('') },
|
|
run: async (p, ctx) => {
|
|
await ctx.bridge.apis.groupAdmin.setCard(p.group_id, p.user_id, p.card);
|
|
return okResponse();
|
|
},
|
|
}),
|
|
|
|
groupAction({
|
|
name: 'set_group_name',
|
|
summary: '设置群名',
|
|
params: { group_name: f.string().default('') },
|
|
run: async (p, ctx) => {
|
|
await ctx.bridge.apis.groupAdmin.setName(p.group_id, p.group_name);
|
|
return okResponse();
|
|
},
|
|
}),
|
|
|
|
groupAction({
|
|
name: 'set_group_leave',
|
|
summary: '退群',
|
|
run: async (p, ctx) => {
|
|
await ctx.bridge.apis.groupAdmin.leave(p.group_id);
|
|
return okResponse();
|
|
},
|
|
}),
|
|
|
|
groupUserAction({
|
|
name: 'set_group_special_title',
|
|
summary: '设置群头衔',
|
|
params: { special_title: f.string().default('') },
|
|
run: async (p, ctx) => {
|
|
await ctx.bridge.apis.groupAdmin.setSpecialTitle(p.group_id, p.user_id, p.special_title);
|
|
return okResponse();
|
|
},
|
|
}),
|
|
|
|
// No-op stubs (accept and ignore any params, as before).
|
|
defineAction({ name: 'set_group_anonymous', summary: '匿名开关(未实现,返回 ok)', params: {}, run: () => okResponse() }),
|
|
defineAction({ name: 'set_group_anonymous_ban', summary: '匿名禁言(未实现,返回 ok)', params: {}, run: () => okResponse() }),
|
|
|
|
groupAction({
|
|
name: 'set_group_portrait',
|
|
summary: '设置群头像',
|
|
params: { file: f.image() },
|
|
run: async (p, ctx) => {
|
|
await ctx.bridge.apis.profile.setGroupAvatar(p.group_id, p.file);
|
|
return okResponse();
|
|
},
|
|
}),
|
|
];
|
|
|