diff --git a/src/core/core.ts b/src/core/core.ts index 30c17f96..cb5718a7 100644 --- a/src/core/core.ts +++ b/src/core/core.ts @@ -9,6 +9,8 @@ import { LegacyNTEventWrapper } from '@/common/framework/event-legacy'; import { NTQQFileApi, NTQQFriendApi, NTQQGroupApi, NTQQMsgApi, NTQQSystemApi, NTQQUserApi, NTQQWebApi } from './apis'; import os from 'node:os'; import { NTQQCollectionApi } from './apis/collection'; +import { OB11Config } from '@/onebot/helper/config'; +import { NapCatConfig } from './helper/config'; export enum NapCatCoreWorkingEnv { Unknown = 0, @@ -36,6 +38,7 @@ export class NapCatCore { // runtime info, not readonly selfInfo: SelfInfo; util: NodeQQNTWrapperUtil; + config: any; // 通过构造器递过去的 runtime info 应该尽量少 constructor(context: InstanceContext, selfInfo: SelfInfo) { @@ -53,6 +56,7 @@ export class NapCatCore { UserApi: new NTQQUserApi(this.context, this), GroupApi: new NTQQGroupApi(this.context, this), }; + this.config = new NapCatConfig(this,this.context.pathWrapper.cachePath); this.NapCatDataPath = path.join(this.dataPath, 'NapCat'); fs.mkdirSync(this.NapCatDataPath, { recursive: true }); this.NapCatTempPath = path.join(this.NapCatDataPath, 'temp'); diff --git a/src/core/helper/config.ts b/src/core/helper/config.ts new file mode 100644 index 00000000..19cc4f03 --- /dev/null +++ b/src/core/helper/config.ts @@ -0,0 +1,16 @@ +import { ConfigBase } from "@/common/utils/ConfigBase"; +import { LogLevel } from "@/common/utils/log"; + +export interface NapCatConfig { + fileLog: boolean, + consoleLog: boolean, + fileLogLevel: LogLevel, + consoleLogLevel: LogLevel, +} + +export class NapCatConfig extends ConfigBase { + getConfigName() { + return 'onebot11'; + } + +} \ No newline at end of file diff --git a/src/onebot/helper/config.ts b/src/onebot/helper/config.ts index 9bc5754f..f02c8339 100644 --- a/src/onebot/helper/config.ts +++ b/src/onebot/helper/config.ts @@ -37,5 +37,4 @@ export class OB11Config extends ConfigBase { getConfigName() { return 'onebot11'; } - }