refactor(api): move 14 group-admin methods to GroupAdminApi (#6 commit 3/13)
Third of 13 commits. Folds the previous `actions/group-admin.ts`
plus the matching Bridge facade methods into a typed `apis.groupAdmin`
hub.
Methods (14, all renamed to drop the redundant `Group` prefix once
the `apis.groupAdmin` namespace makes it implicit):
muteGroupMember → apis.groupAdmin.muteMember
muteGroupAll → apis.groupAdmin.muteAll
setGroupAddOption → apis.groupAdmin.setAddOption
setGroupSearch → apis.groupAdmin.setSearch
setGroupAddRequest → apis.groupAdmin.setAddRequest
kickGroupMember → apis.groupAdmin.kickMember
kickGroupMembers → apis.groupAdmin.kickMembers
leaveGroup → apis.groupAdmin.leave
setGroupAdmin → apis.groupAdmin.setAdmin
setGroupCard → apis.groupAdmin.setCard
setGroupName → apis.groupAdmin.setName
setGroupSpecialTitle→ apis.groupAdmin.setSpecialTitle
setGroupRemark → apis.groupAdmin.setRemark
getGroupAtAllRemain → apis.groupAdmin.getAtAllRemain
actions/group-admin.ts deleted. The corresponding `*_` alias imports
and `async xxx() { return xxx_(this, …); }` delegate methods on
Bridge are gone.
Caller updates
--------------
* onebot/instance-context.ts — 6 sites (the multi-method binding for
the OneBot action layer).
* onebot/actions/extended.ts — 8 sites including `getAtAllRemain`.
* onebot/actions/group-admin.ts — all 6 onebot action handlers.
* onebot/modules/request-actions.ts — `setGroupAddRequest`.
Test updates
------------
* tests/actions/group-admin.test.ts — was importing the deleted
`* as admin` module and calling `admin.muteGroupMember(bridge, ...)`.
Switched to `new GroupAdminApi(bridge as any).muteMember(...)` —
same wire validation, just constructs the real Api class once per
call (the Api is stateless so it's effectively free).
* tests/onebot/request-actions.test.ts — was stubbing
`setGroupAddRequest` flat on bridge. Updated to
`apis: { groupAdmin: { setAddRequest } } as any`.
Tests: 587/587 pass (network-manager native-addon failure unchanged).
This commit is contained in:
1 parent
6bf53890dc
commit
0b91e4db8d
11 files changed
+228
-253
No files matched your search
@@ -44,20 +44,7 @@ export interface BridgeInterface {
|
||||
|
||||
// ─── Fetch (contacts / profile / system) — moved to apis.contacts ───
|
||||
|
||||
// ─── Group admin ───
|
||||
muteGroupMember(groupId: number, userId: number, duration: number): Promise<void>;
|
||||
muteGroupAll(groupId: number, enable: boolean): Promise<void>;
|
||||
setGroupAddOption(groupId: number, addType: number): Promise<void>;
|
||||
setGroupSearch(groupId: number): Promise<void>;
|
||||
setGroupAddRequest(groupId: number, sequence: number, eventType: number, approve: boolean, reason?: string, filtered?: boolean): Promise<void>;
|
||||
kickGroupMember(groupId: number, userId: number, reject: boolean, reason?: string): Promise<void>;
|
||||
kickGroupMembers(groupId: number, userIds: number[], reject: boolean): Promise<void>;
|
||||
leaveGroup(groupId: number): Promise<void>;
|
||||
setGroupAdmin(groupId: number, userId: number, enable: boolean): Promise<void>;
|
||||
setGroupCard(groupId: number, userId: number, card: string): Promise<void>;
|
||||
setGroupName(groupId: number, name: string): Promise<void>;
|
||||
setGroupSpecialTitle(groupId: number, userId: number, title: string): Promise<void>;
|
||||
setGroupRemark(groupId: number, remark: string): Promise<void>;
|
||||
// ─── Group admin (moved to apis.groupAdmin) ───
|
||||
setGroupReaction(groupId: number, sequence: number, code: string, isSet: boolean): Promise<void>;
|
||||
setGroupEssence(groupId: number, sequence: number, random: number, enable: boolean): Promise<void>;
|
||||
|
||||
@@ -135,7 +122,6 @@ export interface BridgeInterface {
|
||||
fetchCustomFace(count?: number): Promise<string[]>;
|
||||
getProfileLike(userId?: number, start?: number, limit?: number): Promise<any>;
|
||||
getUnidirectionalFriendList(): Promise<any>;
|
||||
getGroupAtAllRemain(groupId: number): Promise<any>;
|
||||
|
||||
// ─── Misc ───
|
||||
translateEn2Zh(words: string[]): Promise<any>;
|
||||
|
||||
Reference in new issue
Block a user