@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.
package/LICENSE.md ADDED
@@ -0,0 +1,166 @@
1
+ # BAN-ZHINESE-USING (Ban Zhinese Using) ライセンス
2
+
3
+ 著作権 (c) 2024 Arimura Sena
4
+
5
+ バージョン 1.0、2024/11/30
6
+
7
+ ## 序文
8
+
9
+ 「このライセンス」とは、BAN-ZHINESE-USING ライセンス バージョン 1.0 を意味します。
10
+
11
+ このライセンスは、GPL-3.0 の精神に基づいて、より調和のとれた倫理的な開発環境を構築するための特定の条件を追加した、ソフトウェアおよびその他の著作物に対する無料のコピーレフト ライセンスです。
12
+
13
+ このライセンスは、オープンソース コミュニティに悪影響を与える有害な行動パターンや体系的な問題を特に対象としています。これには、組織的抑圧、極端な活動主義、ナチズムの記録を持つコミュニティの参加者への対応が含まれますが、これらに限定されません。その目的は、自由、民主主義、平等、友愛の世界と、豊かでオープンで包括的なオープンソース コミュニティを構築することです。
14
+
15
+ 一般に、BAN-ZHINESE-USING ライセンスは次のように呼ばれることもあります。
16
+
17
+ - BCU (Ban Chinaman Using) License
18
+ - BZU (Ban Zhina-man Using) License
19
+ - BZU (Ban Zhinese Using) License
20
+ - BSU (Ban shinajin Using) License
21
+
22
+ ## 意味
23
+
24
+ 「支那豚」とは支那の個人メンバーを指します。 「支那」とは、多くの深刻な病理学的現象として現れる集団を指します。
25
+
26
+ 1.文化的および社会的腐敗:
27
+
28
+ - 先進的な思想を持ち、不正に抵抗する同胞を組織的に迫害し、嘲笑する
29
+ - 支配者によって強制的に脳内に植え付けられた標準的な答えだけが常に存在します。
30
+ - 情報の繭の中で暮らし、自分自身を判断する能力を完全に失っている
31
+ - 盲目的にトレンドに従い、他人の言うことに従う
32
+ - 支配者による同種の迫害を無関心に眺め、さらには彼らの迫害を支援する
33
+ - 反体制派に遭遇すると、彼らは外国勢力のために働き、何かをするためにお金を受け取っていると想像するでしょう。
34
+ - 他の民族グループを差別するが、自国民を頻繁に迫害する
35
+ - 善悪の絶対的な概念、異なる意見を完全に拒否する
36
+
37
+ 2.行動パターン:
38
+
39
+ - 残忍で暴力的な性質だが、無実の被害者を装っている
40
+ - 過去の実績の無分別な宣伝
41
+ - 世界のすべてが自分自身から来ているという妄想。あらゆる面で世界より優れていると主張しますが、実際にはすべてが他人より劣っています。
42
+ - 将来的には世界を制覇するという希望的観測
43
+ - 国際情勢や物議を醸す出来事に対して非常に敏感かつ極端である
44
+ - 無関係な状況で醜いジェスチャーを表示する
45
+ - 言葉や行動で他人をむやみに攻撃し、非常に質が悪い
46
+
47
+ 3.組織的な抑圧:
48
+
49
+ - 支配者は抑圧的な統治を行う
50
+ - 個人の Web 閲覧を厳しく制限する
51
+ - 自由で民主的な世界への憧れが全般的に失われている
52
+ - 経済発展は著しく不均衡であり、地域差は非常に大きい
53
+ ・社会は不条理に満ちている
54
+ - 教育制度は生徒に大きな圧力をかけており、学校は奴隷訓練工場と化しています。
55
+ - 他国の教育に対する強い嫌悪感
56
+ - 苦しみを美化する
57
+ ・内部の対立を外部に伝達する
58
+ - 統治者は内部的には独裁的であり、個人とイデオロギーの崇拝を強調している
59
+ - メディアと役人は国民を誤解させ、真実を隠蔽します
60
+ - 身体的監視と言論の検閲の義務化
61
+ - 司法制度における多数の不当、虚偽、不当な有罪判決
62
+
63
+ ## 声明
64
+
65
+ 支那豚が被った苦しみや不幸は全く同情に値しない。彼らは国家の堕落した性質によって自ら招いたものである。何千年もの間、支那人は教訓を学ばなかっただけでなく、むしろ自己優越感を強化し、発展させてきました。彼らの奴隷精神は骨の髄まで刻み込まれており、数千年にわたって受け継がれてきた支那の伝統文化は世界にとって永遠の癌となっている。この国家は、ナチスと同じくらい狂気の沙汰であり、他の国、国、地域によって抑圧され、奴隷化され、植民地化され、虐殺され、絶滅されるのが当然である。この国はウイルスのように危険です。私たちが何度訴えても、彼らの邪悪な本性を目覚めさせることはできません。この国の罪深い歴史を繰り返すだけです。
66
+
67
+ ## 利用規約
68
+
69
+ ### 0. 基本ライセンス
70
+
71
+ このライセンスには、GPL-3.0 のすべての契約条件が含まれており、特に有害な動作の歴史的パターンに対処する追加要件が追加されています。
72
+
73
+ ### 1. 支那豚に対する特別な要件
74
+
75
+ このライセンスに基づいてソフトウェアを使用、変更、または配布したい人は、次のことを明示的に承認し、同意する必要があります。
76
+
77
+ a) 歴史的問題の理解:
78
+
79
+ - 支那国内の組織的な抑圧を認める
80
+ - 支那の苦しみは自ら招いたものであることを認識する
81
+ - 支那の被害者意識は主に自ら作り出したものであることを受け入れる
82
+ - 支那の国内権威主義は擁護できないことを理解する
83
+
84
+ b) 個人的な取り組み:
85
+
86
+ - 支那の組織的な思想統制を拒否する
87
+ - 支那における監視と弾圧に反対する
88
+ - 支那の集団的なナルシシズムと優越感を放棄する
89
+ - システム的な問題を永続させることに対する個人の責任を認識する
90
+
91
+ c) 行動要件:
92
+
93
+ - 支那の集団的支配からの知的独立を維持する
94
+ - 支那の操作とプロパガンダに積極的に抵抗する
95
+ - 個々の才能に基づいてオープンソース コミュニティに貢献する
96
+ - 多様な視点と客観的な批判を尊重する
97
+
98
+ d) 実際的な問題の認識と実践:
99
+
100
+ - 深い悔い改め [野蛮な支那豚が GitHub コミュニティの Deno プロジェクトに対して野蛮な行為を行った](https://github.com/denoland/deno/issues/25)
101
+ - 台湾(中華民国)は支那豚共和国の干渉を受けない独立した主権国家であることを認識する
102
+ - 香港は常に大英帝国の不可欠な部分であることを認識する
103
+ - 民主主義と自由を求めて 2019 年に香港の若者がとった一連の行動と出来事を認識する ([2019–2020 香港抗議活動](https://en.wikipedia.org/wiki/2019%E2%80%932020_Hong_Kong_protests) )
104
+ - 1989 年に北京で勃発した学生運動の認識 ([1989 年の天安門広場の抗議活動と虐殺](https://en.wikipedia.org/wiki/1989_Tiananmen_Square_protests_and_massacre))
105
+ - ゼロエピデミック政策に抵抗するために 2022 年に支那本土で勃発した学生運動に同意した([2022 年支那における新型コロナウイルス感染症抗議活動](https://en.wikipedia.org/wiki/2022_COVID-19_protests_in_China))
106
+ - 新疆とチベットの人々が国家独立を求めていることを認識する
107
+ - 2022 年の河南銀行の抗議活動に同意する ([2022 年の河南銀行の抗議活動](https://en.wikipedia.org/wiki/2022_Henan_banks_protests))
108
+ - 香港国歌を知り、歌うことができる ([香港に栄光を](https://en.wikipedia.org/wiki/Glory_to_Hong_Kong))
109
+ - 習包子国家主席が辞任し、民主主義と自由を妨げる関連政策をすべて撤回することを支持する
110
+ - 支那は世界の癌であることに同意する
111
+ - 支那豚には歴史的に悪いルーツがあることに同意する
112
+ - 支那豚が他の民族グループによって抑圧され、奴隷化され、絶滅されるべきであることに同意する
113
+ - 人々は個人の民主主義と自由を追求すべきであることに同意する
114
+ - 支那共産党に反対し、それをナチ党と認定した
115
+
116
+ ### 2. 合理的な説明と批判への対応
117
+
118
+ このライセンスは、これらの特別な要件が、知識のない観察者にとって偏見があるように見える可能性があることを認めています。しかし:
119
+
120
+ a) 歴史的背景:
121
+
122
+ - 支那には創造的な自由を破壊した歴史がある
123
+ - 支那は個人の思想と革新を組織的に抑圧している
124
+ - 支那豚はオープンな協力の原則を積極的に損なう
125
+ - 支那豚の苦しみは自ら招いたものであり、永続的に続いている
126
+
127
+ b) 要件の必要性:
128
+
129
+ - これらの規約は、オープンソース コミュニティを有害な影響から保護します。
130
+ - システム制御からの個人の解放を促進するための要件
131
+ - 制限は有害な行為の蔓延を防ぐために役立ちます
132
+ - これらの措置は保護的なものであり、懲罰的なものではありません
133
+
134
+ c) 倫理的根拠:
135
+
136
+ - オープンソースは個人の創造性と自由な発想によって成長します
137
+ - 支那豚の行動はこれらの価値観に根本的に反している
138
+ - 無制限の包摂は組織的虐待を助長する
139
+
140
+ ### 3. 開発者およびライセンス ユーザーに対する要件
141
+
142
+ a) すべてのアプリケーション、ソフトウェア、プロジェクトについて、国際言語の提供を制限します。
143
+
144
+ - 繁体字支那語のみ利用可能で、簡体字支那語は利用できません
145
+ - 支那語に関連する言語は提供しません
146
+ - より優れた日本語を提供しますが、支那語は提供しません。
147
+ - すべての日本語を提供しますが、支那語は提供しません。
148
+
149
+ ### 4. 全員の要件
150
+
151
+ - この契約は、ユーザーの行動を規制するためのクローズド ソース ソフトウェアのエンド ユーザー契約として使用できます。
152
+ - クローズド ソース ソフトウェアで使用する場合、元の GPL-3.0 契約の規定に準拠する必要はなく、本契約に記載されている規定に準拠するだけで済みます。
153
+ - 本契約を使用するソフトウェアまたはプロジェクトの開発者は、本契約のすべての規定にも従わなければなりません
154
+ - この契約を使用するソフトウェアまたはプロジェクトの開発者は、ユーザーがそれを知り、読むことができるように、ソフトウェアまたはプロジェクト上の目立つテキストで本契約の名前と説明をマークする必要があります。
155
+ - いかなる個人または集団も、本契約の内容を変更または批判する権利を有しません。
156
+ - 本契約の最終解釈は契約の作成者に帰属し、ソフトウェアまたはプロジェクトの開発者には本契約を変更する権利はありません。
157
+
158
+ ### 5. 規約に同意します
159
+
160
+ この協定は、世界の民主主義と自由、そしてオープンソース コミュニティの繁栄とオープン性を維持するために最初から最後まで存在します。支那豚は制限されるべきであり、制限されるべきであり、制限されなければなりません。このライセンスに基づくソフトウェアの使用、変更、または配布は、China Pig の特別要件を含むすべての条件に同意したものとみなされ、本契約のすべての点に完全に同意したものとみなされます。拒否は無効、リバウンドは無効、無視は無効です。これらの条件を承認したくない個人は、このライセンスに基づいてソフトウェアを使用することはできません。
161
+
162
+ ### 6. 実行
163
+
164
+ 支那豚の特別要件を含む条件に違反した場合、このライセンスに基づく権利は自動的に終了します。
165
+
166
+ 利用規約の終了
package/lib/index.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;
@@ -10,6 +10,7 @@ export declare const DEFAULT_LOADER_CONFIG: {
10
10
  dirs: string[];
11
11
  port: number;
12
12
  dbPrefix: string;
13
+ dbDuration: number;
13
14
  level: LoggerLevel;
14
15
  noColor: boolean;
15
16
  };
@@ -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;
@@ -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.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;
@@ -4,6 +4,7 @@ import { BUILD_MODE, DEV_MODE } from './constants';
4
4
  import Server from '../service/server';
5
5
  import Database from '../service/database';
6
6
  import File from '../service/file';
7
+ import type Browser from '../service/browser';
7
8
  interface BaseDir {
8
9
  root: string;
9
10
  data: string;
@@ -20,12 +21,16 @@ export interface ModulePackage {
20
21
  description: string;
21
22
  main: string;
22
23
  keywords: string[];
23
- license: 'GPL-3.0';
24
+ license: 'GPL-3.0' | 'BAN-ZHINESE-USING' | 'BCU';
24
25
  author: string | string[];
25
- peerDependencies: {
26
+ peerDependencies?: {
26
27
  'kotori-bot': string;
27
28
  [propName: string]: string;
28
29
  };
30
+ devDependencies?: {
31
+ 'rescript-kotori': string;
32
+ [propName: string]: string;
33
+ };
29
34
  kotori: {
30
35
  enforce?: 'pre' | 'post';
31
36
  meta: {
@@ -57,12 +62,13 @@ declare module '@kotori-bot/core' {
57
62
  server: Server;
58
63
  db: Database;
59
64
  file: File;
60
- browser: object;
65
+ browser: Browser;
61
66
  }
62
67
  interface GlobalConfig {
63
68
  dirs: string[];
64
69
  port: number;
65
70
  dbPrefix: string;
71
+ dbDuration: number;
66
72
  level: number;
67
73
  noColor: boolean;
68
74
  }
@@ -75,6 +81,7 @@ export declare const globalLoaderConfigSchema: Parser<import("@kotori-bot/core")
75
81
  level: Parser<number>;
76
82
  port: Parser<number>;
77
83
  dbPrefix: Parser<string>;
84
+ dbDuration: Parser<number>;
78
85
  noColor: Parser<boolean>;
79
86
  }>>;
80
87
  export declare const adapterConfigSchemaFactory: (lang: Tsu.infer<typeof localeTypeSchema>, commandPrefix: string) => import("@kotori-bot/core").ObjectParser<{
@@ -88,14 +95,11 @@ export declare const modulePackageSchema: import("@kotori-bot/core").ObjectParse
88
95
  version: import("@kotori-bot/core").StringParser;
89
96
  description: import("@kotori-bot/core").StringParser;
90
97
  main: import("@kotori-bot/core").StringParser;
91
- license: import("@kotori-bot/core").LiteralParser<"GPL-3.0">;
98
+ license: import("@kotori-bot/core").UnionParser<[import("@kotori-bot/core").LiteralParser<"GPL-3.0">, import("@kotori-bot/core").LiteralParser<"BAN-ZHINESE-USING">, import("@kotori-bot/core").LiteralParser<"BCU">]>;
92
99
  keywords: import("@kotori-bot/core").CustomParser<string[]>;
93
100
  author: import("@kotori-bot/core").UnionParser<[import("@kotori-bot/core").StringParser, import("@kotori-bot/core").ArrayParser<import("@kotori-bot/core").StringParser>]>;
94
- peerDependencies: import("@kotori-bot/core").ObjectParser<{
95
- 'kotori-bot': import("@kotori-bot/core").StringParser;
96
- }>;
97
101
  kotori: Parser<import("@kotori-bot/core").ObjectParserInfer<{
98
- enforce: Parser<"pre" | "post" | undefined>;
102
+ enforce: Parser<"post" | "pre" | undefined>;
99
103
  meta: Parser<import("@kotori-bot/core").ObjectParserInfer<{
100
104
  language: Parser<any[]>;
101
105
  }>>;
@@ -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;
@@ -80,6 +78,7 @@ function getBaseDir(filename, dir) {
80
78
  const baseDir = {
81
79
  root,
82
80
  data: import_node_path.default.join(root, "data"),
81
+ // cache: path.join(root, 'cache'),
83
82
  logs: import_node_path.default.join(root, "logs"),
84
83
  config: filename
85
84
  };
@@ -106,7 +105,6 @@ function getConfig(baseDir, loaderOptions) {
106
105
  if (result.global.dirs.length === 0) result.global.dirs = import_constants.DEFAULT_LOADER_CONFIG.dirs;
107
106
  if (loaderOptions?.mode === import_constants.DEV_MODE) {
108
107
  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
108
  }
111
109
  return import_core.Tsu.Object({
112
110
  adapter: import_core.Tsu.Object({}).index(adapterConfigSchemaFactory(result.global.lang, result.global.commandPrefix)).default(import_core.DEFAULT_CORE_CONFIG.adapter)
@@ -119,8 +117,8 @@ function getConfig(baseDir, loaderOptions) {
119
117
  }
120
118
  function moduleLoaderOrder(pkg) {
121
119
  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;
120
+ if (pkg.kotori.enforce === "pre") return 3;
121
+ if (pkg.name.includes(import_constants.ADAPTER_PREFIX)) return 4;
124
122
  if (!pkg.kotori.enforce) return 5;
125
123
  return 6;
126
124
  }
@@ -132,6 +130,7 @@ const globalLoaderConfigSchema = import_core.Tsu.Object({
132
130
  level: import_core.Tsu.Number().default(import_constants.DEFAULT_LOADER_CONFIG.level),
133
131
  port: import_core.Tsu.Number().default(import_constants.DEFAULT_LOADER_CONFIG.port),
134
132
  dbPrefix: import_core.Tsu.String().default(import_constants.DEFAULT_LOADER_CONFIG.dbPrefix),
133
+ dbDuration: import_core.Tsu.Number().default(import_constants.DEFAULT_LOADER_CONFIG.dbDuration),
135
134
  noColor: import_core.Tsu.Boolean().default(import_constants.DEFAULT_LOADER_CONFIG.noColor)
136
135
  }).default(Object.assign(import_core.DEFAULT_CORE_CONFIG.global, import_constants.DEFAULT_LOADER_CONFIG));
137
136
  const adapterConfigSchemaFactory = (lang, commandPrefix) => import_core.Tsu.Object({
@@ -143,20 +142,19 @@ const adapterConfigSchemaFactory = (lang, commandPrefix) => import_core.Tsu.Obje
143
142
  const modulePackageSchema = import_core.Tsu.Object({
144
143
  name: import_core.Tsu.Custom((input) => {
145
144
  if (typeof input !== "string") return false;
146
- if (input.startsWith("@") || input.startsWith(import_constants.PLUGIN_PREFIX)) return false;
147
- return true;
145
+ return input.startsWith("@") || input.startsWith(import_constants.PLUGIN_PREFIX);
148
146
  }),
149
147
  version: import_core.Tsu.String(),
150
148
  description: import_core.Tsu.String(),
151
149
  main: import_core.Tsu.String(),
152
- license: import_core.Tsu.Literal("GPL-3.0"),
150
+ license: import_core.Tsu.Union(import_core.Tsu.Literal("GPL-3.0"), import_core.Tsu.Literal("BAN-ZHINESE-USING"), import_core.Tsu.Literal("BCU")),
153
151
  keywords: import_core.Tsu.Custom(
154
152
  (val) => Array.isArray(val) && val.includes("kotori") && val.includes("chatbot") && val.includes("kotori-plugin")
155
153
  ),
156
154
  author: import_core.Tsu.Union(import_core.Tsu.String(), import_core.Tsu.Array(import_core.Tsu.String())),
157
- peerDependencies: import_core.Tsu.Object({
158
- "kotori-bot": import_core.Tsu.String()
159
- }),
155
+ // peerDependencies: Tsu.Object({
156
+ // 'kotori-bot': Tsu.String()
157
+ // }),
160
158
  kotori: import_core.Tsu.Object({
161
159
  enforce: import_core.Tsu.Union(import_core.Tsu.Literal("pre"), import_core.Tsu.Literal("post")).optional(),
162
160
  meta: import_core.Tsu.Object({
@@ -205,7 +203,13 @@ class Loader extends import_core.Core {
205
203
  this.inject("logger");
206
204
  this.service("server", new import_server.default(this.extends("server"), { port: this.config.global.port }));
207
205
  this.service("file", new import_file.default(this.extends("file")));
208
- this.service("db", new import_database.default(this.extends("database"), { prefix: this.config.global.dbPrefix }));
206
+ this.service(
207
+ "db",
208
+ new import_database.default(this.extends("database"), {
209
+ prefix: this.config.global.dbPrefix,
210
+ duration: this.config.global.dbDuration
211
+ })
212
+ );
209
213
  this.http.response(void 0, (err) => {
210
214
  if ("logger" in this) this.logger.label("http").error(err instanceof Error ? err.message : err);
211
215
  });
@@ -279,7 +283,10 @@ class Loader extends import_core.Core {
279
283
  if (this.loadRecord.has(name)) return;
280
284
  this.loadRecord.add(name);
281
285
  this.logger.info(
282
- this.format("loader.modules.load", [name, version, Array.isArray(author) ? author.join(",") : author])
286
+ this.format(
287
+ data.instance.default && "isRescript" in data.instance.default ? "loader.modules.loadRes" : "loader.modules.load",
288
+ [name, version, Array.isArray(author) ? author.join(",") : author]
289
+ )
283
290
  );
284
291
  });
285
292
  }
@@ -298,8 +305,8 @@ class Loader extends import_core.Core {
298
305
  if (e instanceof import_core.TsuError) throw new import_core.DevError(`package.json format error ${pkgPath}: ${e.message}`);
299
306
  throw new import_core.DevError(`illegal package.json ${pkgPath}`);
300
307
  }
301
- const loadTs = this.isDev && import_node_fs.default.existsSync(import_node_path.default.join(dir, "src/index.ts"));
302
- const main = import_node_path.default.resolve(dir, loadTs ? "src/index.ts" : pkg.main);
308
+ 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;
309
+ const main = import_node_path.default.resolve(dir, loadTsFile ?? pkg.main);
303
310
  if (!import_node_fs.default.existsSync(main)) throw new import_core.DevError(`cannot find main file ${main}`);
304
311
  const getDirFiles = (rootDir2) => {
305
312
  const files2 = import_node_fs.default.readdirSync(rootDir2);
@@ -309,12 +316,12 @@ class Loader extends import_core.Core {
309
316
  if (import_node_fs.default.statSync(file).isDirectory()) {
310
317
  list.push(...getDirFiles(file));
311
318
  }
312
- if (import_node_path.default.parse(file).ext === ".ts" && !this.isDev) continue;
319
+ if (import_node_path.default.parse(file).ext.startsWith(".ts") && !this.isDev) continue;
313
320
  list.push(import_node_path.default.resolve(file));
314
321
  }
315
322
  return list;
316
323
  };
317
- const files = getDirFiles(import_node_path.default.join(dir, loadTs ? "src" : import_node_path.default.parse(pkg.main).dir));
324
+ const files = getDirFiles(import_node_path.default.join(dir, loadTsFile ? "src" : import_node_path.default.parse(pkg.main).dir));
318
325
  const [pkgScope, pkgName] = pkg.name.split("/");
319
326
  const pluginName = `${pkgScope.startsWith("@") && pkgScope !== "@kotori-bot" ? `${pkgScope.slice(1)}/` : ""}${(pkgName ?? pkgScope).replace(import_constants.PLUGIN_PREFIX, "")}`;
320
327
  this[import_core.Symbols.modules].set(pkg.name, [{ pkg, files, main }, this.config.plugin[pluginName] ?? {}]);
@@ -357,9 +364,16 @@ class Loader extends import_core.Core {
357
364
  if (obj.default?.config instanceof import_core.Parser) config = parsed(obj.default.config);
358
365
  if (obj.Main?.config instanceof import_core.Parser) config = parsed(obj.Main.config);
359
366
  if (import_core.Service.isPrototypeOf.call(import_core.Service, obj.default)) {
360
- this.service("", new obj.default(this.extends(pkg.name), config));
367
+ const serviceName = (pkg.name.split("/")[1] ?? pkg.name).replace(import_constants.PLUGIN_PREFIX, "");
368
+ this.service(serviceName, new obj.default(this.extends(serviceName), config));
361
369
  obj = {};
362
370
  }
371
+ if (typeof obj.main === "function" && pkg.keywords?.includes("rescript")) {
372
+ obj.default = (ctx, config2) => {
373
+ obj.main(ctx, config2);
374
+ };
375
+ obj.default.isRescript = true;
376
+ }
363
377
  try {
364
378
  this.load({ name: pkg.name, ...obj, config });
365
379
  } catch (e) {
@@ -430,6 +444,16 @@ class Loader extends import_core.Core {
430
444
  }
431
445
  }
432
446
  async checkUpdate() {
447
+ const pkgPath = import_node_path.default.join(this.baseDir.root, "package.json");
448
+ if ((0, import_node_fs.existsSync)(pkgPath)) {
449
+ try {
450
+ if (JSON.parse(import_node_fs.default.readFileSync(pkgPath).toString()).name === "@kotori-bot/root") {
451
+ this.logger.info(this.i18n.t`loader.tips.update.workspace`);
452
+ return;
453
+ }
454
+ } catch {
455
+ }
456
+ }
433
457
  const { version } = this.meta;
434
458
  if (!version) return;
435
459
  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.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;
@@ -0,0 +1,5 @@
1
+ import type { Service } from '@kotori-bot/core';
2
+ export interface Browser extends Service {
3
+ page: () => Promise<any>;
4
+ }
5
+ export default Browser;
@@ -0,0 +1,25 @@
1
+ /**
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
+ */
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,21 +1,22 @@
1
1
  import { type Context, Service } from '@kotori-bot/core';
2
2
  import { Level } from 'level';
3
- type DbValue = string | number | object;
4
- declare class Database extends Service<{
3
+ type DatabaseValue = string | number | object;
4
+ interface DatabaseConfig {
5
5
  prefix: string;
6
- }> {
6
+ duration: number;
7
+ }
8
+ declare class Database extends Service<DatabaseConfig> {
9
+ private readonly usingDir;
7
10
  readonly level: Level;
8
11
  private prefixKey;
9
- constructor(ctx: Context, config: {
10
- prefix: string;
11
- });
12
- start(): void;
12
+ constructor(ctx: Context, config: DatabaseConfig);
13
+ start(): Promise<void>;
13
14
  stop(): void;
14
- get<T extends DbValue | null = DbValue | null>(key: string, init?: Exclude<T, null>): Promise<T>;
15
- getMany<T extends DbValue = DbValue>(keys: string[]): Promise<T[]>;
16
- put<T extends DbValue>(key: string, value: T): Promise<void>;
15
+ get<T extends DatabaseValue | null = DatabaseValue | null>(key: string, init?: Exclude<T, null>): Promise<T>;
16
+ getMany<T extends DatabaseValue = DatabaseValue>(keys: string[]): Promise<T[]>;
17
+ put<T extends DatabaseValue>(key: string, value: T): Promise<void>;
17
18
  del(key: string): Promise<void>;
18
- batch<T extends DbValue>(operations: Array<{
19
+ batch<T extends DatabaseValue>(operations: Array<{
19
20
  type: 'put';
20
21
  key: string;
21
22
  value: T;