mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
chore: config
This commit is contained in:
parent
ecee642e10
commit
32d4febf10
@ -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');
|
||||
|
16
src/core/helper/config.ts
Normal file
16
src/core/helper/config.ts
Normal file
@ -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<NapCatConfig> {
|
||||
getConfigName() {
|
||||
return 'onebot11';
|
||||
}
|
||||
|
||||
}
|
@ -37,5 +37,4 @@ export class OB11Config extends ConfigBase<OB11Config> {
|
||||
getConfigName() {
|
||||
return 'onebot11';
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user