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:
3 files changed
+11
-19
No files matched your search
@@ -111,12 +111,8 @@ export function buildApiContext(ref: OneBotInstanceContext): ApiActionContext {
|
||||
getGroupMemberInfo: (groupId, userId, noCache) => getGroupMemberInfo(bridge, groupId, userId, noCache),
|
||||
getStrangerInfo: (userId) => getStrangerInfo(bridge, userId),
|
||||
|
||||
// Group admin — names translate to OneBot vocabulary.
|
||||
setGroupKick: (groupId, userId, reject) => bridge.apis.groupAdmin.kickMember(groupId, userId, reject),
|
||||
setGroupKickMembers: (groupId, userIds, reject) => bridge.apis.groupAdmin.kickMembers(groupId, userIds, reject),
|
||||
setGroupBan: (groupId, userId, duration) => bridge.apis.groupAdmin.muteMember(groupId, userId, duration),
|
||||
setGroupWholeBan: (groupId, enable) => bridge.apis.groupAdmin.muteAll(groupId, enable),
|
||||
setGroupLeave: (groupId) => bridge.apis.groupAdmin.leave(groupId),
|
||||
// Group admin — actions now call `ctx.bridge.apis.groupAdmin.X(...)`
|
||||
// directly; no per-method passthrough here anymore.
|
||||
|
||||
// Group file — fileId field extraction + defaults.
|
||||
uploadGroupFile: async (groupId, file, name, folderId, uploadFile) => {
|
||||
@@ -164,7 +160,6 @@ export function buildApiContext(ref: OneBotInstanceContext): ApiActionContext {
|
||||
handleDeleteFriend: (userId, block) => bridge.apis.friend.delete(userId, !!block),
|
||||
forceFetchClientKey: () => bridge.apis.web.forceFetchClientKey(),
|
||||
setFriendRemark: (userId, remark) => bridge.apis.friend.setRemark(userId, remark),
|
||||
setGroupRemark: (groupId, remark) => bridge.apis.groupAdmin.setRemark(groupId, remark),
|
||||
setGroupAvatar: (groupId, source) => bridge.apis.profile.setGroupAvatar(groupId, source),
|
||||
getGroupFileCount: (groupId) => bridge.apis.groupFile.getCount(groupId),
|
||||
|
||||
|
||||
Reference in new issue
Block a user