onebots 0.4.68 → 0.4.70

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -67,7 +67,7 @@ export declare class App extends Koa {
67
67
  reload(config: App.Config): Promise<void>;
68
68
  stop(): Promise<void>;
69
69
  }
70
- export declare function createOnebots(config: App.Config | string, cp: ChildProcess | null): App;
70
+ export declare function createOnebots(config?: App.Config | string, cp?: ChildProcess | null): App;
71
71
  export declare function defineConfig(config: App.Config): App.Config;
72
72
  export declare namespace App {
73
73
  const ADAPTERS: Map<string, AdapterClass>;
package/lib/server/app.js CHANGED
@@ -307,24 +307,31 @@ class App extends koa_1.default {
307
307
  }
308
308
  exports.App = App;
309
309
  App.configDir = path.join(os.homedir(), ".onebots");
310
- function createOnebots(config = "config.yaml", cp) {
311
- if (typeof config === "string") {
310
+ function createOnebots(config = "config.yaml", cp = null) {
311
+ const isStartWithConfigFile = typeof config === "string";
312
+ if (isStartWithConfigFile) {
312
313
  config = path.resolve(process_1.default.cwd(), config);
313
314
  App.configDir = path.dirname(config);
314
315
  if (!(0, fs_1.existsSync)(App.configDir)) {
315
316
  (0, fs_1.mkdirSync)(App.configDir);
316
317
  }
317
- if (!(0, fs_1.existsSync)(App.dataDir)) {
318
- (0, fs_1.mkdirSync)(App.dataDir);
319
- console.log("已为你创建数据存储目录", App.dataDir);
320
- }
321
- if (!(0, fs_1.existsSync)(App.configPath)) {
322
- (0, fs_1.copyFileSync)(path.resolve(__dirname, "../config.sample.yaml"), App.configPath);
318
+ config = js_yaml_1.default.load((0, fs_2.readFileSync)(App.configPath, "utf8"));
319
+ }
320
+ if (!(0, fs_1.existsSync)(App.configPath)) {
321
+ (0, fs_1.copyFileSync)(path.resolve(__dirname, "../config.sample.yaml"), App.configPath);
322
+ if (isStartWithConfigFile) {
323
323
  console.log("未找到对应配置文件,已自动生成默认配置文件,请修改配置文件后重新启动");
324
324
  console.log(`配置文件在: ${App.configPath}`);
325
325
  process_1.default.exit();
326
326
  }
327
- config = js_yaml_1.default.load((0, fs_2.readFileSync)(App.configPath, "utf8"));
327
+ else {
328
+ console.log("未找到对应配置文件,已自动生成默认配置文件");
329
+ console.log(`配置文件在: ${App.configPath}`);
330
+ }
331
+ }
332
+ if (!(0, fs_1.existsSync)(App.dataDir)) {
333
+ (0, fs_1.mkdirSync)(App.dataDir);
334
+ console.log("已为你创建数据存储目录", App.dataDir);
328
335
  }
329
336
  (0, log4js_1.configure)({
330
337
  appenders: {
@@ -334,6 +341,7 @@ function createOnebots(config = "config.yaml", cp) {
334
341
  },
335
342
  files: {
336
343
  type: "file",
344
+ maxLogSize: 1024 * 1024 * 50,
337
345
  filename: path.join(process_1.default.cwd(), "onebots.log"),
338
346
  },
339
347
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "onebots",
3
- "version": "0.4.68",
3
+ "version": "0.4.70",
4
4
  "description": "基于icqq的多例oneBot实现",
5
5
  "main": "lib/index.js",
6
6
  "bin": {