@kotori-bot/loader 1.7.5 → 1.8.1

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.
package/lib/index.js CHANGED
@@ -1,14 +1,12 @@
1
-
2
1
  /**
3
- * @Package @kotori-bot/loader
4
- * @Version 1.7.5
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 17:13:02
10
- */
11
-
2
+ * @Package @kotori-bot/loader
3
+ * @Version 1.8.1
4
+ * @Author Arimura Sena <me@hotaru.icu>
5
+ * @Copyright 2024-2025 Hotaru. All rights reserved.
6
+ * @License GPL-3.0
7
+ * @Link https://github.com/kotorijs/kotori
8
+ * @Date 2026/2/14 00:45:38
9
+ */
12
10
  "use strict";
13
11
  var __defProp = Object.defineProperty;
14
12
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -24,12 +22,12 @@ var __copyProps = (to, from, except, desc) => {
24
22
  };
25
23
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
26
24
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var src_exports = {};
28
- module.exports = __toCommonJS(src_exports);
29
- __reExport(src_exports, require("./loader"), module.exports);
30
- __reExport(src_exports, require("./types"), module.exports);
31
- __reExport(src_exports, require("./service/adapters"), module.exports);
32
- __reExport(src_exports, require("@kotori-bot/logger"), module.exports);
25
+ var index_exports = {};
26
+ module.exports = __toCommonJS(index_exports);
27
+ __reExport(index_exports, require("./loader"), module.exports);
28
+ __reExport(index_exports, require("./types"), module.exports);
29
+ __reExport(index_exports, require("./service/adapters"), module.exports);
30
+ __reExport(index_exports, require("@kotori-bot/logger"), module.exports);
33
31
  // Annotate the CommonJS export names for ESM import in node:
34
32
  0 && (module.exports = {
35
33
  ...require("./loader"),
@@ -1,14 +1,12 @@
1
-
2
1
  /**
3
- * @Package @kotori-bot/loader
4
- * @Version 1.7.5
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 17:13:02
10
- */
11
-
2
+ * @Package @kotori-bot/loader
3
+ * @Version 1.8.1
4
+ * @Author Arimura Sena <me@hotaru.icu>
5
+ * @Copyright 2024-2025 Hotaru. All rights reserved.
6
+ * @License GPL-3.0
7
+ * @Link https://github.com/kotorijs/kotori
8
+ * @Date 2026/2/14 00:45:38
9
+ */
12
10
  "use strict";
13
11
  var __defProp = Object.defineProperty;
14
12
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -63,6 +61,7 @@ const DEFAULT_LOADER_CONFIG = {
63
61
  dirs: ["./node_modules/", "./node_modules/@kotori-bot/"],
64
62
  port: 720,
65
63
  dbPrefix: "romiChan",
64
+ dbDuration: 3600,
66
65
  level: import_logger.LoggerLevel.RECORD,
67
66
  noColor: false
68
67
  };
@@ -1,14 +1,12 @@
1
-
2
1
  /**
3
- * @Package @kotori-bot/loader
4
- * @Version 1.7.5
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 17:13:02
10
- */
11
-
2
+ * @Package @kotori-bot/loader
3
+ * @Version 1.8.1
4
+ * @Author Arimura Sena <me@hotaru.icu>
5
+ * @Copyright 2024-2025 Hotaru. All rights reserved.
6
+ * @License GPL-3.0
7
+ * @Link https://github.com/kotorijs/kotori
8
+ * @Date 2026/2/14 00:45:38
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.5
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 17:13:02
10
- */
11
-
2
+ * @Package @kotori-bot/loader
3
+ * @Version 1.8.1
4
+ * @Author Arimura Sena <me@hotaru.icu>
5
+ * @Copyright 2024-2025 Hotaru. All rights reserved.
6
+ * @License GPL-3.0
7
+ * @Link https://github.com/kotorijs/kotori
8
+ * @Date 2026/2/14 00:45:38
9
+ */
12
10
  "use strict";
13
11
  var __create = Object.create;
14
12
  var __defProp = Object.defineProperty;
@@ -47,19 +45,20 @@ __export(loader_exports, {
47
45
  modulePackageSchema: () => modulePackageSchema
48
46
  });
49
47
  module.exports = __toCommonJS(loader_exports);
50
- var import_core = require("@kotori-bot/core");
51
- var import_node_path = __toESM(require("node:path"));
52
48
  var import_node_fs = __toESM(require("node:fs"));
49
+ var import_node_path = __toESM(require("node:path"));
50
+ var import_core = require("@kotori-bot/core");
53
51
  var import_logger = __toESM(require("@kotori-bot/logger"));
54
- var import_log = __toESM(require("../utils/log"));
55
- var import_constants = require("./constants");
56
- var import_server = __toESM(require("../service/server"));
57
52
  var import_database = __toESM(require("../service/database"));
58
53
  var import_file = __toESM(require("../service/file"));
54
+ var import_server = __toESM(require("../service/server"));
55
+ var import_log = __toESM(require("../utils/log"));
59
56
  var import_logger2 = __toESM(require("../utils/logger"));
57
+ var import_constants = require("./constants");
60
58
  const GLOBAL = {
61
59
  REPO: "https://github.com/kotorijs/kotori",
62
- UPDATE: "https://hotaru.icu/api/agent/?url=https://raw.githubusercontent.com/kotorijs/kotori/master/package.json"
60
+ // TODO: add more update urls
61
+ UPDATE: "https://api.hotaru.icu/ial/agent/?url=https://raw.githubusercontent.com/kotorijs/kotori/master/package.json"
63
62
  };
64
63
  function getBaseDir(filename, dir) {
65
64
  let root = dir ? import_node_path.default.resolve(dir) : import_node_path.default.resolve(__dirname, "..").replace("loader", "kotori");
@@ -80,6 +79,7 @@ function getBaseDir(filename, dir) {
80
79
  const baseDir = {
81
80
  root,
82
81
  data: import_node_path.default.join(root, "data"),
82
+ // cache: path.join(root, 'cache'),
83
83
  logs: import_node_path.default.join(root, "logs"),
84
84
  config: filename
85
85
  };
@@ -106,7 +106,6 @@ function getConfig(baseDir, loaderOptions) {
106
106
  if (result.global.dirs.length === 0) result.global.dirs = import_constants.DEFAULT_LOADER_CONFIG.dirs;
107
107
  if (loaderOptions?.mode === import_constants.DEV_MODE) {
108
108
  if (result.global.level === import_constants.DEFAULT_LOADER_CONFIG.level) result.global.level = import_logger.LoggerLevel.DEBUG;
109
- if (!result.global.dirs.includes("modules")) result.global.dirs = ["modules", ...result.global.dirs];
110
109
  }
111
110
  return import_core.Tsu.Object({
112
111
  adapter: import_core.Tsu.Object({}).index(adapterConfigSchemaFactory(result.global.lang, result.global.commandPrefix)).default(import_core.DEFAULT_CORE_CONFIG.adapter)
@@ -119,8 +118,8 @@ function getConfig(baseDir, loaderOptions) {
119
118
  }
120
119
  function moduleLoaderOrder(pkg) {
121
120
  if (import_constants.CORE_MODULES.includes(pkg.name)) return 1;
122
- if (pkg.name.includes(import_constants.ADAPTER_PREFIX)) return 3;
123
- if (pkg.kotori.enforce === "pre") return 4;
121
+ if (pkg.kotori.enforce === "pre") return 3;
122
+ if (pkg.name.includes(import_constants.ADAPTER_PREFIX)) return 4;
124
123
  if (!pkg.kotori.enforce) return 5;
125
124
  return 6;
126
125
  }
@@ -132,6 +131,7 @@ const globalLoaderConfigSchema = import_core.Tsu.Object({
132
131
  level: import_core.Tsu.Number().default(import_constants.DEFAULT_LOADER_CONFIG.level),
133
132
  port: import_core.Tsu.Number().default(import_constants.DEFAULT_LOADER_CONFIG.port),
134
133
  dbPrefix: import_core.Tsu.String().default(import_constants.DEFAULT_LOADER_CONFIG.dbPrefix),
134
+ dbDuration: import_core.Tsu.Number().default(import_constants.DEFAULT_LOADER_CONFIG.dbDuration),
135
135
  noColor: import_core.Tsu.Boolean().default(import_constants.DEFAULT_LOADER_CONFIG.noColor)
136
136
  }).default(Object.assign(import_core.DEFAULT_CORE_CONFIG.global, import_constants.DEFAULT_LOADER_CONFIG));
137
137
  const adapterConfigSchemaFactory = (lang, commandPrefix) => import_core.Tsu.Object({
@@ -148,14 +148,14 @@ const modulePackageSchema = import_core.Tsu.Object({
148
148
  version: import_core.Tsu.String(),
149
149
  description: import_core.Tsu.String(),
150
150
  main: import_core.Tsu.String(),
151
- license: import_core.Tsu.Literal("GPL-3.0"),
151
+ license: import_core.Tsu.Union(import_core.Tsu.Literal("GPL-3.0"), import_core.Tsu.Literal("GPL-3.0"), import_core.Tsu.Literal("BCU")),
152
152
  keywords: import_core.Tsu.Custom(
153
153
  (val) => Array.isArray(val) && val.includes("kotori") && val.includes("chatbot") && val.includes("kotori-plugin")
154
154
  ),
155
155
  author: import_core.Tsu.Union(import_core.Tsu.String(), import_core.Tsu.Array(import_core.Tsu.String())),
156
- peerDependencies: import_core.Tsu.Object({
157
- "kotori-bot": import_core.Tsu.String()
158
- }),
156
+ // peerDependencies: Tsu.Object({
157
+ // 'kotori-bot': Tsu.String()
158
+ // }),
159
159
  kotori: import_core.Tsu.Object({
160
160
  enforce: import_core.Tsu.Union(import_core.Tsu.Literal("pre"), import_core.Tsu.Literal("post")).optional(),
161
161
  meta: import_core.Tsu.Object({
@@ -204,7 +204,13 @@ class Loader extends import_core.Core {
204
204
  this.inject("logger");
205
205
  this.service("server", new import_server.default(this.extends("server"), { port: this.config.global.port }));
206
206
  this.service("file", new import_file.default(this.extends("file")));
207
- this.service("db", new import_database.default(this.extends("database"), { prefix: this.config.global.dbPrefix }));
207
+ this.service(
208
+ "db",
209
+ new import_database.default(this.extends("database"), {
210
+ prefix: this.config.global.dbPrefix,
211
+ duration: this.config.global.dbDuration
212
+ })
213
+ );
208
214
  this.http.response(void 0, (err) => {
209
215
  if ("logger" in this) this.logger.label("http").error(err instanceof Error ? err.message : err);
210
216
  });
@@ -278,7 +284,10 @@ class Loader extends import_core.Core {
278
284
  if (this.loadRecord.has(name)) return;
279
285
  this.loadRecord.add(name);
280
286
  this.logger.info(
281
- this.format("loader.modules.load", [name, version, Array.isArray(author) ? author.join(",") : author])
287
+ this.format(
288
+ data.instance.default && "isRescript" in data.instance.default ? "loader.modules.loadRes" : "loader.modules.load",
289
+ [name, version, Array.isArray(author) ? author.join(",") : author]
290
+ )
282
291
  );
283
292
  });
284
293
  }
@@ -297,8 +306,8 @@ class Loader extends import_core.Core {
297
306
  if (e instanceof import_core.TsuError) throw new import_core.DevError(`package.json format error ${pkgPath}: ${e.message}`);
298
307
  throw new import_core.DevError(`illegal package.json ${pkgPath}`);
299
308
  }
300
- const loadTs = this.isDev && import_node_fs.default.existsSync(import_node_path.default.join(dir, "src/index.ts"));
301
- const main = import_node_path.default.resolve(dir, loadTs ? "src/index.ts" : pkg.main);
309
+ const loadTsFile = this.isDev ? ["src/index.ts", "src/index.tsx"].find((el) => import_node_fs.default.existsSync(import_node_path.default.join(dir, el))) : void 0;
310
+ const main = import_node_path.default.resolve(dir, loadTsFile ?? pkg.main);
302
311
  if (!import_node_fs.default.existsSync(main)) throw new import_core.DevError(`cannot find main file ${main}`);
303
312
  const getDirFiles = (rootDir2) => {
304
313
  const files2 = import_node_fs.default.readdirSync(rootDir2);
@@ -308,12 +317,12 @@ class Loader extends import_core.Core {
308
317
  if (import_node_fs.default.statSync(file).isDirectory()) {
309
318
  list.push(...getDirFiles(file));
310
319
  }
311
- if (import_node_path.default.parse(file).ext === ".ts" && !this.isDev) continue;
320
+ if (import_node_path.default.parse(file).ext.startsWith(".ts") && !this.isDev) continue;
312
321
  list.push(import_node_path.default.resolve(file));
313
322
  }
314
323
  return list;
315
324
  };
316
- const files = getDirFiles(import_node_path.default.join(dir, loadTs ? "src" : import_node_path.default.parse(pkg.main).dir));
325
+ const files = getDirFiles(import_node_path.default.join(dir, loadTsFile ? "src" : import_node_path.default.parse(pkg.main).dir));
317
326
  const [pkgScope, pkgName] = pkg.name.split("/");
318
327
  const pluginName = `${pkgScope.startsWith("@") && pkgScope !== "@kotori-bot" ? `${pkgScope.slice(1)}/` : ""}${(pkgName ?? pkgScope).replace(import_constants.PLUGIN_PREFIX, "")}`;
319
328
  this[import_core.Symbols.modules].set(pkg.name, [{ pkg, files, main }, this.config.plugin[pluginName] ?? {}]);
@@ -356,9 +365,16 @@ class Loader extends import_core.Core {
356
365
  if (obj.default?.config instanceof import_core.Parser) config = parsed(obj.default.config);
357
366
  if (obj.Main?.config instanceof import_core.Parser) config = parsed(obj.Main.config);
358
367
  if (import_core.Service.isPrototypeOf.call(import_core.Service, obj.default)) {
359
- this.service("", new obj.default(this.extends(pkg.name), config));
368
+ const serviceName = (pkg.name.split("/")[1] ?? pkg.name).replace(import_constants.PLUGIN_PREFIX, "");
369
+ this.service(serviceName, new obj.default(this.extends(serviceName), config));
360
370
  obj = {};
361
371
  }
372
+ if (typeof obj.main === "function" && pkg.keywords?.includes("rescript")) {
373
+ obj.default = (ctx, config2) => {
374
+ obj.main(ctx, config2);
375
+ };
376
+ obj.default.isRescript = true;
377
+ }
362
378
  try {
363
379
  this.load({ name: pkg.name, ...obj, config });
364
380
  } catch (e) {
@@ -429,6 +445,16 @@ class Loader extends import_core.Core {
429
445
  }
430
446
  }
431
447
  async checkUpdate() {
448
+ const pkgPath = import_node_path.default.join(this.baseDir.root, "package.json");
449
+ if ((0, import_node_fs.existsSync)(pkgPath)) {
450
+ try {
451
+ if (JSON.parse(import_node_fs.default.readFileSync(pkgPath).toString()).name === "@kotori-bot/root") {
452
+ this.logger.info(this.i18n.t`loader.tips.update.workspace`);
453
+ return;
454
+ }
455
+ } catch {
456
+ }
457
+ }
432
458
  const { version } = this.meta;
433
459
  if (!version) return;
434
460
  const res = await new import_core.Http().get(GLOBAL.UPDATE).catch(() => {
@@ -1,14 +1,12 @@
1
-
2
1
  /**
3
- * @Package @kotori-bot/loader
4
- * @Version 1.7.5
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 17:13:02
10
- */
11
-
2
+ * @Package @kotori-bot/loader
3
+ * @Version 1.8.1
4
+ * @Author Arimura Sena <me@hotaru.icu>
5
+ * @Copyright 2024-2025 Hotaru. All rights reserved.
6
+ * @License GPL-3.0
7
+ * @Link https://github.com/kotorijs/kotori
8
+ * @Date 2026/2/14 00:45:38
9
+ */
12
10
  "use strict";
13
11
  var __defProp = Object.defineProperty;
14
12
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @Package @kotori-bot/loader
3
+ * @Version 1.8.1
4
+ * @Author Arimura Sena <me@hotaru.icu>
5
+ * @Copyright 2024-2025 Hotaru. All rights reserved.
6
+ * @License GPL-3.0
7
+ * @Link https://github.com/kotorijs/kotori
8
+ * @Date 2026/2/14 00:45:38
9
+ */
10
+ "use strict";
11
+ var __defProp = Object.defineProperty;
12
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
+ var __getOwnPropNames = Object.getOwnPropertyNames;
14
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from))
18
+ if (!__hasOwnProp.call(to, key) && key !== except)
19
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
+ }
21
+ return to;
22
+ };
23
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
+ var browser_exports = {};
25
+ module.exports = __toCommonJS(browser_exports);
@@ -1,14 +1,12 @@
1
-
2
1
  /**
3
- * @Package @kotori-bot/loader
4
- * @Version 1.7.5
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 17:13:02
10
- */
11
-
2
+ * @Package @kotori-bot/loader
3
+ * @Version 1.8.1
4
+ * @Author Arimura Sena <me@hotaru.icu>
5
+ * @Copyright 2024-2025 Hotaru. All rights reserved.
6
+ * @License GPL-3.0
7
+ * @Link https://github.com/kotorijs/kotori
8
+ * @Date 2026/2/14 00:45:38
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.5
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 17:13:02
10
- */
11
-
2
+ * @Package @kotori-bot/loader
3
+ * @Version 1.8.1
4
+ * @Author Arimura Sena <me@hotaru.icu>
5
+ * @Copyright 2024-2025 Hotaru. All rights reserved.
6
+ * @License GPL-3.0
7
+ * @Link https://github.com/kotorijs/kotori
8
+ * @Date 2026/2/14 00:45:38
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.5
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 17:13:02
10
- */
11
-
2
+ * @Package @kotori-bot/loader
3
+ * @Version 1.8.1
4
+ * @Author Arimura Sena <me@hotaru.icu>
5
+ * @Copyright 2024-2025 Hotaru. All rights reserved.
6
+ * @License GPL-3.0
7
+ * @Link https://github.com/kotorijs/kotori
8
+ * @Date 2026/2/14 00:45:38
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.5
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 17:13:02
10
- */
11
-
2
+ * @Package @kotori-bot/loader
3
+ * @Version 1.8.1
4
+ * @Author Arimura Sena <me@hotaru.icu>
5
+ * @Copyright 2024-2025 Hotaru. All rights reserved.
6
+ * @License GPL-3.0
7
+ * @Link https://github.com/kotorijs/kotori
8
+ * @Date 2026/2/14 00:45:38
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.5
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 17:13:02
10
- */
11
-
2
+ * @Package @kotori-bot/loader
3
+ * @Version 1.8.1
4
+ * @Author Arimura Sena <me@hotaru.icu>
5
+ * @Copyright 2024-2025 Hotaru. All rights reserved.
6
+ * @License GPL-3.0
7
+ * @Link https://github.com/kotorijs/kotori
8
+ * @Date 2026/2/14 00:45:38
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.5
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 17:13:02
10
- */
11
-
2
+ * @Package @kotori-bot/loader
3
+ * @Version 1.8.1
4
+ * @Author Arimura Sena <me@hotaru.icu>
5
+ * @Copyright 2024-2025 Hotaru. All rights reserved.
6
+ * @License GPL-3.0
7
+ * @Link https://github.com/kotorijs/kotori
8
+ * @Date 2026/2/14 00:45:38
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.5
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 17:13:02
10
- */
11
-
2
+ * @Package @kotori-bot/loader
3
+ * @Version 1.8.1
4
+ * @Author Arimura Sena <me@hotaru.icu>
5
+ * @Copyright 2024-2025 Hotaru. All rights reserved.
6
+ * @License GPL-3.0
7
+ * @Link https://github.com/kotorijs/kotori
8
+ * @Date 2026/2/14 00:45:38
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@kotori-bot/loader",
3
- "version": "1.7.5",
3
+ "version": "1.8.1",
4
4
  "description": "Loader For KotoriBot",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -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/logger": "^1.3.4",
33
+ "@kotori-bot/core": "^1.7.1"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/express": "^4.17.21",
package/lib/index.d.ts DELETED
@@ -1,4 +0,0 @@
1
- export * from './loader';
2
- export * from './types';
3
- export * from './service/adapters';
4
- export * from '@kotori-bot/logger';
@@ -1,15 +0,0 @@
1
- import { LoggerLevel } from '@kotori-bot/logger';
2
- export declare const PLUGIN_PREFIX = "kotori-plugin-";
3
- export declare const ADAPTER_PREFIX = "adapter-";
4
- export declare const CONFIG_NAME = "kotori.toml";
5
- export declare const BUILD_MODE: "build";
6
- export declare const DEV_MODE: "dev";
7
- export declare const CORE_MODULES: string[];
8
- export declare const INTERNAL_PACKAGES: string[];
9
- export declare const DEFAULT_LOADER_CONFIG: {
10
- dirs: string[];
11
- port: number;
12
- dbPrefix: string;
13
- level: LoggerLevel;
14
- noColor: boolean;
15
- };