refactor(onebot): inline ctx.bridge.apis.groupFile direct calls
Remove 6 passthrough fields from ApiActionContext for the group-file area (`uploadGroupFile / uploadPrivateFile / getGroupFileUrl / createGroupFileFolder / getPrivateFileUrl / getGroupFileCount`). Action sites (`actions/group-file.ts` and one site in `actions/extended.ts`) now call `ctx.bridge.apis.groupFile.<method>` directly. `getGroupFiles` stays on the ctx because its module helper (`getGroupFiles(bridge, groupId, folderId)` in `modules/contact-actions.ts`) does identity-lookup enrichment of uploader/creator names — not a pure passthrough. Behavior preserved: same default values (`name = ''`, `folderId = '/'`, `busId = 102`, `uploadFile = true`) — they were baked into the ctx wrapper before, now they're explicit in the action site (`asString` returns `''`, `... || '/'`, `... || 102`, `asBoolean(..., true)`). The result-unwrap (`fileId` extraction from `UploadFileResult`) moves from the ctx wrapper into the action handler. Part 2 of the OneBot-side slim-down. 552/552 tests still green.
This commit is contained in:
4 files changed
+18
-38
No files matched your search
@@ -65,14 +65,12 @@ export interface ApiActionContext {
|
||||
// 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>;
|
||||
getGroupFileUrl: (groupId: number, fileId: string, busId?: number) => Promise<string>;
|
||||
// Group file passthroughs are gone — actions call
|
||||
// `ctx.bridge.apis.groupFile.{upload,uploadPrivate,getUrl,
|
||||
// createFolder,getPrivateUrl,getCount}` directly. `getGroupFiles`
|
||||
// stays because it composes through the `getGroupFiles` module
|
||||
// helper (identity-lookup enrichment of uploader names).
|
||||
getGroupFiles: (groupId: number, folderId?: string) => Promise<JsonObject>;
|
||||
createGroupFileFolder: (groupId: number, name: string, parentId?: string) => Promise<void>;
|
||||
getPrivateFileUrl: (userId: number, fileId: string, fileHash: string) => Promise<string>;
|
||||
getGroupFileCount: (groupId: number) => Promise<{ fileCount: number; maxCount: number }>;
|
||||
// Requests (adapters: rename to OneBot vocabulary)
|
||||
handleFriendRequest: (flag: string, approve: boolean) => Promise<void>;
|
||||
handleGroupRequest: (flag: string, subType: string, approve: boolean, reason: string) => Promise<void>;
|
||||
|
||||
Reference in new issue
Block a user