Refactor FileApi usage to obContext in OneBot

Replaced references to `core.apis.FileApi` with `obContext.apis.FileApi` across actions and message API to ensure consistent context usage. Added FileApi to the ApiListType and initialized it in NapCatOneBot11Adapter. This improves maintainability and context handling for file-related operations.
This commit is contained in:
手瓜一十雪 committed 2025-11-15 11:20:01 +08:00
1 parent 8df54d5cd3
commit 4dc8b3ed3b
4 files changed
+9 -6

No files matched your search

+3
View File
@@ -54,6 +54,7 @@ import { IOB11NetworkAdapter } from '@/napcat-onebot/network/adapter';
import { OB11HttpSSEServerAdapter } from './network/http-server-sse';
import { OB11PluginMangerAdapter } from './network/plugin-manger';
import { existsSync } from 'node:fs';
import { OneBotFileApi } from './api/file';
interface ApiListType {
GroupApi: OneBotGroupApi;
@@ -61,6 +62,7 @@ interface ApiListType {
FriendApi: OneBotFriendApi;
MsgApi: OneBotMsgApi;
QuickActionApi: OneBotQuickActionApi;
FileApi: OneBotFileApi;
}
// OneBot实现类
export class NapCatOneBot11Adapter {
@@ -83,6 +85,7 @@ export class NapCatOneBot11Adapter {
FriendApi: new OneBotFriendApi(this, core),
MsgApi: new OneBotMsgApi(this, core),
QuickActionApi: new OneBotQuickActionApi(this, core),
FileApi: new OneBotFileApi(this, core),
} as const;
this.actions = createActionMap(this, core);
this.networkManager = new OB11NetworkManager();