@kotori-bot/loader 1.7.4 → 1.8.0

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.
@@ -1,14 +1,12 @@
1
-
2
1
  /**
3
- * @Package @kotori-bot/loader
4
- * @Version 1.7.4
5
- * @Author Arimura Sena <me@hotaru.icu>
6
- * @Copyright 2024 Hotaru. All rights reserved.
7
- * @License GPL-3.0
8
- * @Link https://github.com/kotorijs/kotori
9
- * @Date 2024/8/11 16:59:54
10
- */
11
-
2
+ * @Package @kotori-bot/loader
3
+ * @Version 1.8.0
4
+ * @Author Arimura Sena <me@hotaru.icu>
5
+ * @Copyright 2024-2025 Hotaru. All rights reserved.
6
+ * @License BAN-ZHINESE-USING
7
+ * @Link https://github.com/kotorijs/kotori
8
+ * @Date 17:26:15
9
+ */
12
10
  "use strict";
13
11
  var __defProp = Object.defineProperty;
14
12
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -36,15 +34,67 @@ var import_core = require("@kotori-bot/core");
36
34
  var import_level = require("level");
37
35
  var import_node_path = require("node:path");
38
36
  class Database extends import_core.Service {
37
+ // private readonly filename = resolve(this.ctx.baseDir.root, 'datab.db')
38
+ usingDir = (0, import_node_path.resolve)(this.ctx.baseDir.data, "db");
39
+ // private updated = false
40
+ // private timer?: NodeJS.Timer
39
41
  level;
42
+ // private async zip() {
43
+ // const output = createWriteStream(this.filename)
44
+ // const gzip = createGunzip()
45
+ // const tar = spawn('tar', ['-czf', '-', this.usingDir])
46
+ // return new Promise<void>((resolve, reject) => {
47
+ // const timer = setTimeout(() => {
48
+ // reject('Timeout during zip process')
49
+ // }, this.config.duration)
50
+ // tar.stdout.pipe(gzip).pipe(output)
51
+ // tar.on('close', (code) => {
52
+ // if (code) {
53
+ // reject(`Tar process exited with code ${code}`)
54
+ // } else {
55
+ // clearTimeout(timer)
56
+ // resolve()
57
+ // }
58
+ // })
59
+ // tar.on('error', (err) => {
60
+ // reject(err)
61
+ // })
62
+ // })
63
+ // }
64
+ // private async unzip() {
65
+ // if (!existsSync(this.filename)) {
66
+ // rmSync(this.usingDir, { recursive: true })
67
+ // return
68
+ // }
69
+ // const input = createReadStream(this.filename)
70
+ // const gunzip = createGunzip()
71
+ // const tar = spawn('tar', ['-xzf', '-', '-C', this.usingDir])
72
+ // return new Promise<void>((resolve, reject) => {
73
+ // const timer = setTimeout(() => {
74
+ // reject('Timeout during unzip process')
75
+ // }, this.config.duration * 10)
76
+ // input.pipe(gunzip).pipe(tar.stdin)
77
+ // tar.on('close', (code) => {
78
+ // if (code) {
79
+ // console.error(`Tar process exited with code ${code}`)
80
+ // } else {
81
+ // clearTimeout(timer)
82
+ // resolve()
83
+ // }
84
+ // })
85
+ // tar.on('error', (err) => {
86
+ // console.error(err)
87
+ // })
88
+ // })
89
+ // }
40
90
  prefixKey(key) {
41
91
  return `${this.ctx.identity?.toString() ?? ""}:${key}`;
42
92
  }
43
93
  constructor(ctx, config) {
44
94
  super(ctx, config, "database");
45
- this.level = new import_level.Level((0, import_node_path.resolve)(this.ctx.baseDir.data, "db"), { prefix: this.config.prefix });
95
+ this.level = new import_level.Level((0, import_node_path.resolve)(this.usingDir), { prefix: config.prefix });
46
96
  }
47
- start() {
97
+ async start() {
48
98
  this.level.open().then(() => this.ctx.logger.record(`Database opened with prefix: ${this.config.prefix}`));
49
99
  }
50
100
  stop() {
@@ -79,7 +129,7 @@ class Database extends import_core.Service {
79
129
  key: this.prefixKey(op.key),
80
130
  value: "value" in op ? JSON.stringify(op.value) : ""
81
131
  }));
82
- return this.level.batch(prefixedOps);
132
+ await this.level.batch(prefixedOps);
83
133
  }
84
134
  }
85
135
  var database_default = Database;
@@ -1,14 +1,12 @@
1
-
2
1
  /**
3
- * @Package @kotori-bot/loader
4
- * @Version 1.7.4
5
- * @Author Arimura Sena <me@hotaru.icu>
6
- * @Copyright 2024 Hotaru. All rights reserved.
7
- * @License GPL-3.0
8
- * @Link https://github.com/kotorijs/kotori
9
- * @Date 2024/8/11 16:59:54
10
- */
11
-
2
+ * @Package @kotori-bot/loader
3
+ * @Version 1.8.0
4
+ * @Author Arimura Sena <me@hotaru.icu>
5
+ * @Copyright 2024-2025 Hotaru. All rights reserved.
6
+ * @License BAN-ZHINESE-USING
7
+ * @Link https://github.com/kotorijs/kotori
8
+ * @Date 17:26:15
9
+ */
12
10
  "use strict";
13
11
  var __defProp = Object.defineProperty;
14
12
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1,14 +1,12 @@
1
-
2
1
  /**
3
- * @Package @kotori-bot/loader
4
- * @Version 1.7.4
5
- * @Author Arimura Sena <me@hotaru.icu>
6
- * @Copyright 2024 Hotaru. All rights reserved.
7
- * @License GPL-3.0
8
- * @Link https://github.com/kotorijs/kotori
9
- * @Date 2024/8/11 16:59:54
10
- */
11
-
2
+ * @Package @kotori-bot/loader
3
+ * @Version 1.8.0
4
+ * @Author Arimura Sena <me@hotaru.icu>
5
+ * @Copyright 2024-2025 Hotaru. All rights reserved.
6
+ * @License BAN-ZHINESE-USING
7
+ * @Link https://github.com/kotorijs/kotori
8
+ * @Date 17:26:15
9
+ */
12
10
  "use strict";
13
11
  var __create = Object.create;
14
12
  var __defProp = Object.defineProperty;
@@ -1,14 +1,12 @@
1
-
2
1
  /**
3
- * @Package @kotori-bot/loader
4
- * @Version 1.7.4
5
- * @Author Arimura Sena <me@hotaru.icu>
6
- * @Copyright 2024 Hotaru. All rights reserved.
7
- * @License GPL-3.0
8
- * @Link https://github.com/kotorijs/kotori
9
- * @Date 2024/8/11 16:59:54
10
- */
11
-
2
+ * @Package @kotori-bot/loader
3
+ * @Version 1.8.0
4
+ * @Author Arimura Sena <me@hotaru.icu>
5
+ * @Copyright 2024-2025 Hotaru. All rights reserved.
6
+ * @License BAN-ZHINESE-USING
7
+ * @Link https://github.com/kotorijs/kotori
8
+ * @Date 17:26:15
9
+ */
12
10
  "use strict";
13
11
  var __defProp = Object.defineProperty;
14
12
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1,14 +1,12 @@
1
-
2
1
  /**
3
- * @Package @kotori-bot/loader
4
- * @Version 1.7.4
5
- * @Author Arimura Sena <me@hotaru.icu>
6
- * @Copyright 2024 Hotaru. All rights reserved.
7
- * @License GPL-3.0
8
- * @Link https://github.com/kotorijs/kotori
9
- * @Date 2024/8/11 16:59:54
10
- */
11
-
2
+ * @Package @kotori-bot/loader
3
+ * @Version 1.8.0
4
+ * @Author Arimura Sena <me@hotaru.icu>
5
+ * @Copyright 2024-2025 Hotaru. All rights reserved.
6
+ * @License BAN-ZHINESE-USING
7
+ * @Link https://github.com/kotorijs/kotori
8
+ * @Date 17:26:15
9
+ */
12
10
  "use strict";
13
11
  var __defProp = Object.defineProperty;
14
12
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
package/lib/utils/log.js CHANGED
@@ -1,14 +1,12 @@
1
-
2
1
  /**
3
- * @Package @kotori-bot/loader
4
- * @Version 1.7.4
5
- * @Author Arimura Sena <me@hotaru.icu>
6
- * @Copyright 2024 Hotaru. All rights reserved.
7
- * @License GPL-3.0
8
- * @Link https://github.com/kotorijs/kotori
9
- * @Date 2024/8/11 16:59:54
10
- */
11
-
2
+ * @Package @kotori-bot/loader
3
+ * @Version 1.8.0
4
+ * @Author Arimura Sena <me@hotaru.icu>
5
+ * @Copyright 2024-2025 Hotaru. All rights reserved.
6
+ * @License BAN-ZHINESE-USING
7
+ * @Link https://github.com/kotorijs/kotori
8
+ * @Date 17:26:15
9
+ */
12
10
  "use strict";
13
11
  var __defProp = Object.defineProperty;
14
12
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -48,7 +46,7 @@ function loadInfo(info, ctx) {
48
46
  ctx.logger.info(
49
47
  `Kotori Bot Version: ${info.version} (Core: v${info.coreVersion}, Loader: v${info.loaderVersion}) License: ${info.license}`
50
48
  );
51
- ctx.logger.info("Copyright \xA9 2023 - 2024 Arimura Sena All rights reserved");
49
+ ctx.logger.info("Copyright \xA9 2023 - 2025 Arimura Sena All rights reserved");
52
50
  }
53
51
  var log_default = loadInfo;
54
52
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,14 +1,12 @@
1
-
2
1
  /**
3
- * @Package @kotori-bot/loader
4
- * @Version 1.7.4
5
- * @Author Arimura Sena <me@hotaru.icu>
6
- * @Copyright 2024 Hotaru. All rights reserved.
7
- * @License GPL-3.0
8
- * @Link https://github.com/kotorijs/kotori
9
- * @Date 2024/8/11 16:59:54
10
- */
11
-
2
+ * @Package @kotori-bot/loader
3
+ * @Version 1.8.0
4
+ * @Author Arimura Sena <me@hotaru.icu>
5
+ * @Copyright 2024-2025 Hotaru. All rights reserved.
6
+ * @License BAN-ZHINESE-USING
7
+ * @Link https://github.com/kotorijs/kotori
8
+ * @Date 17:26:15
9
+ */
12
10
  "use strict";
13
11
  var __defProp = Object.defineProperty;
14
12
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "loader.debug.info": "run info: <dim>develop with debugging...</dim>",
3
3
  "loader.debug.reload": "file changed, module <cyanBright>{0}</cyanBright> <dim>is reloading...</dim>",
4
+ "loader.tips.update.workspace": "<bold>the current is in <cyanBright>workspace development</cyanBright></bold>",
4
5
  "loader.tips.update.failed": "get update failed, please check your network",
5
6
  "loader.tips.update.latest": "kotori is currently the latest version",
6
7
  "loader.tips.update.available": "the current version of Kotori is {0}, and the latest version is {1}. please go to <blueBright>{2}</blueBright> to update",
@@ -15,6 +16,7 @@
15
16
  "loader.bots.stop.error": "stopped server at <blueBright>{0}</blueBright> unexpectedly",
16
17
  "loader.bots.dispose": "dispose completed about <greenBright>{0}</greenBright>",
17
18
  "loader.modules.load": "loaded module <cyanBright>{0}</cyanBright> version: {1}",
19
+ "loader.modules.loadRes": "loaded module <red>{0}</red> version: {1}",
18
20
  "loader.modules.all": "<greenBright>loaded {0} modules successfully</greenBright>",
19
21
  "loader.modules.all.failed": "loaded {0} modules successfully, <red>failed to load</red> <redBright>{1}</redBright> modules",
20
22
  "loader.adapters.notfound": "cannot find adapter <cyanBright>{0}</cyanBright> for bot <magenta>{1}</magenta>",
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@kotori-bot/loader",
3
- "version": "1.7.4",
3
+ "version": "1.8.0",
4
4
  "description": "Loader For KotoriBot",
5
- "license": "GPL-3.0",
5
+ "license": "BAN-ZHINESE-USING",
6
6
  "main": "lib/index.js",
7
7
  "author": "Arimura Sena <me@hotaru.icu>",
8
8
  "keywords": [
@@ -29,8 +29,8 @@
29
29
  "level": "^8.0.1",
30
30
  "path-to-regexp": "^6.2.2",
31
31
  "ws": "^8.14.2",
32
- "@kotori-bot/core": "^1.6.1",
33
- "@kotori-bot/logger": "^1.3.2"
32
+ "@kotori-bot/core": "^1.7.0",
33
+ "@kotori-bot/logger": "^1.3.3"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/express": "^4.17.21",