@kotori-bot/core 1.4.1 → 1.5.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.
Files changed (63) hide show
  1. package/lib/components/config.js +109 -35
  2. package/lib/components/core.d.ts +2 -0
  3. package/lib/components/core.js +842 -30
  4. package/lib/components/index.js +858 -17
  5. package/lib/components/message.d.ts +9 -2
  6. package/lib/components/message.js +832 -125
  7. package/lib/global/constants.js +66 -17
  8. package/lib/global/index.js +81 -16
  9. package/lib/global/symbols.d.ts +2 -0
  10. package/lib/global/symbols.js +50 -11
  11. package/lib/index.js +871 -35
  12. package/lib/service/adapter.d.ts +2 -5
  13. package/lib/service/adapter.js +826 -125
  14. package/lib/service/api.js +81 -44
  15. package/lib/service/cache.js +68 -33
  16. package/lib/service/elements.js +74 -38
  17. package/lib/service/index.js +850 -19
  18. package/lib/types/adapter.js +28 -1
  19. package/lib/types/config.js +28 -1
  20. package/lib/types/index.js +73 -17
  21. package/lib/types/message.d.ts +19 -6
  22. package/lib/types/message.js +70 -14
  23. package/lib/utils/command.d.ts +18 -10
  24. package/lib/utils/command.js +253 -204
  25. package/lib/utils/commandError.js +75 -12
  26. package/lib/utils/container.js +60 -20
  27. package/lib/utils/error.js +68 -28
  28. package/lib/utils/factory.d.ts +11 -3
  29. package/lib/utils/factory.js +846 -36
  30. package/lib/utils/jsxFactory.js +28 -1
  31. package/package.json +5 -7
  32. package/lib/components/modules.d.ts +0 -12
  33. package/lib/components/modules.js +0 -127
  34. package/lib/constants.d.ts +0 -15
  35. package/lib/constants.js +0 -19
  36. package/lib/consts.d.ts +0 -15
  37. package/lib/consts.js +0 -19
  38. package/lib/context/context.d.ts +0 -36
  39. package/lib/context/context.js +0 -115
  40. package/lib/context/events.d.ts +0 -18
  41. package/lib/context/events.js +0 -2
  42. package/lib/context/index.d.ts +0 -5
  43. package/lib/context/index.js +0 -21
  44. package/lib/context/modules.d.ts +0 -39
  45. package/lib/context/modules.js +0 -65
  46. package/lib/context/service.d.ts +0 -16
  47. package/lib/context/service.js +0 -22
  48. package/lib/context/symbols.d.ts +0 -12
  49. package/lib/context/symbols.js +0 -18
  50. package/lib/context/test.d.ts +0 -6
  51. package/lib/context/test.js +0 -12
  52. package/lib/global/tokens.d.ts +0 -8
  53. package/lib/global/tokens.js +0 -12
  54. package/lib/service/service.d.ts +0 -16
  55. package/lib/service/service.js +0 -22
  56. package/lib/types/core.d.ts +0 -7
  57. package/lib/types/core.js +0 -2
  58. package/lib/types/modules.d.ts +0 -39
  59. package/lib/types/modules.js +0 -2
  60. package/lib/types/service.d.ts +0 -23
  61. package/lib/types/service.js +0 -2
  62. package/lib/utils/errror.d.ts +0 -24
  63. package/lib/utils/errror.js +0 -29
@@ -1,212 +1,261 @@
1
+
2
+ /**
3
+ * @Package @kotori-bot/core
4
+ * @Version 1.4.2-beta.1
5
+ * @Author Hotaru <biyuehuya@gmail.com>
6
+ * @Copyright 2024 Hotaru. All rights reserved.
7
+ * @License GPL-3.0
8
+ * @Link https://github.com/kotorijs/kotori
9
+ * @Date 2024/6/6 21:03:53
10
+ */
11
+
1
12
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ var __create = Object.create;
14
+ var __defProp = Object.defineProperty;
15
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
16
+ var __getOwnPropNames = Object.getOwnPropertyNames;
17
+ var __getProtoOf = Object.getPrototypeOf;
18
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
19
+ var __export = (target, all) => {
20
+ for (var name in all)
21
+ __defProp(target, name, { get: all[name], enumerable: true });
4
22
  };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Command = void 0;
7
- const tools_1 = require("@kotori-bot/tools");
8
- const minimist_1 = __importDefault(require("minimist"));
9
- const types_1 = require("../types");
10
- const commandError_1 = require("./commandError");
11
- const requiredParamMatch = /<(\.\.\.)?(.*?)(:(.*?))?(=(.*?))?>/;
12
- const optionalParamMatch = /\[(\.\.\.)?(.*?)(:(.*?))?(=(.*?))?\]/;
13
- const defaultType = 'string';
23
+ var __copyProps = (to, from, except, desc) => {
24
+ if (from && typeof from === "object" || typeof from === "function") {
25
+ for (let key of __getOwnPropNames(from))
26
+ if (!__hasOwnProp.call(to, key) && key !== except)
27
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
28
+ }
29
+ return to;
30
+ };
31
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
32
+ // If the importer is in node compatibility mode or this is not an ESM
33
+ // file that has been converted to a CommonJS file using a Babel-
34
+ // compatible transform (i.e. "__esModule" has not been set), then set
35
+ // "default" to the CommonJS "module.exports" for node compatibility.
36
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
37
+ mod
38
+ ));
39
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
40
+
41
+ // src/utils/command.ts
42
+ var command_exports = {};
43
+ __export(command_exports, {
44
+ Command: () => Command,
45
+ default: () => command_default
46
+ });
47
+ module.exports = __toCommonJS(command_exports);
48
+ var import_tools = require("@kotori-bot/tools");
49
+ var import_minimist = __toESM(require("minimist"));
50
+
51
+ // src/types/message.ts
52
+ var import_tsukiko = __toESM(require("tsukiko"));
53
+ var commandArgTypeSignSchema = import_tsukiko.default.Union([
54
+ import_tsukiko.default.Union([import_tsukiko.default.Literal("string"), import_tsukiko.default.Literal("number")]),
55
+ import_tsukiko.default.Literal("boolean")
56
+ ]);
57
+ var eventDataTargetIdSchema = import_tsukiko.default.Union([import_tsukiko.default.Number(), import_tsukiko.default.String()]);
58
+
59
+ // src/utils/error.ts
60
+ var KotoriError = class _KotoriError extends Error {
61
+ constructor(message, extra, type = "UnknownError") {
62
+ super(message);
63
+ this.name = type;
64
+ this.extra = extra;
65
+ }
66
+ extra;
67
+ name;
68
+ extend() {
69
+ const { message: fatherMessage, name: fatherType, extra: fatherExtra } = this;
70
+ return new Proxy(_KotoriError, {
71
+ construct(Class, params) {
72
+ const args = params;
73
+ args[0] = `${fatherMessage} ${args[0]}`;
74
+ args[1] = args[1] ?? fatherExtra;
75
+ args[2] = args[2] ?? fatherType;
76
+ return new Class(...args);
77
+ }
78
+ });
79
+ }
80
+ };
81
+ var ModuleError = new KotoriError(void 0, void 0, "ModuleError").extend();
82
+ var DevError = new KotoriError(void 0, void 0, "DevError").extend();
83
+
84
+ // src/utils/commandError.ts
85
+ var CommandError = class extends KotoriError {
86
+ value;
87
+ constructor(value) {
88
+ super();
89
+ this.value = value;
90
+ }
91
+ };
92
+
93
+ // src/utils/command.ts
94
+ var requiredParamMatch = /<(\.\.\.)?(.*?)(:(.*?))?(=(.*?))?>/;
95
+ var optionalParamMatch = /\[(\.\.\.)?(.*?)(:(.*?))?(=(.*?))?\]/;
96
+ var defaultType = "string";
14
97
  function handleDefaultValue(value, type) {
15
- if (type === 'boolean')
16
- return value !== 'false' && !!value;
17
- if (type === 'number') {
18
- if (typeof value === 'number')
19
- return value;
20
- if (value === true)
21
- return 1;
22
- if (value === false)
23
- return 0;
24
- const float = parseFloat(value);
25
- const int = parseInt(value, 10);
26
- return float === int ? int : float;
27
- }
28
- return value.toString();
98
+ if (type === "boolean") return value !== "false" && !!value;
99
+ if (type === "number") {
100
+ if (typeof value === "number") return value;
101
+ if (value === true) return 1;
102
+ if (value === false) return 0;
103
+ const float = parseFloat(value);
104
+ const int = parseInt(value, 10);
105
+ return float === int ? int : float;
106
+ }
107
+ return value.toString();
29
108
  }
30
- class Command {
31
- static run(input, data) {
32
- /* find start string */
33
- let starts = '';
34
- [data.root, ...data.alias].forEach((el) => {
35
- if (starts)
36
- return;
37
- if (input.startsWith(`${el} `) || input === el)
38
- starts = el;
39
- });
40
- if (!starts)
41
- return new commandError_1.CommandError({ type: 'unknown', input });
42
- /* handle CommandOption[] to minimist.opts */
43
- const opts = {
44
- string: [],
45
- boolean: [],
46
- alias: {}
47
- };
48
- data.options.forEach((option) => {
49
- if (option.type === 'string') {
50
- opts.string.push(option.realname);
51
- }
52
- else if (option.type === 'boolean') {
53
- opts.boolean.push(option.realname);
54
- }
55
- opts.alias[option.realname] = option.name;
56
- });
57
- /* parse by minimist */
58
- const arr = (0, tools_1.parseArgs)(input.slice(starts.length).trim());
59
- if (!Array.isArray(arr))
60
- return new commandError_1.CommandError({ type: 'syntax', ...arr });
61
- const result = (0, minimist_1.default)(arr, opts);
62
- /* handle args */
63
- const args = result._;
64
- const count = {
65
- expected: data.args.filter((el) => !el.optional).length,
66
- reality: args.length
67
- };
68
- if (count.reality < count.expected)
69
- return new commandError_1.CommandError({ type: 'arg_few', ...count });
70
- count.expected = data.args.length;
71
- if ((data.args.length <= 0 || !data.args[data.args.length - 1].rest) && count.reality > count.expected)
72
- return new commandError_1.CommandError({ type: 'arg_many', ...count });
73
- let error;
74
- data.args.forEach((val, index) => {
75
- /* exit when happen error or last arg is empty */
76
- if (error || (index > 0 && !args[index - 1]))
77
- return;
78
- /* handle rest args and default value */
79
- if (!args[index] && val.default) {
80
- args[index] = val.default;
81
- return;
82
- }
83
- if (val.rest || !args[index])
84
- return;
85
- /* determine if type is valid number */
86
- args[index] = handleDefaultValue(args[index], val.type);
87
- if (!Number.isNaN(args[index]))
88
- return;
89
- error = new commandError_1.CommandError({ type: 'arg_error', expected: 'number', reality: 'string', index });
90
- });
91
- if (error)
92
- return error;
93
- /* handle options */
94
- const options = {};
95
- data.options.forEach((val) => {
96
- if (!(val.realname in result))
97
- return;
98
- options[val.realname] = Array.isArray(result[val.realname])
99
- ? result[val.realname][0]
100
- : result[val.realname];
101
- options[val.realname] = handleDefaultValue(options[val.realname], val.type);
102
- if (Number.isNaN(options[val.realname]))
103
- error = new commandError_1.CommandError({ type: 'option_error', expected: 'number', reality: 'string', target: val.realname });
104
- });
105
- if (error)
106
- return error;
107
- return {
108
- args: data.args.length > 0 && data.args[data.args.length - 1].rest ? args : args.slice(0, data.args.length),
109
- options
110
- };
111
- }
112
- template;
113
- meta = {
114
- root: '',
115
- alias: [],
116
- scope: 'all',
117
- access: 0 /* CommandAccess.MEMBER */,
118
- args: [],
119
- options: []
109
+ var Command = class {
110
+ static run(input, data) {
111
+ let starts = "";
112
+ [data.root, ...data.alias].forEach((el) => {
113
+ if (starts) return;
114
+ if (input.startsWith(`${el} `) || input === el) starts = el;
115
+ });
116
+ if (!starts) return new CommandError({ type: "unknown", input });
117
+ const opts = {
118
+ string: [],
119
+ boolean: [],
120
+ alias: {}
120
121
  };
121
- constructor(template, config) {
122
- this.template = template;
123
- this.meta = Object.assign(this.meta, config);
124
- this.parse();
125
- }
126
- parse() {
127
- const [str, description] = this.template.trim().split(' - ');
128
- this.meta.description = description; // set description
129
- /* handle root */
130
- const requiredIndex = str.indexOf(' <');
131
- const optionalIndex = str.indexOf(' [');
132
- if (requiredIndex === -1 && optionalIndex === -1) {
133
- this.meta.root = str.trim();
134
- return;
135
- }
136
- if (requiredIndex !== -1 && (optionalIndex === -1 || requiredIndex < optionalIndex)) {
137
- this.meta.root = str.substring(0, requiredIndex).trim();
138
- }
139
- else {
140
- this.meta.root = str.substring(0, optionalIndex).trim();
141
- }
142
- /* handle args */
143
- const args = (0, minimist_1.default)(str.split(' '))._;
144
- args.forEach((arg) => {
145
- const current = this.meta.args[this.meta.args.length - 1];
146
- if (current && current.rest)
147
- return;
148
- let result = optionalParamMatch.exec(arg);
149
- if (result) {
150
- if (!result[2])
151
- return;
152
- const type = types_1.commandArgTypeSignSchema.parseSafe(result[4]).value
153
- ? result[4]
154
- : defaultType;
155
- this.meta.args.push({
156
- name: result[2],
157
- type,
158
- rest: !!result[1],
159
- optional: true,
160
- default: result[6] ? handleDefaultValue(result[6], type) : undefined
161
- });
162
- }
163
- result = requiredParamMatch.exec(arg);
164
- if (!result || !result[2])
165
- return;
166
- if (!result[6] && current && current.optional)
167
- return;
168
- this.meta.args.push({
169
- name: result[2],
170
- type: types_1.commandArgTypeSignSchema.parseSafe(result[4]).value ? result[4] : defaultType,
171
- rest: !!result[1],
172
- optional: false
173
- });
174
- });
175
- }
176
- alias(alias) {
177
- if (typeof alias === 'string')
178
- this.meta.alias.push(alias);
179
- else
180
- this.meta.alias.push(...alias);
181
- return this;
182
- }
183
- scope(scope) {
184
- this.meta.scope = scope;
185
- return this;
122
+ data.options.forEach((option) => {
123
+ if (option.type === "string") {
124
+ opts.string.push(option.realname);
125
+ } else if (option.type === "boolean") {
126
+ opts.boolean.push(option.realname);
127
+ }
128
+ opts.alias[option.realname] = option.name;
129
+ });
130
+ const arr = (0, import_tools.parseArgs)(input.slice(starts.length).trim());
131
+ if (!Array.isArray(arr)) return new CommandError({ type: "syntax", ...arr });
132
+ const result = (0, import_minimist.default)(arr, opts);
133
+ const args = result._;
134
+ const count = {
135
+ expected: data.args.filter((el) => !el.optional).length,
136
+ reality: args.length
137
+ };
138
+ if (count.reality < count.expected) return new CommandError({ type: "arg_few", ...count });
139
+ count.expected = data.args.length;
140
+ if ((data.args.length <= 0 || !data.args[data.args.length - 1].rest) && count.reality > count.expected)
141
+ return new CommandError({ type: "arg_many", ...count });
142
+ let error;
143
+ data.args.forEach((val, index) => {
144
+ if (error || index > 0 && !args[index - 1]) return;
145
+ if (!args[index] && val.default) {
146
+ args[index] = val.default;
147
+ return;
148
+ }
149
+ if (val.rest || !args[index]) return;
150
+ args[index] = handleDefaultValue(args[index], val.type);
151
+ if (!Number.isNaN(args[index])) return;
152
+ error = new CommandError({ type: "arg_error", expected: "number", reality: "string", index });
153
+ });
154
+ if (error) return error;
155
+ const options = {};
156
+ data.options.forEach((val) => {
157
+ if (!(val.realname in result)) return;
158
+ options[val.realname] = Array.isArray(result[val.realname]) ? result[val.realname][0] : result[val.realname];
159
+ options[val.realname] = handleDefaultValue(options[val.realname], val.type);
160
+ if (Number.isNaN(options[val.realname]))
161
+ error = new CommandError({ type: "option_error", expected: "number", reality: "string", target: val.realname });
162
+ });
163
+ if (error) return error;
164
+ return {
165
+ args: data.args.length > 0 && data.args[data.args.length - 1].rest ? args : args.slice(0, data.args.length),
166
+ options
167
+ };
168
+ }
169
+ template;
170
+ meta = {
171
+ root: "",
172
+ alias: [],
173
+ scope: "all",
174
+ access: 0 /* MEMBER */,
175
+ args: [],
176
+ options: []
177
+ };
178
+ constructor(template, config) {
179
+ this.template = template;
180
+ this.meta = Object.assign(this.meta, config);
181
+ this.parse();
182
+ }
183
+ parse() {
184
+ const [str, description] = this.template.trim().split(" - ");
185
+ this.meta.description = description;
186
+ const requiredIndex = str.indexOf(" <");
187
+ const optionalIndex = str.indexOf(" [");
188
+ if (requiredIndex === -1 && optionalIndex === -1) {
189
+ this.meta.root = str.trim();
190
+ return;
186
191
  }
187
- access(access) {
188
- this.meta.access = access;
189
- return this;
192
+ if (requiredIndex !== -1 && (optionalIndex === -1 || requiredIndex < optionalIndex)) {
193
+ this.meta.root = str.substring(0, requiredIndex).trim();
194
+ } else {
195
+ this.meta.root = str.substring(0, optionalIndex).trim();
190
196
  }
191
- option(name, template) {
192
- const [str, description] = template.trim().split(' ');
193
- const [realname, type] = str.split(':');
194
- this.meta.options.push({
195
- realname,
196
- description,
197
- type: types_1.commandArgTypeSignSchema.parseSafe(type).value ? type : defaultType,
198
- name: name.charAt(0)
197
+ const args = (0, import_minimist.default)(str.split(" "))._;
198
+ args.forEach((arg) => {
199
+ const current = this.meta.args[this.meta.args.length - 1];
200
+ if (current && current.rest) return;
201
+ let result = optionalParamMatch.exec(arg);
202
+ if (result) {
203
+ if (!result[2]) return;
204
+ const type = commandArgTypeSignSchema.parseSafe(result[4]).value ? result[4] : defaultType;
205
+ this.meta.args.push({
206
+ name: result[2],
207
+ type,
208
+ rest: !!result[1],
209
+ optional: true,
210
+ default: result[6] ? handleDefaultValue(result[6], type) : void 0
199
211
  });
200
- return this;
201
- }
202
- action(callback) {
203
- this.meta.action = callback;
204
- return this;
205
- }
206
- help(text) {
207
- this.meta.help = text;
208
- return this;
209
- }
210
- }
211
- exports.Command = Command;
212
- exports.default = Command;
212
+ }
213
+ result = requiredParamMatch.exec(arg);
214
+ if (!result || !result[2]) return;
215
+ if (!result[6] && current && current.optional) return;
216
+ this.meta.args.push({
217
+ name: result[2],
218
+ type: commandArgTypeSignSchema.parseSafe(result[4]).value ? result[4] : defaultType,
219
+ rest: !!result[1],
220
+ optional: false
221
+ });
222
+ });
223
+ }
224
+ alias(alias) {
225
+ if (typeof alias === "string") this.meta.alias.push(alias);
226
+ else this.meta.alias.push(...alias);
227
+ return this;
228
+ }
229
+ scope(scope) {
230
+ this.meta.scope = scope;
231
+ return this;
232
+ }
233
+ access(access) {
234
+ this.meta.access = access;
235
+ return this;
236
+ }
237
+ option(name, template) {
238
+ const [str, description] = template.trim().split(" ");
239
+ const [realname, type] = str.split(":");
240
+ this.meta.options.push({
241
+ realname,
242
+ description,
243
+ type: commandArgTypeSignSchema.parseSafe(type).value ? type : defaultType,
244
+ name: name.charAt(0)
245
+ });
246
+ return this;
247
+ }
248
+ action(callback) {
249
+ this.meta.action = callback;
250
+ return this;
251
+ }
252
+ help(text) {
253
+ this.meta.help = text;
254
+ return this;
255
+ }
256
+ };
257
+ var command_default = Command;
258
+ // Annotate the CommonJS export names for ESM import in node:
259
+ 0 && (module.exports = {
260
+ Command
261
+ });
@@ -1,13 +1,76 @@
1
+
2
+ /**
3
+ * @Package @kotori-bot/core
4
+ * @Version 1.4.2-beta.1
5
+ * @Author Hotaru <biyuehuya@gmail.com>
6
+ * @Copyright 2024 Hotaru. All rights reserved.
7
+ * @License GPL-3.0
8
+ * @Link https://github.com/kotorijs/kotori
9
+ * @Date 2024/6/6 21:03:53
10
+ */
11
+
1
12
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CommandError = void 0;
4
- const error_1 = require("./error");
5
- class CommandError extends error_1.KotoriError {
6
- value;
7
- constructor(value) {
8
- super();
9
- this.value = value;
10
- }
11
- }
12
- exports.CommandError = CommandError;
13
- exports.default = CommandError;
13
+ var __defProp = Object.defineProperty;
14
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
15
+ var __getOwnPropNames = Object.getOwnPropertyNames;
16
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
17
+ var __export = (target, all) => {
18
+ for (var name in all)
19
+ __defProp(target, name, { get: all[name], enumerable: true });
20
+ };
21
+ var __copyProps = (to, from, except, desc) => {
22
+ if (from && typeof from === "object" || typeof from === "function") {
23
+ for (let key of __getOwnPropNames(from))
24
+ if (!__hasOwnProp.call(to, key) && key !== except)
25
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
26
+ }
27
+ return to;
28
+ };
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+
31
+ // src/utils/commandError.ts
32
+ var commandError_exports = {};
33
+ __export(commandError_exports, {
34
+ CommandError: () => CommandError,
35
+ default: () => commandError_default
36
+ });
37
+ module.exports = __toCommonJS(commandError_exports);
38
+
39
+ // src/utils/error.ts
40
+ var KotoriError = class _KotoriError extends Error {
41
+ constructor(message, extra, type = "UnknownError") {
42
+ super(message);
43
+ this.name = type;
44
+ this.extra = extra;
45
+ }
46
+ extra;
47
+ name;
48
+ extend() {
49
+ const { message: fatherMessage, name: fatherType, extra: fatherExtra } = this;
50
+ return new Proxy(_KotoriError, {
51
+ construct(Class, params) {
52
+ const args = params;
53
+ args[0] = `${fatherMessage} ${args[0]}`;
54
+ args[1] = args[1] ?? fatherExtra;
55
+ args[2] = args[2] ?? fatherType;
56
+ return new Class(...args);
57
+ }
58
+ });
59
+ }
60
+ };
61
+ var ModuleError = new KotoriError(void 0, void 0, "ModuleError").extend();
62
+ var DevError = new KotoriError(void 0, void 0, "DevError").extend();
63
+
64
+ // src/utils/commandError.ts
65
+ var CommandError = class extends KotoriError {
66
+ value;
67
+ constructor(value) {
68
+ super();
69
+ this.value = value;
70
+ }
71
+ };
72
+ var commandError_default = CommandError;
73
+ // Annotate the CommonJS export names for ESM import in node:
74
+ 0 && (module.exports = {
75
+ CommandError
76
+ });
@@ -1,21 +1,61 @@
1
+
2
+ /**
3
+ * @Package @kotori-bot/core
4
+ * @Version 1.4.2-beta.1
5
+ * @Author Hotaru <biyuehuya@gmail.com>
6
+ * @Copyright 2024 Hotaru. All rights reserved.
7
+ * @License GPL-3.0
8
+ * @Link https://github.com/kotorijs/kotori
9
+ * @Date 2024/6/6 21:03:53
10
+ */
11
+
1
12
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Container = void 0;
4
- const tools_1 = require("@kotori-bot/tools");
5
- class Container {
6
- constructor() {
7
- (0, tools_1.none)();
8
- }
9
- static instance = {};
10
- static setInstance(ctx) {
11
- this.instance = ctx;
12
- }
13
- static getInstance() {
14
- return this.instance;
15
- }
16
- static getMixin() {
17
- return Object.assign(Container.getInstance() /* , Context */);
18
- }
19
- }
20
- exports.Container = Container;
21
- exports.default = Container;
13
+ var __defProp = Object.defineProperty;
14
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
15
+ var __getOwnPropNames = Object.getOwnPropertyNames;
16
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
17
+ var __export = (target, all) => {
18
+ for (var name in all)
19
+ __defProp(target, name, { get: all[name], enumerable: true });
20
+ };
21
+ var __copyProps = (to, from, except, desc) => {
22
+ if (from && typeof from === "object" || typeof from === "function") {
23
+ for (let key of __getOwnPropNames(from))
24
+ if (!__hasOwnProp.call(to, key) && key !== except)
25
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
26
+ }
27
+ return to;
28
+ };
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+
31
+ // src/utils/container.ts
32
+ var container_exports = {};
33
+ __export(container_exports, {
34
+ Container: () => Container,
35
+ default: () => container_default
36
+ });
37
+ module.exports = __toCommonJS(container_exports);
38
+ var import_tools = require("@kotori-bot/tools");
39
+ var Container = class _Container {
40
+ constructor() {
41
+ (0, import_tools.none)();
42
+ }
43
+ static instance = {};
44
+ static setInstance(ctx) {
45
+ this.instance = ctx;
46
+ }
47
+ static getInstance() {
48
+ return this.instance;
49
+ }
50
+ static getMixin() {
51
+ return Object.assign(
52
+ _Container.getInstance()
53
+ /* , Context */
54
+ );
55
+ }
56
+ };
57
+ var container_default = Container;
58
+ // Annotate the CommonJS export names for ESM import in node:
59
+ 0 && (module.exports = {
60
+ Container
61
+ });