refactor(onebot): inline ctx.bridge.apis.groupAdmin direct calls

Remove the 6 pure pass-through fields from `ApiActionContext` for the
group-admin area (`setGroupKick / setGroupKickMembers / setGroupBan /
setGroupWholeBan / setGroupLeave / setGroupRemark`). All 5 call sites
in `actions/group-admin.ts` now invoke `ctx.bridge.apis.groupAdmin.<m>`
directly. `setGroupRemark` had zero remaining callers (extended.ts
was already on the direct path) so the field is simply deleted.

Part 1 of RoadMap #6 OneBot-side slim-down. Core side's typed Api
hub (bridge.apis.X) has been in place since the #6 commit series;
OneBot actions were still routing through a 90+ field bag-of-
functions on `ApiActionContext`. Most of those fields were 1:1
shims like `setGroupKick: (g,u,r) => bridge.apis.groupAdmin.kickMember(g,u,r)` —
pure indirection with no composition logic. This commit kills the
group-admin chunk; the friend / interaction / profile / web / album /
groupFile / message chunks land in follow-up commits.

Behavior preserved byte-for-byte: same parameter parsing
(`asNumber/asString/asBoolean`), same default values, same 1800s
mute fallback, same error responses. 552/552 tests still green.
This commit is contained in:
DrSmoothl committed 2026-05-21 09:16:15 +08:00
1 parent a011b8f033
commit cb698d2435
3 files changed
+11 -19

No files matched your search

+4 -7
View File
@@ -61,12 +61,10 @@ export interface ApiActionContext {
getGroupMemberList: (groupId: number, noCache?: boolean) => Promise<JsonObject[]>;
getGroupMemberInfo: (groupId: number, userId: number, noCache?: boolean) => Promise<JsonObject | null>;
getStrangerInfo: (userId: number) => Promise<JsonObject | null>;
// Group admin (adapters: rename Bridge methods to OneBot vocabulary)
setGroupKick: (groupId: number, userId: number, rejectAdd: boolean) => Promise<void>;
setGroupKickMembers: (groupId: number, userIds: number[], rejectAdd: boolean) => Promise<void>;
setGroupBan: (groupId: number, userId: number, duration: number) => Promise<void>;
setGroupWholeBan: (groupId: number, enable: boolean) => Promise<void>;
setGroupLeave: (groupId: number) => Promise<void>;
// Group admin (mute/kick/admin/card/name/title/leave/etc) — all
// accessed directly through `ctx.bridge.apis.groupAdmin.method()`
// after the #6 OneBot-side slim-down; no per-method passthrough
// here anymore.
// Group file (adapters: field extraction + Bridge name translation)
uploadGroupFile: (groupId: number, file: string, name?: string, folderId?: string, uploadFile?: boolean) => Promise<string | null>;
uploadPrivateFile: (userId: number, file: string, name?: string, uploadFile?: boolean) => Promise<string | null>;
@@ -101,7 +99,6 @@ export interface ApiActionContext {
forwardSingleMsg: (messageId: number, target: { groupId?: number; userId?: number }) => Promise<{ messageId: number }>;
// Extended NapCat-compatible
setFriendRemark: (userId: number, remark: string) => Promise<void>;
setGroupRemark: (groupId: number, remark: string) => Promise<void>;
setGroupAvatar: (groupId: number, source: string) => Promise<void>;
setMsgEmojiLike: (messageId: number, emojiId: string, set: boolean) => Promise<void>;
markGroupMsgAsRead: (groupId: number, sequence: number) => Promise<void>;