llonebot-dist 7.11.3 → 7.12.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 (43) hide show
  1. package/llbot.js +25478 -22920
  2. package/llbot.js.map +1 -1
  3. package/node_modules/file-type/package.json +2 -1
  4. package/node_modules/file-type/source/index.js +7 -2
  5. package/node_modules/reggol/lib/browser.d.ts +1 -0
  6. package/node_modules/reggol/lib/browser.js +255 -0
  7. package/node_modules/reggol/lib/node.d.ts +1 -0
  8. package/node_modules/reggol/lib/node.js +251 -27
  9. package/node_modules/reggol/lib/shared.d.ts +78 -0
  10. package/node_modules/reggol/package.json +10 -14
  11. package/node_modules/supports-color/browser.d.ts +1 -0
  12. package/node_modules/supports-color/browser.js +25 -14
  13. package/node_modules/supports-color/index.d.ts +55 -0
  14. package/node_modules/supports-color/index.js +88 -38
  15. package/node_modules/supports-color/package.json +21 -15
  16. package/node_modules/supports-color/readme.md +20 -22
  17. package/package.json +1 -1
  18. package/webui/assets/index-As4y32b7.js +37 -0
  19. package/webui/assets/index-CW4srXaj.css +2 -0
  20. package/webui/index.html +2 -2
  21. package//346/233/264/346/226/260/346/227/245/345/277/227.txt +19 -0
  22. package/default_config.json +0 -85
  23. package/node_modules/@minatojs/sql.js/LICENSE +0 -44
  24. package/node_modules/@minatojs/sql.js/README.md +0 -357
  25. package/node_modules/@minatojs/sql.js/dist/sql-wasm.d.ts +0 -316
  26. package/node_modules/@minatojs/sql.js/dist/sql-wasm.js +0 -225
  27. package/node_modules/@minatojs/sql.js/dist/sql-wasm.wasm +0 -0
  28. package/node_modules/@minatojs/sql.js/package.json +0 -58
  29. package/node_modules/has-flag/index.d.ts +0 -39
  30. package/node_modules/has-flag/index.js +0 -8
  31. package/node_modules/has-flag/license +0 -9
  32. package/node_modules/has-flag/package.json +0 -46
  33. package/node_modules/has-flag/readme.md +0 -89
  34. package/node_modules/reggol/index.d.ts +0 -79
  35. package/node_modules/reggol/lib/browser.mjs +0 -299
  36. package/node_modules/reggol/lib/shared.js +0 -258
  37. package/node_modules/reggol/lib/shared.mjs +0 -266
  38. package/node_modules/reggol/src/browser.ts +0 -8
  39. package/node_modules/reggol/src/index.ts +0 -3
  40. package/node_modules/reggol/src/node.ts +0 -8
  41. package/node_modules/reggol/src/shared.ts +0 -249
  42. package/webui/assets/index-DEXb-chN.js +0 -37
  43. package/webui/assets/index-DsGxgscs.css +0 -2
@@ -1,79 +0,0 @@
1
- declare namespace Logger {
2
- export interface LevelConfig {
3
- base: number
4
- [K: string]: Level
5
- }
6
-
7
- export type Level = number | LevelConfig
8
- export type Function = (format: any, ...param: any[]) => void
9
- export type Type = 'success' | 'error' | 'info' | 'warn' | 'debug'
10
- export type Formatter = (this: Logger, value: any) => string
11
-
12
- export interface LabelStyle {
13
- width?: number
14
- margin?: number
15
- align?: 'left' | 'right'
16
- }
17
-
18
- export interface Record {
19
- id: number
20
- meta: Meta
21
- name: string
22
- type: Type
23
- level: number
24
- content: string
25
- timestamp: number
26
- }
27
-
28
- export interface Meta {}
29
-
30
- export interface Target {
31
- /**
32
- * - 0: no color support
33
- * - 1: 16 color support
34
- * - 2: 256 color support
35
- * - 3: truecolor support
36
- */
37
- colors?: number
38
- showDiff?: boolean
39
- showTime?: string
40
- label?: LabelStyle
41
- record?(record: Record): void
42
- print?(text: string): void
43
- levels?: LevelConfig
44
- timestamp?: number
45
- }
46
- }
47
-
48
- declare interface Logger extends Record<Logger.Type, Logger.Function> {}
49
-
50
- declare class Logger {
51
- // log levels
52
- static readonly SILENT = 0
53
- static readonly SUCCESS = 1
54
- static readonly ERROR = 1
55
- static readonly INFO = 2
56
- static readonly WARN = 2
57
- static readonly DEBUG = 3
58
-
59
- // global config
60
- static colors: number[]
61
- static instances: Record<string, Logger>
62
- static targets: Logger.Target[]
63
- static levels: Logger.LevelConfig
64
- static formatters: Record<string, Logger.Formatter>
65
-
66
- static color(code: number, value: any, decoration?: string): string
67
- static code(name: string, target: Logger.Target): number
68
-
69
- public name: string
70
- public level: number
71
-
72
- private code: number
73
-
74
- constructor(name: string, meta?: any)
75
-
76
- extend(namespace: string): Logger
77
- }
78
-
79
- export = Logger
@@ -1,299 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
- var __commonJS = (cb, mod) => function __require() {
9
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
-
28
- // src/shared.ts
29
- import { stdout } from "supports-color";
30
- import { Time } from "cosmokit";
31
- var require_shared = __commonJS({
32
- "src/shared.ts"(exports, module) {
33
- "use strict";
34
- var c16 = [6, 2, 3, 4, 5, 1];
35
- var c256 = [
36
- 20,
37
- 21,
38
- 26,
39
- 27,
40
- 32,
41
- 33,
42
- 38,
43
- 39,
44
- 40,
45
- 41,
46
- 42,
47
- 43,
48
- 44,
49
- 45,
50
- 56,
51
- 57,
52
- 62,
53
- 63,
54
- 68,
55
- 69,
56
- 74,
57
- 75,
58
- 76,
59
- 77,
60
- 78,
61
- 79,
62
- 80,
63
- 81,
64
- 92,
65
- 93,
66
- 98,
67
- 99,
68
- 112,
69
- 113,
70
- 129,
71
- 134,
72
- 135,
73
- 148,
74
- 149,
75
- 160,
76
- 161,
77
- 162,
78
- 163,
79
- 164,
80
- 165,
81
- 166,
82
- 167,
83
- 168,
84
- 169,
85
- 170,
86
- 171,
87
- 172,
88
- 173,
89
- 178,
90
- 179,
91
- 184,
92
- 185,
93
- 196,
94
- 197,
95
- 198,
96
- 199,
97
- 200,
98
- 201,
99
- 202,
100
- 203,
101
- 204,
102
- 205,
103
- 206,
104
- 207,
105
- 208,
106
- 209,
107
- 214,
108
- 215,
109
- 220,
110
- 221
111
- ];
112
- function isAggregateError(error) {
113
- return error instanceof Error && Array.isArray(error["errors"]);
114
- }
115
- __name(isAggregateError, "isAggregateError");
116
- var Logger = class _Logger {
117
- constructor(name, meta) {
118
- this.name = name;
119
- this.meta = meta;
120
- this.createMethod("success", _Logger.SUCCESS);
121
- this.createMethod("error", _Logger.ERROR);
122
- this.createMethod("info", _Logger.INFO);
123
- this.createMethod("warn", _Logger.WARN);
124
- this.createMethod("debug", _Logger.DEBUG);
125
- }
126
- static {
127
- __name(this, "Logger");
128
- }
129
- // log levels
130
- static SILENT = 0;
131
- static SUCCESS = 1;
132
- static ERROR = 1;
133
- static INFO = 2;
134
- static WARN = 2;
135
- static DEBUG = 3;
136
- // global config
137
- static id = 0;
138
- static targets = [{
139
- colors: stdout && stdout.level,
140
- print(text) {
141
- console.log(text);
142
- }
143
- }];
144
- // global registry
145
- static formatters = /* @__PURE__ */ Object.create(null);
146
- static format(name, formatter) {
147
- this.formatters[name] = formatter;
148
- }
149
- static levels = {
150
- base: 2
151
- };
152
- static color(target, code, value, decoration = "") {
153
- if (!target.colors) return "" + value;
154
- return `\x1B[3${code < 8 ? code : "8;5;" + code}${target.colors >= 2 ? decoration : ""}m${value}\x1B[0m`;
155
- }
156
- static code(name, target) {
157
- let hash = 0;
158
- for (let i = 0; i < name.length; i++) {
159
- hash = (hash << 3) - hash + name.charCodeAt(i) + 13;
160
- hash |= 0;
161
- }
162
- const colors = !target.colors ? [] : target.colors >= 2 ? c256 : c16;
163
- return colors[Math.abs(hash) % colors.length];
164
- }
165
- static render(target, record) {
166
- const prefix = `[${record.type[0].toUpperCase()}]`;
167
- const space = " ".repeat(target.label?.margin ?? 1);
168
- let indent = 3 + space.length, output = "";
169
- if (target.showTime) {
170
- indent += target.showTime.length + space.length;
171
- output += _Logger.color(target, 8, Time.template(target.showTime)) + space;
172
- }
173
- const code = _Logger.code(record.name, target);
174
- const label = _Logger.color(target, code, record.name, ";1");
175
- const padLength = (target.label?.width ?? 0) + label.length - record.name.length;
176
- if (target.label?.align === "right") {
177
- output += label.padStart(padLength) + space + prefix + space;
178
- indent += (target.label.width ?? 0) + space.length;
179
- } else {
180
- output += prefix + space + label.padEnd(padLength) + space;
181
- }
182
- output += record.content.replace(/\n/g, "\n" + " ".repeat(indent));
183
- if (target.showDiff && target.timestamp) {
184
- const diff = record.timestamp - target.timestamp;
185
- output += _Logger.color(target, code, " +" + Time.format(diff));
186
- }
187
- return output;
188
- }
189
- extend = /* @__PURE__ */ __name((namespace) => {
190
- return new _Logger(`${this.name}:${namespace}`, this.meta);
191
- }, "extend");
192
- warning = /* @__PURE__ */ __name((format, ...args) => {
193
- this.warn(format, ...args);
194
- }, "warning");
195
- createMethod(type, level) {
196
- this[type] = (...args) => {
197
- if (args.length === 1 && args[0] instanceof Error) {
198
- if (args[0].cause) {
199
- this[type](args[0].cause);
200
- } else if (isAggregateError(args[0])) {
201
- args[0].errors.forEach((error) => this[type](error));
202
- return;
203
- }
204
- }
205
- const id = ++_Logger.id;
206
- const timestamp = Date.now();
207
- for (const target of _Logger.targets) {
208
- if (this.getLevel(target) < level) continue;
209
- const content = this.format(target, ...args);
210
- const record = { id, type, level, name: this.name, meta: this.meta, content, timestamp };
211
- if (target.record) {
212
- target.record(record);
213
- } else {
214
- const { print = console.log } = target;
215
- print(_Logger.render(target, record));
216
- }
217
- target.timestamp = timestamp;
218
- }
219
- };
220
- }
221
- format(target, ...args) {
222
- if (args[0] instanceof Error) {
223
- args[0] = args[0].stack || args[0].message;
224
- args.unshift("%s");
225
- } else if (typeof args[0] !== "string") {
226
- args.unshift("%o");
227
- }
228
- let format = args.shift();
229
- format = format.replace(/%([a-zA-Z%])/g, (match, char) => {
230
- if (match === "%%") return "%";
231
- const formatter = _Logger.formatters[char];
232
- if (typeof formatter === "function") {
233
- const value = args.shift();
234
- return formatter(value, target, this);
235
- }
236
- return match;
237
- });
238
- for (let arg of args) {
239
- if (typeof arg === "object" && arg) {
240
- arg = _Logger.formatters["o"](arg, target, this);
241
- }
242
- format += " " + arg;
243
- }
244
- const { maxLength = 10240 } = target;
245
- return format.split(/\r?\n/g).map((line) => {
246
- return line.slice(0, maxLength) + (line.length > maxLength ? "..." : "");
247
- }).join("\n");
248
- }
249
- getLevel(target) {
250
- const paths = this.name.split(":");
251
- let config = target?.levels || _Logger.levels;
252
- do {
253
- config = config[paths.shift()] ?? config["base"];
254
- } while (paths.length && typeof config === "object");
255
- return config;
256
- }
257
- get level() {
258
- return this.getLevel();
259
- }
260
- set level(value) {
261
- const paths = this.name.split(":");
262
- let config = _Logger.levels;
263
- while (paths.length > 1) {
264
- const name = paths.shift();
265
- const value2 = config[name];
266
- if (typeof value2 === "object") {
267
- config = value2;
268
- } else {
269
- config = config[name] = { base: value2 ?? config.base };
270
- }
271
- }
272
- config[paths[0]] = value;
273
- }
274
- };
275
- Logger.format("s", (value) => value);
276
- Logger.format("d", (value) => +value);
277
- Logger.format("j", (value) => JSON.stringify(value));
278
- Logger.format("c", (value, target, logger) => {
279
- return Logger.color(target, Logger.code(logger.name, target), value);
280
- });
281
- Logger.format("C", (value, target) => {
282
- return Logger.color(target, 15, value, ";1");
283
- });
284
- module.exports = Logger;
285
- }
286
- });
287
-
288
- // src/browser.ts
289
- import inspect from "object-inspect";
290
- var require_browser = __commonJS({
291
- "src/browser.ts"(exports, module) {
292
- var import_shared = __toESM(require_shared());
293
- import_shared.default.format("o", (value, target) => {
294
- return inspect(value, { depth: Infinity }).replace(/\s*\n\s*/g, " ");
295
- });
296
- module.exports = import_shared.default;
297
- }
298
- });
299
- export default require_browser();
@@ -1,258 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
-
5
- // src/shared.ts
6
- var import_supports_color = require("supports-color");
7
- var import_cosmokit = require("cosmokit");
8
- var c16 = [6, 2, 3, 4, 5, 1];
9
- var c256 = [
10
- 20,
11
- 21,
12
- 26,
13
- 27,
14
- 32,
15
- 33,
16
- 38,
17
- 39,
18
- 40,
19
- 41,
20
- 42,
21
- 43,
22
- 44,
23
- 45,
24
- 56,
25
- 57,
26
- 62,
27
- 63,
28
- 68,
29
- 69,
30
- 74,
31
- 75,
32
- 76,
33
- 77,
34
- 78,
35
- 79,
36
- 80,
37
- 81,
38
- 92,
39
- 93,
40
- 98,
41
- 99,
42
- 112,
43
- 113,
44
- 129,
45
- 134,
46
- 135,
47
- 148,
48
- 149,
49
- 160,
50
- 161,
51
- 162,
52
- 163,
53
- 164,
54
- 165,
55
- 166,
56
- 167,
57
- 168,
58
- 169,
59
- 170,
60
- 171,
61
- 172,
62
- 173,
63
- 178,
64
- 179,
65
- 184,
66
- 185,
67
- 196,
68
- 197,
69
- 198,
70
- 199,
71
- 200,
72
- 201,
73
- 202,
74
- 203,
75
- 204,
76
- 205,
77
- 206,
78
- 207,
79
- 208,
80
- 209,
81
- 214,
82
- 215,
83
- 220,
84
- 221
85
- ];
86
- function isAggregateError(error) {
87
- return error instanceof Error && Array.isArray(error["errors"]);
88
- }
89
- __name(isAggregateError, "isAggregateError");
90
- var Logger = class _Logger {
91
- constructor(name, meta) {
92
- this.name = name;
93
- this.meta = meta;
94
- this.createMethod("success", _Logger.SUCCESS);
95
- this.createMethod("error", _Logger.ERROR);
96
- this.createMethod("info", _Logger.INFO);
97
- this.createMethod("warn", _Logger.WARN);
98
- this.createMethod("debug", _Logger.DEBUG);
99
- }
100
- static {
101
- __name(this, "Logger");
102
- }
103
- // log levels
104
- static SILENT = 0;
105
- static SUCCESS = 1;
106
- static ERROR = 1;
107
- static INFO = 2;
108
- static WARN = 2;
109
- static DEBUG = 3;
110
- // global config
111
- static id = 0;
112
- static targets = [{
113
- colors: import_supports_color.stdout && import_supports_color.stdout.level,
114
- print(text) {
115
- console.log(text);
116
- }
117
- }];
118
- // global registry
119
- static formatters = /* @__PURE__ */ Object.create(null);
120
- static format(name, formatter) {
121
- this.formatters[name] = formatter;
122
- }
123
- static levels = {
124
- base: 2
125
- };
126
- static color(target, code, value, decoration = "") {
127
- if (!target.colors) return "" + value;
128
- return `\x1B[3${code < 8 ? code : "8;5;" + code}${target.colors >= 2 ? decoration : ""}m${value}\x1B[0m`;
129
- }
130
- static code(name, target) {
131
- let hash = 0;
132
- for (let i = 0; i < name.length; i++) {
133
- hash = (hash << 3) - hash + name.charCodeAt(i) + 13;
134
- hash |= 0;
135
- }
136
- const colors = !target.colors ? [] : target.colors >= 2 ? c256 : c16;
137
- return colors[Math.abs(hash) % colors.length];
138
- }
139
- static render(target, record) {
140
- const prefix = `[${record.type[0].toUpperCase()}]`;
141
- const space = " ".repeat(target.label?.margin ?? 1);
142
- let indent = 3 + space.length, output = "";
143
- if (target.showTime) {
144
- indent += target.showTime.length + space.length;
145
- output += _Logger.color(target, 8, import_cosmokit.Time.template(target.showTime)) + space;
146
- }
147
- const code = _Logger.code(record.name, target);
148
- const label = _Logger.color(target, code, record.name, ";1");
149
- const padLength = (target.label?.width ?? 0) + label.length - record.name.length;
150
- if (target.label?.align === "right") {
151
- output += label.padStart(padLength) + space + prefix + space;
152
- indent += (target.label.width ?? 0) + space.length;
153
- } else {
154
- output += prefix + space + label.padEnd(padLength) + space;
155
- }
156
- output += record.content.replace(/\n/g, "\n" + " ".repeat(indent));
157
- if (target.showDiff && target.timestamp) {
158
- const diff = record.timestamp - target.timestamp;
159
- output += _Logger.color(target, code, " +" + import_cosmokit.Time.format(diff));
160
- }
161
- return output;
162
- }
163
- extend = /* @__PURE__ */ __name((namespace) => {
164
- return new _Logger(`${this.name}:${namespace}`, this.meta);
165
- }, "extend");
166
- warning = /* @__PURE__ */ __name((format, ...args) => {
167
- this.warn(format, ...args);
168
- }, "warning");
169
- createMethod(type, level) {
170
- this[type] = (...args) => {
171
- if (args.length === 1 && args[0] instanceof Error) {
172
- if (args[0].cause) {
173
- this[type](args[0].cause);
174
- } else if (isAggregateError(args[0])) {
175
- args[0].errors.forEach((error) => this[type](error));
176
- return;
177
- }
178
- }
179
- const id = ++_Logger.id;
180
- const timestamp = Date.now();
181
- for (const target of _Logger.targets) {
182
- if (this.getLevel(target) < level) continue;
183
- const content = this.format(target, ...args);
184
- const record = { id, type, level, name: this.name, meta: this.meta, content, timestamp };
185
- if (target.record) {
186
- target.record(record);
187
- } else {
188
- const { print = console.log } = target;
189
- print(_Logger.render(target, record));
190
- }
191
- target.timestamp = timestamp;
192
- }
193
- };
194
- }
195
- format(target, ...args) {
196
- if (args[0] instanceof Error) {
197
- args[0] = args[0].stack || args[0].message;
198
- args.unshift("%s");
199
- } else if (typeof args[0] !== "string") {
200
- args.unshift("%o");
201
- }
202
- let format = args.shift();
203
- format = format.replace(/%([a-zA-Z%])/g, (match, char) => {
204
- if (match === "%%") return "%";
205
- const formatter = _Logger.formatters[char];
206
- if (typeof formatter === "function") {
207
- const value = args.shift();
208
- return formatter(value, target, this);
209
- }
210
- return match;
211
- });
212
- for (let arg of args) {
213
- if (typeof arg === "object" && arg) {
214
- arg = _Logger.formatters["o"](arg, target, this);
215
- }
216
- format += " " + arg;
217
- }
218
- const { maxLength = 10240 } = target;
219
- return format.split(/\r?\n/g).map((line) => {
220
- return line.slice(0, maxLength) + (line.length > maxLength ? "..." : "");
221
- }).join("\n");
222
- }
223
- getLevel(target) {
224
- const paths = this.name.split(":");
225
- let config = target?.levels || _Logger.levels;
226
- do {
227
- config = config[paths.shift()] ?? config["base"];
228
- } while (paths.length && typeof config === "object");
229
- return config;
230
- }
231
- get level() {
232
- return this.getLevel();
233
- }
234
- set level(value) {
235
- const paths = this.name.split(":");
236
- let config = _Logger.levels;
237
- while (paths.length > 1) {
238
- const name = paths.shift();
239
- const value2 = config[name];
240
- if (typeof value2 === "object") {
241
- config = value2;
242
- } else {
243
- config = config[name] = { base: value2 ?? config.base };
244
- }
245
- }
246
- config[paths[0]] = value;
247
- }
248
- };
249
- Logger.format("s", (value) => value);
250
- Logger.format("d", (value) => +value);
251
- Logger.format("j", (value) => JSON.stringify(value));
252
- Logger.format("c", (value, target, logger) => {
253
- return Logger.color(target, Logger.code(logger.name, target), value);
254
- });
255
- Logger.format("C", (value, target) => {
256
- return Logger.color(target, 15, value, ";1");
257
- });
258
- module.exports = Logger;