refactor(oidb): migrate group-admin.ts OIDB cmds to namespaces
Splits the 14 OIDB cmds from GroupAdminApi into self-contained
namespaces under @snowluma/bridge/oidb-services/group-admin/. The
facade becomes one-line forwarders; per-cmd capability is narrowed
to OidbSender (+ resolveUserUid / identity where the cmd actually
needs it).
Notes:
- 0x89A_0 hosts MuteAll, SetAddOption, SetSearch, SetGroupName —
same (cmd, subcmd) tuple, four different proto bodies; each gets
its own namespace so proton can monomorphize independently.
- 0x8A0_1 splits KickMember (single) and KickMembers (batch) for
the same reason.
- SetAddRequest carries uinForm=true and dynamic subCommand
(filtered ? 2 : 1) on the same namespace.
- GetAtAllRemain needs the bot's own uin → declares
Pick<BridgeContext, 'identity'> in its Deps.
Wire-byte equivalence preserved; corner case for getAtAllRemain
empty-envelope path now returns {false, 0, 0} instead of throwing —
the new infrastructure normalises empty bodies and the OneBot action
ergonomics are unchanged.
This commit is contained in:
31 files changed
+1248
-202
No files matched your search
@@ -0,0 +1,29 @@
|
||||
// 0xF16_1 — set the bot's local-only label/remark for a group (only
|
||||
// the bot sees this — the group's actual name is untouched).
|
||||
|
||||
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
||||
import type { OidbBase, OidbEmpty } from '@snowluma/proto-defs/oidb';
|
||||
import type { Oidb0xf16Req } from '@snowluma/proto-defs/oidb-actions/base';
|
||||
import { invokeOidb, type OidbSender } from '../../oidb-service';
|
||||
|
||||
export namespace SetGroupRemark {
|
||||
export const command = 0xF16;
|
||||
export const subCommand = 1;
|
||||
|
||||
export interface Params { groupId: number; remark: string; }
|
||||
export type Deps = OidbSender;
|
||||
|
||||
export const serialize = (p: Params): Oidb0xf16Req => ({
|
||||
inner: { groupId: BigInt(p.groupId), remark: p.remark },
|
||||
field12: 0,
|
||||
});
|
||||
|
||||
export const deserialize = (_: OidbEmpty): void => {};
|
||||
export const encode = (env: OidbBase<Oidb0xf16Req>): Uint8Array =>
|
||||
protobuf_encode<OidbBase<Oidb0xf16Req>>(env);
|
||||
export const decode = (bytes: Uint8Array): OidbBase<OidbEmpty> =>
|
||||
protobuf_decode<OidbBase<OidbEmpty>>(bytes);
|
||||
|
||||
export const invoke = (deps: Deps, params: Params): Promise<void> =>
|
||||
invokeOidb(deps, SetGroupRemark, params);
|
||||
}
|
||||
Reference in new issue
Block a user