@open-discord-bots/framework 0.2.11 → 0.2.13

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 (107) hide show
  1. package/dist/api/index.d.ts +26 -26
  2. package/dist/api/index.js +26 -42
  3. package/dist/api/main.d.ts +24 -24
  4. package/dist/api/main.js +7 -11
  5. package/dist/api/modules/action.d.ts +12 -12
  6. package/dist/api/modules/action.js +11 -17
  7. package/dist/api/modules/base.d.ts +7 -5
  8. package/dist/api/modules/base.js +22 -67
  9. package/dist/api/modules/builder.d.ts +44 -44
  10. package/dist/api/modules/builder.js +81 -142
  11. package/dist/api/modules/checker.d.ts +7 -7
  12. package/dist/api/modules/checker.js +55 -87
  13. package/dist/api/modules/client.d.ts +4 -4
  14. package/dist/api/modules/client.js +71 -118
  15. package/dist/api/modules/code.d.ts +2 -2
  16. package/dist/api/modules/code.js +3 -8
  17. package/dist/api/modules/config.d.ts +2 -2
  18. package/dist/api/modules/config.js +21 -63
  19. package/dist/api/modules/console.d.ts +16 -16
  20. package/dist/api/modules/console.js +61 -83
  21. package/dist/api/modules/cooldown.d.ts +2 -2
  22. package/dist/api/modules/cooldown.js +13 -23
  23. package/dist/api/modules/database.d.ts +2 -2
  24. package/dist/api/modules/database.js +19 -29
  25. package/dist/api/modules/event.d.ts +2 -2
  26. package/dist/api/modules/event.js +6 -11
  27. package/dist/api/modules/flag.d.ts +2 -2
  28. package/dist/api/modules/flag.js +3 -8
  29. package/dist/api/modules/fuse.js +2 -7
  30. package/dist/api/modules/helpmenu.d.ts +2 -2
  31. package/dist/api/modules/helpmenu.js +8 -16
  32. package/dist/api/modules/language.d.ts +2 -2
  33. package/dist/api/modules/language.js +12 -21
  34. package/dist/api/modules/permission.d.ts +3 -3
  35. package/dist/api/modules/permission.js +9 -47
  36. package/dist/api/modules/plugin.d.ts +2 -2
  37. package/dist/api/modules/plugin.js +9 -18
  38. package/dist/api/modules/post.d.ts +3 -3
  39. package/dist/api/modules/post.js +3 -8
  40. package/dist/api/modules/progressbar.d.ts +2 -2
  41. package/dist/api/modules/progressbar.js +14 -26
  42. package/dist/api/modules/responder.d.ts +42 -42
  43. package/dist/api/modules/responder.js +79 -138
  44. package/dist/api/modules/session.d.ts +2 -2
  45. package/dist/api/modules/session.js +4 -42
  46. package/dist/api/modules/startscreen.d.ts +4 -4
  47. package/dist/api/modules/startscreen.js +28 -44
  48. package/dist/api/modules/statistic.d.ts +3 -3
  49. package/dist/api/modules/statistic.js +11 -22
  50. package/dist/api/modules/verifybar.d.ts +5 -5
  51. package/dist/api/modules/verifybar.js +6 -11
  52. package/dist/api/modules/worker.d.ts +15 -15
  53. package/dist/api/modules/worker.js +12 -17
  54. package/dist/cli/editConfig.d.ts +2 -2
  55. package/dist/cli/editConfig.js +194 -248
  56. package/dist/cli/index.d.ts +2 -2
  57. package/dist/cli/index.js +37 -62
  58. package/dist/index.d.ts +4 -4
  59. package/dist/index.js +6 -13
  60. package/dist/startup/compilation.d.ts +1 -1
  61. package/dist/startup/compilation.js +35 -42
  62. package/dist/startup/dump.d.ts +1 -1
  63. package/dist/startup/dump.js +4 -41
  64. package/dist/startup/errorHandling.d.ts +1 -1
  65. package/dist/startup/errorHandling.js +2 -38
  66. package/dist/startup/pluginLauncher.d.ts +1 -1
  67. package/dist/startup/pluginLauncher.js +14 -52
  68. package/dist/utilities/index.d.ts +3 -3
  69. package/dist/utilities/index.js +20 -71
  70. package/package.json +5 -4
  71. package/src/api/index.ts +26 -26
  72. package/src/api/main.ts +25 -25
  73. package/src/api/modules/action.ts +13 -13
  74. package/src/api/modules/base.ts +14 -10
  75. package/src/api/modules/builder.ts +56 -56
  76. package/src/api/modules/checker.ts +7 -7
  77. package/src/api/modules/client.ts +18 -18
  78. package/src/api/modules/code.ts +2 -2
  79. package/src/api/modules/component.txt +350 -0
  80. package/src/api/modules/config.ts +3 -3
  81. package/src/api/modules/console.ts +28 -28
  82. package/src/api/modules/cooldown.ts +2 -2
  83. package/src/api/modules/database.ts +3 -3
  84. package/src/api/modules/event.ts +5 -5
  85. package/src/api/modules/flag.ts +2 -2
  86. package/src/api/modules/helpmenu.ts +4 -4
  87. package/src/api/modules/language.ts +3 -3
  88. package/src/api/modules/permission.ts +3 -3
  89. package/src/api/modules/plugin.ts +4 -4
  90. package/src/api/modules/post.ts +3 -3
  91. package/src/api/modules/progressbar.ts +5 -3
  92. package/src/api/modules/responder.ts +48 -48
  93. package/src/api/modules/session.ts +2 -2
  94. package/src/api/modules/startscreen.ts +4 -4
  95. package/src/api/modules/statistic.ts +3 -4
  96. package/src/api/modules/verifybar.ts +5 -5
  97. package/src/api/modules/worker.ts +25 -25
  98. package/src/cli/editConfig.ts +23 -37
  99. package/src/cli/index.ts +3 -3
  100. package/src/index.ts +5 -5
  101. package/src/startup/compilation.ts +2 -2
  102. package/src/startup/dump.ts +2 -2
  103. package/src/startup/errorHandling.ts +2 -2
  104. package/src/startup/pluginLauncher.ts +11 -8
  105. package/src/utilities/index.ts +4 -4
  106. package/tools/cleanup.js +1 -1
  107. package/tsconfig.json +2 -1
@@ -1,23 +1,17 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ODLiveStatusRenderer = exports.ODLiveStatusManager = exports.ODLiveStatusUrlSource = exports.ODLiveStatusFileSource = exports.ODLiveStatusSource = exports.ODDebugger = exports.ODDebugFileManager = exports.ODConsoleManager = exports.ODError = exports.ODConsoleErrorMessage = exports.ODConsoleWarningMessage = exports.ODConsoleDebugMessage = exports.ODConsolePluginMessage = exports.ODConsoleSystemMessage = exports.ODConsoleInfoMessage = exports.ODConsoleMessage = void 0;
7
1
  ///////////////////////////////////////
8
2
  //CONSOLE MODULE
9
3
  ///////////////////////////////////////
10
- const base_1 = require("./base");
11
- const path_1 = __importDefault(require("path"));
12
- const fs_1 = __importDefault(require("fs"));
13
- const ansis_1 = __importDefault(require("ansis"));
4
+ import { ODHTTPGetRequest, ODSystemError, ODManager, ODManagerData } from "./base.js";
5
+ import nodepath from "path";
6
+ import fs from "fs";
7
+ import ansis from "ansis";
14
8
  /**## ODConsoleMessage `class`
15
9
  * This is an Open Discord console message.
16
10
  *
17
11
  * It is used to create beautiful & styled logs in the console with a prefix, message & parameters.
18
12
  * It also has full color support using `ansis` and parameters are parsed for you!
19
13
  */
20
- class ODConsoleMessage {
14
+ export class ODConsoleMessage {
21
15
  /**The main message sent in the console */
22
16
  message;
23
17
  /**An array of all the parameters in this message */
@@ -40,7 +34,7 @@ class ODConsoleMessage {
40
34
  /**Render this message to the console using `console.log`! Returns `false` when something went wrong. */
41
35
  render() {
42
36
  try {
43
- const prefixcolor = ansis_1.default[this.color];
37
+ const prefixcolor = ansis[this.color];
44
38
  const paramsstring = " " + this.createParamsString("gray");
45
39
  const message = prefixcolor("[" + this.prefix + "] ") + this.message;
46
40
  console.log(message + paramsstring);
@@ -72,7 +66,7 @@ class ODConsoleMessage {
72
66
  if (!p.hidden)
73
67
  pstrings.push(p.key + ": " + p.value);
74
68
  });
75
- return (pstrings.length > 0) ? ansis_1.default[validcolor](" (" + pstrings.join(", ") + ")") : "";
69
+ return (pstrings.length > 0) ? ansis[validcolor](" (" + pstrings.join(", ") + ")") : "";
76
70
  }
77
71
  /**Set the message */
78
72
  setMessage(message) {
@@ -100,79 +94,72 @@ class ODConsoleMessage {
100
94
  return this;
101
95
  }
102
96
  }
103
- exports.ODConsoleMessage = ODConsoleMessage;
104
- /**## ODConsoleInfoMessage `class`
97
+ /**## ODInfoConsoleMessage `class`
105
98
  * This is an Open Discord console info message.
106
99
  *
107
100
  * It is the same as a normal `ODConsoleMessage`, but it has a predefined prefix & color scheme for the "INFO" messages!
108
101
  */
109
- class ODConsoleInfoMessage extends ODConsoleMessage {
102
+ export class ODInfoConsoleMessage extends ODConsoleMessage {
110
103
  constructor(message, params) {
111
104
  super(message, "INFO", "blue", params);
112
105
  }
113
106
  }
114
- exports.ODConsoleInfoMessage = ODConsoleInfoMessage;
115
- /**## ODConsoleSystemMessage `class`
107
+ /**## ODSystemConsoleMessage `class`
116
108
  * This is an Open Discord console system message.
117
109
  *
118
110
  * It is the same as a normal `ODConsoleMessage`, but it has a predefined prefix & color scheme for the "SYSTEM" messages!
119
111
  */
120
- class ODConsoleSystemMessage extends ODConsoleMessage {
112
+ export class ODSystemConsoleMessage extends ODConsoleMessage {
121
113
  constructor(message, params) {
122
114
  super(message, "SYSTEM", "green", params);
123
115
  }
124
116
  }
125
- exports.ODConsoleSystemMessage = ODConsoleSystemMessage;
126
- /**## ODConsolePluginMessage `class`
117
+ /**## ODPluginConsoleMessage `class`
127
118
  * This is an Open Discord console plugin message.
128
119
  *
129
120
  * It is the same as a normal `ODConsoleMessage`, but it has a predefined prefix & color scheme for the "PLUGIN" messages!
130
121
  */
131
- class ODConsolePluginMessage extends ODConsoleMessage {
122
+ export class ODPluginConsoleMessage extends ODConsoleMessage {
132
123
  constructor(message, params) {
133
124
  super(message, "PLUGIN", "magenta", params);
134
125
  }
135
126
  }
136
- exports.ODConsolePluginMessage = ODConsolePluginMessage;
137
- /**## ODConsoleDebugMessage `class`
127
+ /**## ODDebugConsoleMessage `class`
138
128
  * This is an Open Discord console debug message.
139
129
  *
140
130
  * It is the same as a normal `ODConsoleMessage`, but it has a predefined prefix & color scheme for the "DEBUG" messages!
141
131
  */
142
- class ODConsoleDebugMessage extends ODConsoleMessage {
132
+ export class ODDebugConsoleMessage extends ODConsoleMessage {
143
133
  constructor(message, params) {
144
134
  super(message, "DEBUG", "cyan", params);
145
135
  }
146
136
  }
147
- exports.ODConsoleDebugMessage = ODConsoleDebugMessage;
148
- /**## ODConsoleWarningMessage `class`
137
+ /**## ODWarningConsoleMessage `class`
149
138
  * This is an Open Discord console warning message.
150
139
  *
151
140
  * It is the same as a normal `ODConsoleMessage`, but it has a predefined prefix & color scheme for the "WARNING" messages!
152
141
  */
153
- class ODConsoleWarningMessage extends ODConsoleMessage {
142
+ export class ODWarningConsoleMessage extends ODConsoleMessage {
154
143
  constructor(message, params) {
155
144
  super(message, "WARNING", "yellow", params);
156
145
  }
157
146
  }
158
- exports.ODConsoleWarningMessage = ODConsoleWarningMessage;
159
- /**## ODConsoleErrorMessage `class`
147
+ /**## ODErrorConsoleMessage `class`
160
148
  * This is an Open Discord console error message.
161
149
  *
162
150
  * It is the same as a normal `ODConsoleMessage`, but it has a predefined prefix & color scheme for the "ERROR" messages!
163
151
  */
164
- class ODConsoleErrorMessage extends ODConsoleMessage {
152
+ export class ODErrorConsoleMessage extends ODConsoleMessage {
165
153
  constructor(message, params) {
166
154
  super(message, "ERROR", "red", params);
167
155
  }
168
156
  }
169
- exports.ODConsoleErrorMessage = ODConsoleErrorMessage;
170
157
  /**## ODError `class`
171
158
  * This is an Open Discord error.
172
159
  *
173
160
  * It is used to render and log Node.js errors & crashes in a styled way to the console & `debug.txt` file!
174
161
  */
175
- class ODError {
162
+ export class ODError {
176
163
  /**The original error that this class wraps around */
177
164
  error;
178
165
  /**The origin of the original error */
@@ -184,18 +171,18 @@ class ODError {
184
171
  /**Render this error to the console using `console.log`! Returns `false` when something went wrong. */
185
172
  render() {
186
173
  try {
187
- let prefix = (this.error["_ODErrorType"] == "plugin") ? "PLUGIN ERROR" : ((this.error["_ODErrorType"] == "system") ? "OPENTICKET ERROR" : "UNKNOWN ERROR");
174
+ let prefix = (this.error["_ODErrorType"] && this.error["_ODErrorType"] == "plugin") ? "PLUGIN ERROR" : ((this.error["_ODErrorType"] == "system") ? "OPENTICKET ERROR" : "UNKNOWN ERROR");
188
175
  //title
189
- console.log(ansis_1.default.red("[" + prefix + "]: ") + this.error.message + " | origin: " + this.origin);
176
+ console.log(ansis.red("[" + prefix + "]: ") + this.error.message + " | origin: " + this.origin);
190
177
  //stack trace
191
178
  if (this.error.stack)
192
- console.log(ansis_1.default.gray(this.error.stack));
179
+ console.log(ansis.gray(this.error.stack));
193
180
  //additional message
194
181
  if (this.error["_ODErrorType"] == "plugin")
195
- console.log(ansis_1.default.red.bold("\nPlease report this error to the plugin developer and help us create a more stable plugin!"));
182
+ console.log(ansis.red.bold("\nPlease report this error to the plugin developer and help us create a more stable plugin!"));
196
183
  else
197
- console.log(ansis_1.default.red.bold("\nPlease report this error to our discord server and help us create a more stable bot!"));
198
- console.log(ansis_1.default.red("Also send the " + ansis_1.default.cyan.bold("debug.txt") + " file! It would help a lot!\n"));
184
+ console.log(ansis.red.bold("\nPlease report this error to our discord server and help us create a more stable bot!"));
185
+ console.log(ansis.red("Also send the " + ansis.cyan.bold("debug.txt") + " file! It would help a lot!\n"));
199
186
  return true;
200
187
  }
201
188
  catch {
@@ -207,7 +194,6 @@ class ODError {
207
194
  return "[UNKNOWN OD ERROR]: " + this.error.message + " | origin: " + this.origin + "\n" + this.error.stack;
208
195
  }
209
196
  }
210
- exports.ODError = ODError;
211
197
  /**## ODConsoleManager `class`
212
198
  * This is the Open Discord console manager.
213
199
  *
@@ -216,7 +202,7 @@ exports.ODError = ODError;
216
202
  *
217
203
  * The debug file (`debug.txt`) is handled in a sub-manager!
218
204
  */
219
- class ODConsoleManager {
205
+ export class ODConsoleManager {
220
206
  /**The history of `ODConsoleMessage`'s and `ODError`'s since startup */
221
207
  history = [];
222
208
  /**The max length of the history. The oldest messages will be removed when over the limit */
@@ -247,19 +233,19 @@ class ODConsoleManager {
247
233
  else if (["string", "number", "boolean", "object"].includes(typeof message)) {
248
234
  let newMessage;
249
235
  if (type == "info")
250
- newMessage = new ODConsoleInfoMessage(message, params);
236
+ newMessage = new ODInfoConsoleMessage(message, params);
251
237
  else if (type == "system")
252
- newMessage = new ODConsoleSystemMessage(message, params);
238
+ newMessage = new ODSystemConsoleMessage(message, params);
253
239
  else if (type == "plugin")
254
- newMessage = new ODConsolePluginMessage(message, params);
240
+ newMessage = new ODPluginConsoleMessage(message, params);
255
241
  else if (type == "debug")
256
- newMessage = new ODConsoleDebugMessage(message, params);
242
+ newMessage = new ODDebugConsoleMessage(message, params);
257
243
  else if (type == "warning")
258
- newMessage = new ODConsoleWarningMessage(message, params);
244
+ newMessage = new ODWarningConsoleMessage(message, params);
259
245
  else if (type == "error")
260
- newMessage = new ODConsoleErrorMessage(message, params);
246
+ newMessage = new ODErrorConsoleMessage(message, params);
261
247
  else
262
- newMessage = new ODConsoleSystemMessage(message, params);
248
+ newMessage = new ODSystemConsoleMessage(message, params);
263
249
  if (!this.silent)
264
250
  newMessage.render();
265
251
  if (this.debugfile)
@@ -274,7 +260,6 @@ class ODConsoleManager {
274
260
  this.history.shift();
275
261
  }
276
262
  }
277
- exports.ODConsoleManager = ODConsoleManager;
278
263
  /**## ODDebugFileManager `class`
279
264
  * This is the Open Discord debug file manager.
280
265
  *
@@ -283,7 +268,7 @@ exports.ODConsoleManager = ODConsoleManager;
283
268
  *
284
269
  * Using this class, you can change the max length of this file and some other cool things!
285
270
  */
286
- class ODDebugFileManager {
271
+ export class ODDebugFileManager {
287
272
  /**The path to the debugfile (`./debug.txt` by default) */
288
273
  path;
289
274
  /**The filename of the debugfile (`debug.txt` by default) */
@@ -293,7 +278,7 @@ class ODDebugFileManager {
293
278
  /**The max length of the debug file. */
294
279
  maxlines;
295
280
  constructor(path, filename, maxlines, version) {
296
- this.path = path_1.default.join(path, filename);
281
+ this.path = nodepath.join(path, filename);
297
282
  this.filename = filename;
298
283
  this.version = version;
299
284
  this.maxlines = maxlines;
@@ -301,13 +286,13 @@ class ODDebugFileManager {
301
286
  }
302
287
  /**Check if the debug file exists */
303
288
  #existsDebugFile() {
304
- return fs_1.default.existsSync(this.path);
289
+ return fs.existsSync(this.path);
305
290
  }
306
291
  /**Read from the debug file */
307
292
  #readDebugFile() {
308
293
  if (this.#existsDebugFile()) {
309
294
  try {
310
- return fs_1.default.readFileSync(this.path).toString();
295
+ return fs.readFileSync(this.path).toString();
311
296
  }
312
297
  catch {
313
298
  return false;
@@ -326,12 +311,12 @@ class ODDebugFileManager {
326
311
  splitted.splice(7, (text.split("\n").length));
327
312
  }
328
313
  splitted.push(text);
329
- fs_1.default.writeFileSync(this.path, splitted.join("\n"));
314
+ fs.writeFileSync(this.path, splitted.join("\n"));
330
315
  }
331
316
  else {
332
317
  //write new file:
333
318
  const newtext = this.#createStatsText() + text;
334
- fs_1.default.writeFileSync(this.path, newtext);
319
+ fs.writeFileSync(this.path, newtext);
335
320
  }
336
321
  }
337
322
  /**Generate the statistics/header of the debug file (containing the version) */
@@ -358,12 +343,12 @@ class ODDebugFileManager {
358
343
  }
359
344
  splitted.unshift(this.#createStatsText());
360
345
  splitted.push("\n---------------------------------------------------------------------\n---------------------------------------------------------------------\n");
361
- fs_1.default.writeFileSync(this.path, splitted.join("\n"));
346
+ fs.writeFileSync(this.path, splitted.join("\n"));
362
347
  }
363
348
  else {
364
349
  //write new file:
365
350
  const newtext = this.#createStatsText();
366
- fs_1.default.writeFileSync(this.path, newtext);
351
+ fs.writeFileSync(this.path, newtext);
367
352
  }
368
353
  }
369
354
  /**Write an `ODConsoleMessage` to the debug file */
@@ -383,7 +368,6 @@ class ODDebugFileManager {
383
368
  this.#writeDebugFile("[NOTE]: " + text);
384
369
  }
385
370
  }
386
- exports.ODDebugFileManager = ODDebugFileManager;
387
371
  /**## ODDebugger `class`
388
372
  * This is the Open Discord debugger.
389
373
  *
@@ -394,7 +378,7 @@ exports.ODDebugFileManager = ODDebugFileManager;
394
378
  *
395
379
  * Using this system, all additions & removals inside a manager are logged to the debug file. This makes searching for errors a lot easier!
396
380
  */
397
- class ODDebugger {
381
+ export class ODDebugger {
398
382
  /**An alias to the Open Discord console manager. */
399
383
  console;
400
384
  /**When enabled, debug logs are also shown in the console. */
@@ -405,16 +389,15 @@ class ODDebugger {
405
389
  /**Create a debug message. This will always be logged to `debug.txt` & sometimes to the console (when enabled). Returns `true` when visible */
406
390
  debug(message, params) {
407
391
  if (this.visible) {
408
- this.console.log(new ODConsoleDebugMessage(message, params));
392
+ this.console.log(new ODDebugConsoleMessage(message, params));
409
393
  return true;
410
394
  }
411
395
  else {
412
- this.console.debugfile.writeConsoleMessage(new ODConsoleDebugMessage(message, params));
396
+ this.console.debugfile.writeConsoleMessage(new ODDebugConsoleMessage(message, params));
413
397
  return false;
414
398
  }
415
399
  }
416
400
  }
417
- exports.ODDebugger = ODDebugger;
418
401
  /**## ODLiveStatusSource `class`
419
402
  * This is the Open Discord livestatus source.
420
403
  *
@@ -424,7 +407,7 @@ exports.ODDebugger = ODDebugger;
424
407
  *
425
408
  * This class doesn't do anything on it's own! It's just a template!
426
409
  */
427
- class ODLiveStatusSource extends base_1.ODManagerData {
410
+ export class ODLiveStatusSource extends ODManagerData {
428
411
  /**The raw data of this source */
429
412
  data;
430
413
  constructor(id, data) {
@@ -459,7 +442,6 @@ class ODLiveStatusSource extends base_1.ODManagerData {
459
442
  return validMessages;
460
443
  }
461
444
  }
462
- exports.ODLiveStatusSource = ODLiveStatusSource;
463
445
  /**## ODLiveStatusFileSource `class`
464
446
  * This is the Open Discord livestatus file source.
465
447
  *
@@ -467,19 +449,18 @@ exports.ODLiveStatusSource = ODLiveStatusSource;
467
449
  *
468
450
  * This can be used for testing/extending the LiveStatus system!
469
451
  */
470
- class ODLiveStatusFileSource extends ODLiveStatusSource {
452
+ export class ODLiveStatusFileSource extends ODLiveStatusSource {
471
453
  /**The path to the source file */
472
454
  path;
473
455
  constructor(id, path) {
474
- if (fs_1.default.existsSync(path)) {
475
- super(id, JSON.parse(fs_1.default.readFileSync(path).toString()));
456
+ if (fs.existsSync(path)) {
457
+ super(id, JSON.parse(fs.readFileSync(path).toString()));
476
458
  }
477
459
  else
478
- throw new base_1.ODSystemError("LiveStatus source file doesn't exist!");
460
+ throw new ODSystemError("LiveStatus source file doesn't exist!");
479
461
  this.path = path;
480
462
  }
481
463
  }
482
- exports.ODLiveStatusFileSource = ODLiveStatusFileSource;
483
464
  /**## ODLiveStatusUrlSource `class`
484
465
  * This is the Open Discord livestatus url source.
485
466
  *
@@ -487,7 +468,7 @@ exports.ODLiveStatusFileSource = ODLiveStatusFileSource;
487
468
  *
488
469
  * This is the default way of receiving LiveStatus messages!
489
470
  */
490
- class ODLiveStatusUrlSource extends ODLiveStatusSource {
471
+ export class ODLiveStatusUrlSource extends ODLiveStatusSource {
491
472
  /**The url used in the request */
492
473
  url;
493
474
  /**The `ODHTTPGetRequest` helper to fetch the url! */
@@ -495,25 +476,24 @@ class ODLiveStatusUrlSource extends ODLiveStatusSource {
495
476
  constructor(main, id, url) {
496
477
  super(id, []);
497
478
  this.url = url;
498
- this.request = new base_1.ODHTTPGetRequest(main, url, false);
479
+ this.request = new ODHTTPGetRequest(main, url, false);
499
480
  }
500
481
  async getMessages(main) {
501
482
  //additional setup
502
483
  this.request.url = this.url;
503
484
  const rawRes = await this.request.run();
504
485
  if (rawRes.status != 200)
505
- throw new base_1.ODSystemError("ODLiveStatusUrlSource => Request Failed!");
486
+ throw new ODSystemError("ODLiveStatusUrlSource => Request Failed!");
506
487
  try {
507
488
  this.setData(JSON.parse(rawRes.body));
508
489
  }
509
490
  catch {
510
- throw new base_1.ODSystemError("ODLiveStatusUrlSource => Request Failed!");
491
+ throw new ODSystemError("ODLiveStatusUrlSource => Request Failed!");
511
492
  }
512
493
  //default
513
494
  return super.getMessages(main);
514
495
  }
515
496
  }
516
- exports.ODLiveStatusUrlSource = ODLiveStatusUrlSource;
517
497
  /**## ODLiveStatusManager `class`
518
498
  * This is the Open Discord livestatus manager.
519
499
  *
@@ -522,7 +502,7 @@ exports.ODLiveStatusUrlSource = ODLiveStatusUrlSource;
522
502
  * You can use this to customise or add stuff to the LiveStatus system.
523
503
  * Access it in the global `opendiscord.startscreen.livestatus` variable!
524
504
  */
525
- class ODLiveStatusManager extends base_1.ODManager {
505
+ export class ODLiveStatusManager extends ODManager {
526
506
  /**The class responsible for rendering the livestatus messages. */
527
507
  renderer;
528
508
  /**A reference to the ODMain or "opendiscord" global variable */
@@ -534,7 +514,7 @@ class ODLiveStatusManager extends base_1.ODManager {
534
514
  /**Get the messages from all sources combined! */
535
515
  async getAllMessages() {
536
516
  if (!this.#main)
537
- throw new base_1.ODSystemError("ODLiveStatusManager:getAllMessages() --> Unable to get messages, 'opendiscord/ODMain' has not been connected!");
517
+ throw new ODSystemError("ODLiveStatusManager:getAllMessages() --> Unable to get messages, 'opendiscord/ODMain' has not been connected!");
538
518
  const messages = [];
539
519
  for (const source of this.getAll()) {
540
520
  try {
@@ -558,13 +538,12 @@ class ODLiveStatusManager extends base_1.ODManager {
558
538
  return super.exists(id);
559
539
  }
560
540
  }
561
- exports.ODLiveStatusManager = ODLiveStatusManager;
562
541
  /**## ODLiveStatusRenderer `class`
563
542
  * This is the Open Discord livestatus renderer.
564
543
  *
565
544
  * It's responsible for rendering all LiveStatus messages to the console.
566
545
  */
567
- class ODLiveStatusRenderer {
546
+ export class ODLiveStatusRenderer {
568
547
  /**A reference to the ODConsoleManager or "opendiscord.console" global variable */
569
548
  #console;
570
549
  constructor(console) {
@@ -591,13 +570,13 @@ class ODLiveStatusRenderer {
591
570
  return text2;
592
571
  }).join("\n");
593
572
  if (!["red", "yellow", "green", "blue", "gray", "magenta", "cyan"].includes(titleColor))
594
- var finalTitle = ansis_1.default.white(title);
573
+ var finalTitle = ansis.white(title);
595
574
  else
596
- var finalTitle = ansis_1.default[titleColor](title);
575
+ var finalTitle = ansis[(titleColor == "normal" ? "white" : titleColor)](title);
597
576
  if (!["red", "yellow", "green", "blue", "gray", "magenta", "cyan"].includes(descriptionColor))
598
- var finalDescription = ansis_1.default.white(description);
577
+ var finalDescription = ansis.white(description);
599
578
  else
600
- var finalDescription = ansis_1.default[descriptionColor](description);
579
+ var finalDescription = ansis[(descriptionColor == "normal" ? "white" : descriptionColor)](description);
601
580
  final.push(finalTitle + finalDescription);
602
581
  });
603
582
  //return all messages
@@ -609,4 +588,3 @@ class ODLiveStatusRenderer {
609
588
  }
610
589
  }
611
590
  }
612
- exports.ODLiveStatusRenderer = ODLiveStatusRenderer;
@@ -1,5 +1,5 @@
1
- import { ODValidId, ODManager, ODManagerData, ODNoGeneric } from "./base";
2
- import { ODDebugger } from "./console";
1
+ import { ODValidId, ODManager, ODManagerData, ODNoGeneric } from "./base.js";
2
+ import { ODDebugger } from "./console.js";
3
3
  /**## ODCooldownManagerIdConstraint `type`
4
4
  * The constraint/layout for id mappings/interfaces of the `ODCooldownManager` class.
5
5
  */
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ODIncrementalTimeoutCooldown = exports.ODTimeoutCooldown = exports.ODIncrementalCounterCooldown = exports.ODCounterCooldown = exports.ODCooldown = exports.ODCooldownData = exports.ODCooldownManager = void 0;
4
1
  ///////////////////////////////////////
5
2
  //COOLDOWN MODULE
6
3
  ///////////////////////////////////////
7
- const base_1 = require("./base");
4
+ import { ODManager, ODSystemError, ODManagerData } from "./base.js";
8
5
  /**## ODCooldownManager `class`
9
6
  * This is an Open Discord cooldown manager.
10
7
  *
@@ -12,7 +9,7 @@ const base_1 = require("./base");
12
9
  *
13
10
  * There are many types of cooldowns available, but you can also create your own!
14
11
  */
15
- class ODCooldownManager extends base_1.ODManager {
12
+ export class ODCooldownManager extends ODManager {
16
13
  constructor(debug) {
17
14
  super(debug, "cooldown");
18
15
  }
@@ -32,13 +29,12 @@ class ODCooldownManager extends base_1.ODManager {
32
29
  return super.exists(id);
33
30
  }
34
31
  }
35
- exports.ODCooldownManager = ODCooldownManager;
36
32
  /**## ODCooldownData `class`
37
33
  * This is Open Discord cooldown data.
38
34
  *
39
35
  * It contains the instance of an active cooldown (e.g. for a user). It is handled by the cooldown itself.
40
36
  */
41
- class ODCooldownData extends base_1.ODManagerData {
37
+ export class ODCooldownData extends ODManagerData {
42
38
  /**Is this cooldown active? */
43
39
  active;
44
40
  /**Additional data of this cooldown instance. (different for each cooldown type) */
@@ -49,7 +45,6 @@ class ODCooldownData extends base_1.ODManagerData {
49
45
  this.data = data;
50
46
  }
51
47
  }
52
- exports.ODCooldownData = ODCooldownData;
53
48
  /**## ODCooldown `class`
54
49
  * This is an Open Discord cooldown.
55
50
  *
@@ -58,8 +53,8 @@ exports.ODCooldownData = ODCooldownData;
58
53
  *
59
54
  * There are also premade cooldowns available in the bot!
60
55
  */
61
- class ODCooldown extends base_1.ODManagerData {
62
- data = new base_1.ODManager();
56
+ export class ODCooldown extends ODManagerData {
57
+ data = new ODManager();
63
58
  /**Is this cooldown already initialized? */
64
59
  ready = false;
65
60
  constructor(id) {
@@ -67,29 +62,28 @@ class ODCooldown extends base_1.ODManagerData {
67
62
  }
68
63
  /**Check this id and start cooldown when it exeeds the limit! Returns `true` when on cooldown! */
69
64
  use(id) {
70
- throw new base_1.ODSystemError("Tried to use an unimplemented ODCooldown!");
65
+ throw new ODSystemError("Tried to use an unimplemented ODCooldown!");
71
66
  }
72
67
  /**Check this id without starting or updating the cooldown. Returns `true` when on cooldown! */
73
68
  check(id) {
74
- throw new base_1.ODSystemError("Tried to use an unimplemented ODCooldown!");
69
+ throw new ODSystemError("Tried to use an unimplemented ODCooldown!");
75
70
  }
76
71
  /**Remove the cooldown for an id when available.*/
77
72
  delete(id) {
78
- throw new base_1.ODSystemError("Tried to use an unimplemented ODCooldown!");
73
+ throw new ODSystemError("Tried to use an unimplemented ODCooldown!");
79
74
  }
80
75
  /**Initialize the internal systems of this cooldown. */
81
76
  async init() {
82
- throw new base_1.ODSystemError("Tried to use an unimplemented ODCooldown!");
77
+ throw new ODSystemError("Tried to use an unimplemented ODCooldown!");
83
78
  }
84
79
  }
85
- exports.ODCooldown = ODCooldown;
86
80
  /**## ODCounterCooldown `class`
87
81
  * This is an Open Discord counter cooldown.
88
82
  *
89
83
  * It is is a cooldown based on a counter. When the number exceeds the limit, the cooldown is activated.
90
84
  * The number will automatically be decreased with a set amount & interval.
91
85
  */
92
- class ODCounterCooldown extends ODCooldown {
86
+ export class ODCounterCooldown extends ODCooldown {
93
87
  /**The cooldown will activate when exceeding this limit. */
94
88
  activeLimit;
95
89
  /**The cooldown will deactivate when below this limit. */
@@ -161,14 +155,13 @@ class ODCounterCooldown extends ODCooldown {
161
155
  this.ready = true;
162
156
  }
163
157
  }
164
- exports.ODCounterCooldown = ODCounterCooldown;
165
158
  /**## ODIncrementalCounterCooldown `class`
166
159
  * This is an Open Discord incremental counter cooldown.
167
160
  *
168
161
  * It is is a cooldown based on an incremental counter. It is exactly the same as the normal counter,
169
162
  * with the only difference being that it still increments when the limit is already exeeded.
170
163
  */
171
- class ODIncrementalCounterCooldown extends ODCooldown {
164
+ export class ODIncrementalCounterCooldown extends ODCooldown {
172
165
  /**The cooldown will activate when exceeding this limit. */
173
166
  activeLimit;
174
167
  /**The cooldown will deactivate when below this limit. */
@@ -241,14 +234,13 @@ class ODIncrementalCounterCooldown extends ODCooldown {
241
234
  this.ready = true;
242
235
  }
243
236
  }
244
- exports.ODIncrementalCounterCooldown = ODIncrementalCounterCooldown;
245
237
  /**## ODTimeoutCooldown `class`
246
238
  * This is an Open Discord timeout cooldown.
247
239
  *
248
240
  * It is a cooldown based on a timer. When triggered/updated, the cooldown is activated for the set amount of time.
249
241
  * After the timer has timed out, the cooldown will be deleted.
250
242
  */
251
- class ODTimeoutCooldown extends ODCooldown {
243
+ export class ODTimeoutCooldown extends ODCooldown {
252
244
  /**The amount of milliseconds before the cooldown times-out */
253
245
  timeoutMs;
254
246
  constructor(id, timeoutMs) {
@@ -301,14 +293,13 @@ class ODTimeoutCooldown extends ODCooldown {
301
293
  this.ready = true;
302
294
  }
303
295
  }
304
- exports.ODTimeoutCooldown = ODTimeoutCooldown;
305
296
  /**## ODIncrementalTimeoutCooldown `class`
306
297
  * This is an Open Discord incremental timeout cooldown.
307
298
  *
308
299
  * It is is a cooldown based on an incremental timer. It is exactly the same as the normal timer,
309
300
  * with the only difference being that it adds additional time when triggered/updated while the cooldown is already active.
310
301
  */
311
- class ODIncrementalTimeoutCooldown extends ODCooldown {
302
+ export class ODIncrementalTimeoutCooldown extends ODCooldown {
312
303
  /**The amount of milliseconds before the cooldown times-out */
313
304
  timeoutMs;
314
305
  /**The amount of milliseconds to add when triggered/updated while the cooldown is already active. */
@@ -365,4 +356,3 @@ class ODIncrementalTimeoutCooldown extends ODCooldown {
365
356
  this.ready = true;
366
357
  }
367
358
  }
368
- exports.ODIncrementalTimeoutCooldown = ODIncrementalTimeoutCooldown;
@@ -1,5 +1,5 @@
1
- import { ODManager, ODManagerData, ODNoGeneric, ODOptionalPromise, ODPromiseVoid, ODValidId, ODValidJsonType } from "./base";
2
- import { ODDebugger } from "./console";
1
+ import { ODManager, ODManagerData, ODNoGeneric, ODOptionalPromise, ODPromiseVoid, ODValidId, ODValidJsonType } from "./base.js";
2
+ import { ODDebugger } from "./console.js";
3
3
  import * as fjs from "formatted-json-stringify";
4
4
  /**## ODDatabaseManagerIdConstraint `type`
5
5
  * The constraint/layout for id mappings/interfaces of the `ODDatabaseManager` class.