diff --git a/README.md b/README.md index 2c6c8fe..050e511 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ LiteLoaderQQNT的OneBot11协议插件 - [x] http调用api - [x] http事件上报 - [x] 正向websocket -- [ ] 反向websocket +- [x] 反向websocket 主要功能: - [x] 发送好友消息 @@ -108,7 +108,7 @@ LiteLoaderQQNT的OneBot11协议插件 ## TODO - [x] 重构摆脱LLAPI,目前调用LLAPI只能在renderer进程调用,需重构成在main进程调用 -- [x] 支持正向websocket +- [x] 支持正、反向websocket(感谢@disymayufei的PR) - [ ] 转发消息记录 - [ ] 好友点赞api diff --git a/src/common/config.ts b/src/common/config.ts index 40b3531..e56af19 100644 --- a/src/common/config.ts +++ b/src/common/config.ts @@ -10,12 +10,13 @@ export class ConfigUtil { constructor(configPath: string) { this.configPath = configPath; } - getConfig(){ + + getConfig(): Config { if (this.config) { return this.config; } - this.config = this.reloadConfig(); + this.reloadConfig(); return this.config; } reloadConfig(): Config { @@ -37,9 +38,11 @@ export class ConfigUtil { debug: false, log: false, reportSelfMessage: false - } + }; + if (!fs.existsSync(this.configPath)) { - return defaultConfig + this.config = defaultConfig; + return; } else { const data = fs.readFileSync(this.configPath, "utf-8"); let jsonData: Config = defaultConfig;