@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,5 +1,5 @@
1
- import { ODManager, ODManagerData, ODNoGeneric, ODValidId } from "./base";
2
- import { ODDebugger } from "./console";
1
+ import { ODManager, ODManagerData, ODNoGeneric, ODValidId } from "./base.js";
2
+ import { ODDebugger } from "./console.js";
3
3
  /**## ODSessionManagerIdConstraint `type`
4
4
  * The constraint/layout for id mappings/interfaces of the `ODSessionManager` class.
5
5
  */
@@ -1,44 +1,8 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.ODSession = exports.ODSessionManager = void 0;
37
1
  ///////////////////////////////////////
38
2
  //SESSION MODULE
39
3
  ///////////////////////////////////////
40
- const base_1 = require("./base");
41
- const crypto = __importStar(require("crypto"));
4
+ import { ODManager, ODManagerData } from "./base.js";
5
+ import * as crypto from "crypto";
42
6
  /**## ODSessionManager `class`
43
7
  * This is an Open Discord session manager.
44
8
  *
@@ -47,7 +11,7 @@ const crypto = __importStar(require("crypto"));
47
11
  *
48
12
  * Visit the `ODSession` class for more info
49
13
  */
50
- class ODSessionManager extends base_1.ODManager {
14
+ export class ODSessionManager extends ODManager {
51
15
  constructor(debug) {
52
16
  super(debug, "session");
53
17
  }
@@ -61,14 +25,13 @@ class ODSessionManager extends base_1.ODManager {
61
25
  return super.exists(id);
62
26
  }
63
27
  }
64
- exports.ODSessionManager = ODSessionManager;
65
28
  /**## ODSession `class`
66
29
  * This is an Open Discord session.
67
30
  *
68
31
  * It can be used to create 100% unique id's for usage in the bot. An id can also store additional data which isn't saved to the filesystem.
69
32
  * You can almost compare it to the PHP session system.
70
33
  */
71
- class ODSession extends base_1.ODManagerData {
34
+ export class ODSession extends ODManagerData {
72
35
  /**The history of previously generated instance ids. Used to reduce the risk of generating the same id twice. */
73
36
  #idHistory = [];
74
37
  /**The max length of the instance id history. */
@@ -177,4 +140,3 @@ class ODSession extends base_1.ODManagerData {
177
140
  this.#timeoutListeners.push(callback);
178
141
  }
179
142
  }
180
- exports.ODSession = ODSession;
@@ -1,7 +1,7 @@
1
- import { ODManager, ODManagerData, ODNoGeneric, ODValidId } from "./base";
2
- import { ODDebugger, ODLiveStatusManager, ODLiveStatusManagerIdConstraint } from "./console";
3
- import { ODFlag } from "./flag";
4
- import { ODPlugin, ODUnknownCrashedPlugin } from "./plugin";
1
+ import { ODManager, ODManagerData, ODNoGeneric, ODValidId } from "./base.js";
2
+ import { ODDebugger, ODLiveStatusManager, ODLiveStatusManagerIdConstraint } from "./console.js";
3
+ import { ODFlag } from "./flag.js";
4
+ import { ODPlugin, ODUnknownCrashedPlugin } from "./plugin.js";
5
5
  /**## ODStartScreenComponentRenderCallback `type`
6
6
  * This is the render function of a startscreen component. It also sends the location of where the component is rendered.
7
7
  */
@@ -1,22 +1,16 @@
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.ODStartScreenLogCategoryComponent = exports.ODStartScreenLiveStatusCategoryComponent = exports.ODStartScreenPluginsCategoryComponent = exports.ODStartScreenFlagsCategoryComponent = exports.ODStartScreenPropertiesCategoryComponent = exports.ODStartScreenCategoryComponent = exports.ODStartScreenHeaderComponent = exports.ODStartScreenLogoComponent = exports.ODStartScreenComponent = exports.ODStartScreenManager = void 0;
7
1
  ///////////////////////////////////////
8
2
  //STARTSCREEN MODULE
9
3
  ///////////////////////////////////////
10
- const base_1 = require("./base");
11
- const console_1 = require("./console");
12
- const ansis_1 = __importDefault(require("ansis"));
4
+ import { ODManager, ODManagerData } from "./base.js";
5
+ import { ODError } from "./console.js";
6
+ import ansis from "ansis";
13
7
  /**## ODStartScreenManager `class`
14
8
  * This is an Open Discord startscreen manager.
15
9
  *
16
10
  * This class is responsible for managing & rendering the startscreen of the bot.
17
11
  * The startscreen is the part you see when the bot has started up successfully. (e.g. the Open Discord logo, logs, livestatus, flags, ...)
18
12
  */
19
- class ODStartScreenManager extends base_1.ODManager {
13
+ export class ODStartScreenManager extends ODManager {
20
14
  /**Alias to the Open Discord debugger. */
21
15
  #debug;
22
16
  /**Alias to the livestatus manager. */
@@ -43,11 +37,11 @@ class ODStartScreenManager extends base_1.ODManager {
43
37
  try {
44
38
  const renderedText = await component.renderAll(location);
45
39
  console.log(renderedText);
46
- this.#debug.console.debugfile.writeText("[STARTSCREEN] Component: \"" + component.id + "\"\n" + ansis_1.default.strip(renderedText));
40
+ this.#debug.console.debugfile.writeText("[STARTSCREEN] Component: \"" + component.id + "\"\n" + ansis.strip(renderedText));
47
41
  }
48
42
  catch (e) {
49
43
  this.#debug.console.log("Unable to render \"" + component.id + "\" startscreen component!", "error");
50
- this.#debug.console.debugfile.writeErrorMessage(new console_1.ODError(e, "uncaughtException"));
44
+ this.#debug.console.debugfile.writeErrorMessage(new ODError(e, "uncaughtException"));
51
45
  }
52
46
  location++;
53
47
  }
@@ -62,7 +56,6 @@ class ODStartScreenManager extends base_1.ODManager {
62
56
  return super.exists(id);
63
57
  }
64
58
  }
65
- exports.ODStartScreenManager = ODStartScreenManager;
66
59
  /**## ODStartScreenComponent `class`
67
60
  * This is an Open Discord startscreen component.
68
61
  *
@@ -71,7 +64,7 @@ exports.ODStartScreenManager = ODStartScreenManager;
71
64
  *
72
65
  * It's recommended to use pre-built components except if you really need a custom one.
73
66
  */
74
- class ODStartScreenComponent extends base_1.ODManagerData {
67
+ export class ODStartScreenComponent extends ODManagerData {
75
68
  /**The priority of this component. */
76
69
  priority;
77
70
  /**An optional render function which will be inserted before the default renderer. */
@@ -93,14 +86,13 @@ class ODStartScreenComponent extends base_1.ODManagerData {
93
86
  return (textBefore ? textBefore + "\n" : "") + text + (textAfter ? "\n" + textAfter : "");
94
87
  }
95
88
  }
96
- exports.ODStartScreenComponent = ODStartScreenComponent;
97
89
  /**## ODStartScreenLogoComponent `class`
98
90
  * This is an Open Discord startscreen logo component.
99
91
  *
100
92
  * This component will render an ASCII art logo (from an array) to the startscreen. Every property in the array is another row.
101
93
  * An optional priority can be specified to choose the location of the component.
102
94
  */
103
- class ODStartScreenLogoComponent extends ODStartScreenComponent {
95
+ export class ODStartScreenLogoComponent extends ODStartScreenComponent {
104
96
  /**The ASCII logo contents. */
105
97
  logo;
106
98
  /**When enabled, the component will add a new line above the logo. */
@@ -114,7 +106,7 @@ class ODStartScreenLogoComponent extends ODStartScreenComponent {
114
106
  const renderedTop = (this.topPadding ? "\n" : "");
115
107
  const renderedLogo = this.logo.join("\n");
116
108
  const renderedBottom = (this.bottomPadding ? "\n" : "");
117
- return ansis_1.default.hex(this.logoHexColor)(renderedTop + renderedLogo + renderedBottom);
109
+ return ansis.hex(this.logoHexColor)(renderedTop + renderedLogo + renderedBottom);
118
110
  });
119
111
  this.logo = logo;
120
112
  this.topPadding = topPadding ?? false;
@@ -122,14 +114,13 @@ class ODStartScreenLogoComponent extends ODStartScreenComponent {
122
114
  this.logoHexColor = logoHexColor ?? "#f8ba00";
123
115
  }
124
116
  }
125
- exports.ODStartScreenLogoComponent = ODStartScreenLogoComponent;
126
117
  /**## ODStartScreenHeaderComponent `class`
127
118
  * This is an Open Discord startscreen header component.
128
119
  *
129
120
  * This component will render a header to the startscreen. Properties can be aligned left, right or centered.
130
121
  * An optional priority can be specified to choose the location of the component.
131
122
  */
132
- class ODStartScreenHeaderComponent extends ODStartScreenComponent {
123
+ export class ODStartScreenHeaderComponent extends ODStartScreenComponent {
133
124
  /**All properties of this header component. */
134
125
  properties;
135
126
  /**The spacer used between properties. */
@@ -138,18 +129,18 @@ class ODStartScreenHeaderComponent extends ODStartScreenComponent {
138
129
  align;
139
130
  constructor(id, priority, properties, spacer, align) {
140
131
  super(id, priority, async () => {
141
- const renderedProperties = ansis_1.default.bold(this.properties.map((prop) => prop.key + ": " + prop.value).join(this.spacer));
132
+ const renderedProperties = ansis.bold(this.properties.map((prop) => prop.key + ": " + prop.value).join(this.spacer));
142
133
  if (!this.align || this.align.align == "left") {
143
134
  return renderedProperties;
144
135
  }
145
136
  else if (this.align.align == "right") {
146
- const width = (typeof this.align.width == "number") ? this.align.width : (ansis_1.default.strip(await this.align.width.renderAll(0)).split("\n").map((row) => row.length).reduce((prev, curr) => {
137
+ const width = (typeof this.align.width == "number") ? this.align.width : (ansis.strip(await this.align.width.renderAll(0)).split("\n").map((row) => row.length).reduce((prev, curr) => {
147
138
  if (prev < curr)
148
139
  return curr;
149
140
  else
150
141
  return prev;
151
142
  }, 0));
152
- const offset = width - ansis_1.default.strip(renderedProperties).length;
143
+ const offset = width - ansis.strip(renderedProperties).length;
153
144
  if (offset < 0)
154
145
  return renderedProperties;
155
146
  else {
@@ -157,13 +148,13 @@ class ODStartScreenHeaderComponent extends ODStartScreenComponent {
157
148
  }
158
149
  }
159
150
  else if (this.align.align == "center") {
160
- const width = (typeof this.align.width == "number") ? this.align.width : (ansis_1.default.strip(await this.align.width.renderAll(0)).split("\n").map((row) => row.length).reduce((prev, curr) => {
151
+ const width = (typeof this.align.width == "number") ? this.align.width : (ansis.strip(await this.align.width.renderAll(0)).split("\n").map((row) => row.length).reduce((prev, curr) => {
161
152
  if (prev < curr)
162
153
  return curr;
163
154
  else
164
155
  return prev;
165
156
  }));
166
- const offset = Math.round((width - ansis_1.default.strip(renderedProperties).length) / 2);
157
+ const offset = Math.round((width - ansis.strip(renderedProperties).length) / 2);
167
158
  if (offset < 0)
168
159
  return renderedProperties;
169
160
  else {
@@ -177,14 +168,13 @@ class ODStartScreenHeaderComponent extends ODStartScreenComponent {
177
168
  this.align = align ?? null;
178
169
  }
179
170
  }
180
- exports.ODStartScreenHeaderComponent = ODStartScreenHeaderComponent;
181
171
  /**## ODStartScreenCategoryComponent `class`
182
172
  * This is an Open Discord startscreen category component.
183
173
  *
184
174
  * This component will render a category to the startscreen. This will only render the category name. You'll need to provide your own renderer for the contents.
185
175
  * An optional priority can be specified to choose the location of the component.
186
176
  */
187
- class ODStartScreenCategoryComponent extends ODStartScreenComponent {
177
+ export class ODStartScreenCategoryComponent extends ODStartScreenComponent {
188
178
  /**The name of this category. */
189
179
  name;
190
180
  /**When enabled, this category will still be rendered when the contents are empty. (enabled by default) */
@@ -193,7 +183,7 @@ class ODStartScreenCategoryComponent extends ODStartScreenComponent {
193
183
  super(id, priority, async (location) => {
194
184
  const contents = await render(location);
195
185
  if (contents != "" || this.renderIfEmpty) {
196
- return ansis_1.default.bold.underline("\n" + name.toUpperCase() + (contents != "" ? ":\n" : ":")) + contents;
186
+ return ansis.bold.underline("\n" + name.toUpperCase() + (contents != "" ? ":\n" : ":")) + contents;
197
187
  }
198
188
  else
199
189
  return "";
@@ -202,51 +192,48 @@ class ODStartScreenCategoryComponent extends ODStartScreenComponent {
202
192
  this.renderIfEmpty = renderIfEmpty ?? true;
203
193
  }
204
194
  }
205
- exports.ODStartScreenCategoryComponent = ODStartScreenCategoryComponent;
206
195
  /**## ODStartScreenPropertiesCategoryComponent `class`
207
196
  * This is an Open Discord startscreen properties category component.
208
197
  *
209
198
  * This component will render a properties category to the startscreen. This will list the properties in the category.
210
199
  * An optional priority can be specified to choose the location of the component.
211
200
  */
212
- class ODStartScreenPropertiesCategoryComponent extends ODStartScreenCategoryComponent {
201
+ export class ODStartScreenPropertiesCategoryComponent extends ODStartScreenCategoryComponent {
213
202
  /**The properties of this category component. */
214
203
  properties;
215
204
  /**The hex color for the key/name of all the properties. */
216
205
  propertyHexColor;
217
206
  constructor(id, priority, name, properties, propertyHexColor, renderIfEmpty) {
218
207
  super(id, priority, name, () => {
219
- return this.properties.map((prop) => ansis_1.default.hex(this.propertyHexColor)(prop.key + ": ") + prop.value).join("\n");
208
+ return this.properties.map((prop) => ansis.hex(this.propertyHexColor)(prop.key + ": ") + prop.value).join("\n");
220
209
  }, renderIfEmpty);
221
210
  this.properties = properties;
222
211
  this.propertyHexColor = propertyHexColor ?? "#f8ba00";
223
212
  }
224
213
  }
225
- exports.ODStartScreenPropertiesCategoryComponent = ODStartScreenPropertiesCategoryComponent;
226
214
  /**## ODStartScreenFlagsCategoryComponent `class`
227
215
  * This is an Open Discord startscreen flags category component.
228
216
  *
229
217
  * This component will render a flags category to the startscreen. This will list the enabled flags in the category.
230
218
  * An optional priority can be specified to choose the location of the component.
231
219
  */
232
- class ODStartScreenFlagsCategoryComponent extends ODStartScreenCategoryComponent {
220
+ export class ODStartScreenFlagsCategoryComponent extends ODStartScreenCategoryComponent {
233
221
  /**A list of all flags to render. */
234
222
  flags;
235
223
  constructor(id, priority, flags) {
236
224
  super(id, priority, "flags", () => {
237
- return this.flags.filter((flag) => (flag.value == true)).map((flag) => ansis_1.default.blue("[" + flag.name + "] " + flag.description)).join("\n");
225
+ return this.flags.filter((flag) => (flag.value == true)).map((flag) => ansis.blue("[" + flag.name + "] " + flag.description)).join("\n");
238
226
  }, false);
239
227
  this.flags = flags;
240
228
  }
241
229
  }
242
- exports.ODStartScreenFlagsCategoryComponent = ODStartScreenFlagsCategoryComponent;
243
230
  /**## ODStartScreenPluginsCategoryComponent `class`
244
231
  * This is an Open Discord startscreen plugins category component.
245
232
  *
246
233
  * This component will render a plugins category to the startscreen. This will list the enabled, disabled & crashed plugins in the category.
247
234
  * An optional priority can be specified to choose the location of the component.
248
235
  */
249
- class ODStartScreenPluginsCategoryComponent extends ODStartScreenCategoryComponent {
236
+ export class ODStartScreenPluginsCategoryComponent extends ODStartScreenCategoryComponent {
250
237
  /**A list of all plugins to render. */
251
238
  plugins;
252
239
  /**A list of all crashed plugins to render. */
@@ -254,10 +241,10 @@ class ODStartScreenPluginsCategoryComponent extends ODStartScreenCategoryCompone
254
241
  constructor(id, priority, plugins, unknownCrashedPlugins) {
255
242
  super(id, priority, "plugins", () => {
256
243
  const disabledPlugins = this.plugins.filter((plugin) => !plugin.enabled);
257
- const renderedActivePlugins = this.plugins.filter((plugin) => plugin.enabled && plugin.executed).sort((a, b) => b.priority - a.priority).map((plugin) => ansis_1.default.green("✅ [" + plugin.name + "] " + plugin.details.shortDescription));
258
- const renderedCrashedPlugins = this.plugins.filter((plugin) => plugin.enabled && plugin.crashed).sort((a, b) => b.priority - a.priority).map((plugin) => ansis_1.default.red("❌ [" + plugin.name + "] " + plugin.details.shortDescription));
259
- const renderedDisabledPlugins = (disabledPlugins.length > 4) ? [ansis_1.default.gray("💤 (+" + disabledPlugins.length + " disabled plugins)")] : disabledPlugins.sort((a, b) => b.priority - a.priority).map((plugin) => ansis_1.default.gray("💤 [" + plugin.name + "] " + plugin.details.shortDescription));
260
- const renderedUnknownPlugins = unknownCrashedPlugins.map((plugin) => ansis_1.default.red("❌ [" + plugin.name + "] " + plugin.description));
244
+ const renderedActivePlugins = this.plugins.filter((plugin) => plugin.enabled && plugin.executed).sort((a, b) => b.priority - a.priority).map((plugin) => ansis.green("✅ [" + plugin.name + "] " + plugin.details.shortDescription));
245
+ const renderedCrashedPlugins = this.plugins.filter((plugin) => plugin.enabled && plugin.crashed).sort((a, b) => b.priority - a.priority).map((plugin) => ansis.red("❌ [" + plugin.name + "] " + plugin.details.shortDescription));
246
+ const renderedDisabledPlugins = (disabledPlugins.length > 4) ? [ansis.gray("💤 (+" + disabledPlugins.length + " disabled plugins)")] : disabledPlugins.sort((a, b) => b.priority - a.priority).map((plugin) => ansis.gray("💤 [" + plugin.name + "] " + plugin.details.shortDescription));
247
+ const renderedUnknownPlugins = unknownCrashedPlugins.map((plugin) => ansis.red("❌ [" + plugin.name + "] " + plugin.description));
261
248
  return [
262
249
  ...renderedActivePlugins,
263
250
  ...renderedDisabledPlugins,
@@ -269,14 +256,13 @@ class ODStartScreenPluginsCategoryComponent extends ODStartScreenCategoryCompone
269
256
  this.unknownCrashedPlugins = unknownCrashedPlugins;
270
257
  }
271
258
  }
272
- exports.ODStartScreenPluginsCategoryComponent = ODStartScreenPluginsCategoryComponent;
273
259
  /**## ODStartScreenLiveStatusCategoryComponent `class`
274
260
  * This is an Open Discord startscreen livestatus category component.
275
261
  *
276
262
  * This component will render a livestatus category to the startscreen. This will list the livestatus messages in the category.
277
263
  * An optional priority can be specified to choose the location of the component.
278
264
  */
279
- class ODStartScreenLiveStatusCategoryComponent extends ODStartScreenCategoryComponent {
265
+ export class ODStartScreenLiveStatusCategoryComponent extends ODStartScreenCategoryComponent {
280
266
  /**A reference to the Open Discord livestatus manager. */
281
267
  livestatus;
282
268
  constructor(id, priority, livestatus) {
@@ -287,16 +273,14 @@ class ODStartScreenLiveStatusCategoryComponent extends ODStartScreenCategoryComp
287
273
  this.livestatus = livestatus;
288
274
  }
289
275
  }
290
- exports.ODStartScreenLiveStatusCategoryComponent = ODStartScreenLiveStatusCategoryComponent;
291
276
  /**## ODStartScreenLogsCategoryComponent `class`
292
277
  * This is an Open Discord startscreen logs category component.
293
278
  *
294
279
  * This component will render a logs category to the startscreen. This will only render the logs category name.
295
280
  * An optional priority can be specified to choose the location of the component.
296
281
  */
297
- class ODStartScreenLogCategoryComponent extends ODStartScreenCategoryComponent {
282
+ export class ODStartScreenLogCategoryComponent extends ODStartScreenCategoryComponent {
298
283
  constructor(id, priority) {
299
284
  super(id, priority, "logs", () => "", true);
300
285
  }
301
286
  }
302
- exports.ODStartScreenLogCategoryComponent = ODStartScreenLogCategoryComponent;
@@ -1,6 +1,6 @@
1
- import { ODId, ODManager, ODManagerData, ODNoGeneric, ODValidId } from "./base";
2
- import { ODDebugger } from "./console";
3
- import { ODDatabase, ODDatabaseIdConstraint, ODJsonDatabaseStructure } from "./database";
1
+ import { ODId, ODManager, ODManagerData, ODNoGeneric, ODValidId } from "./base.js";
2
+ import { ODDebugger } from "./console.js";
3
+ import { ODDatabase, ODDatabaseIdConstraint, ODJsonDatabaseStructure } from "./database.js";
4
4
  import * as discord from "discord.js";
5
5
  /**## ODValidStatisticValue `type`
6
6
  * These are the only allowed types for a statistic value to improve compatibility with different database systems.
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ODDynamicStatistic = exports.ODBaseStatistic = exports.ODStatistic = exports.ODStatisticGlobalScope = exports.ODStatisticScope = exports.ODStatisticManager = void 0;
4
1
  ///////////////////////////////////////
5
2
  //STATISTIC MODULE
6
3
  ///////////////////////////////////////
7
- const base_1 = require("./base");
4
+ import { ODId, ODManager, ODManagerData, ODSystemError } from "./base.js";
8
5
  /**## ODStatisticManager `class`
9
6
  * This is an Open Discord statistics manager.
10
7
  *
@@ -13,7 +10,7 @@ const base_1 = require("./base");
13
10
  *
14
11
  * Statistic can be accessed in the individual scopes.
15
12
  */
16
- class ODStatisticManager extends base_1.ODManager {
13
+ export class ODStatisticManager extends ODManager {
17
14
  /**Alias to Open Discord debugger. */
18
15
  #debug;
19
16
  /**Alias to Open Discord statistics database. */
@@ -37,7 +34,7 @@ class ODStatisticManager extends base_1.ODManager {
37
34
  /**Init all statistics and run `onInit()` listeners. */
38
35
  async init() {
39
36
  if (!this.database)
40
- throw new base_1.ODSystemError("Unable to initialize statistics scopes due to missing database!");
37
+ throw new ODSystemError("Unable to initialize statistics scopes due to missing database!");
41
38
  //get all valid categories
42
39
  const validCategories = [];
43
40
  for (const scope of this.getAll()) {
@@ -67,8 +64,6 @@ class ODStatisticManager extends base_1.ODManager {
67
64
  return;
68
65
  const data = await this.database.getAll();
69
66
  for (const d of data) {
70
- if (!this.database)
71
- return;
72
67
  await this.database.delete(d.category, d.key);
73
68
  }
74
69
  }
@@ -86,7 +81,6 @@ class ODStatisticManager extends base_1.ODManager {
86
81
  return super.exists(id);
87
82
  }
88
83
  }
89
- exports.ODStatisticManager = ODStatisticManager;
90
84
  /**## ODStatisticScope `class`
91
85
  * This is an Open Discord statistic scope.
92
86
  *
@@ -95,7 +89,7 @@ exports.ODStatisticManager = ODStatisticManager;
95
89
  *
96
90
  * The built-in Open Discord scopes are: `global`, `user`, `ticket`
97
91
  */
98
- class ODStatisticScope extends base_1.ODManager {
92
+ export class ODStatisticScope extends ODManager {
99
93
  /**The id of this statistics scope. */
100
94
  id;
101
95
  /**Is this scope already initialized? */
@@ -106,7 +100,7 @@ class ODStatisticScope extends base_1.ODManager {
106
100
  name;
107
101
  constructor(id, name) {
108
102
  super();
109
- this.id = new base_1.ODId(id);
103
+ this.id = new ODId(id);
110
104
  this.name = name;
111
105
  }
112
106
  /**Select the database to use to read/write all statistics from/to. (Automatically assigned when used in `ODStatisticManager`) */
@@ -116,7 +110,7 @@ class ODStatisticScope extends base_1.ODManager {
116
110
  async getStat(id, scopeId) {
117
111
  if (!this.database)
118
112
  return null;
119
- const newId = new base_1.ODId(id);
113
+ const newId = new ODId(id);
120
114
  const data = await this.database.get(this.id.value + "_" + newId.value, scopeId);
121
115
  if (typeof data == "undefined") {
122
116
  //set statistics to default value & return
@@ -132,7 +126,7 @@ class ODStatisticScope extends base_1.ODManager {
132
126
  async getAllStats(id) {
133
127
  if (!this.database)
134
128
  return [];
135
- const newId = new base_1.ODId(id);
129
+ const newId = new ODId(id);
136
130
  const data = await this.database.getCategory(this.id.value + "_" + newId.value) ?? [];
137
131
  const output = [];
138
132
  for (const stat of data) {
@@ -222,7 +216,6 @@ class ODStatisticScope extends base_1.ODManager {
222
216
  return super.exists(id);
223
217
  }
224
218
  }
225
- exports.ODStatisticScope = ODStatisticScope;
226
219
  /**## ODStatisticGlobalScope `class`
227
220
  * This is an Open Discord statistic global scope.
228
221
  *
@@ -231,7 +224,7 @@ exports.ODStatisticScope = ODStatisticScope;
231
224
  *
232
225
  * This scope is made specifically for the global statistics of Open Discord.
233
226
  */
234
- class ODStatisticGlobalScope extends ODStatisticScope {
227
+ export class ODStatisticGlobalScope extends ODStatisticScope {
235
228
  getStat(id) {
236
229
  return super.getStat(id, "GLOBAL");
237
230
  }
@@ -248,7 +241,6 @@ class ODStatisticGlobalScope extends ODStatisticScope {
248
241
  return super.render("GLOBAL", guild, channel, user);
249
242
  }
250
243
  }
251
- exports.ODStatisticGlobalScope = ODStatisticGlobalScope;
252
244
  /**## ODStatistic `class`
253
245
  * This is an Open Discord statistic.
254
246
  *
@@ -257,7 +249,7 @@ exports.ODStatisticGlobalScope = ODStatisticGlobalScope;
257
249
  *
258
250
  * It's recommended to use the `ODBaseStatistic` & `ODDynamicStatistic` classes instead of this one!
259
251
  */
260
- class ODStatistic extends base_1.ODManagerData {
252
+ export class ODStatistic extends ODManagerData {
261
253
  /**The priority of this statistic. */
262
254
  priority;
263
255
  /**The render function of this statistic. */
@@ -271,14 +263,13 @@ class ODStatistic extends base_1.ODManagerData {
271
263
  this.value = value ?? null;
272
264
  }
273
265
  }
274
- exports.ODStatistic = ODStatistic;
275
266
  /**## ODBaseStatistic `class`
276
267
  * This is an Open Discord basic statistic.
277
268
  *
278
269
  * This single statistic will store a number, boolean or string in the database.
279
270
  * Use it to create a simple statistic for any statistics scope.
280
271
  */
281
- class ODBaseStatistic extends ODStatistic {
272
+ export class ODBaseStatistic extends ODStatistic {
282
273
  /**The name of this statistic. Rendered in discord embeds/messages. */
283
274
  name;
284
275
  constructor(id, priority, name, value) {
@@ -288,7 +279,6 @@ class ODBaseStatistic extends ODStatistic {
288
279
  this.name = name;
289
280
  }
290
281
  }
291
- exports.ODBaseStatistic = ODBaseStatistic;
292
282
  /**## ODDynamicStatistic `class`
293
283
  * This is an Open Discord dynamic statistic.
294
284
  *
@@ -297,11 +287,10 @@ exports.ODBaseStatistic = ODBaseStatistic;
297
287
  *
298
288
  * This is used in Open Discord for the live ticket status, participants & system status.
299
289
  */
300
- class ODDynamicStatistic extends ODStatistic {
290
+ export class ODDynamicStatistic extends ODStatistic {
301
291
  constructor(id, priority, render) {
302
292
  super(id, priority, (value, scopeId, guild, channel, user) => {
303
293
  return render(scopeId, guild, channel, user);
304
294
  });
305
295
  }
306
296
  }
307
- exports.ODDynamicStatistic = ODDynamicStatistic;
@@ -1,9 +1,9 @@
1
- import { ODManager, ODManagerData, ODNoGeneric, ODValidId } from "./base";
2
- import { ODMessage } from "./builder";
3
- import { ODDebugger } from "./console";
4
- import { ODButtonResponderInstance } from "./responder";
1
+ import { ODManager, ODManagerData, ODNoGeneric, ODValidId } from "./base.js";
2
+ import { ODMessage } from "./builder.js";
3
+ import { ODDebugger } from "./console.js";
4
+ import { ODButtonResponderInstance } from "./responder.js";
5
5
  import * as discord from "discord.js";
6
- import { ODWorkerManager } from "./worker";
6
+ import { ODWorkerManager } from "./worker.js";
7
7
  /**## ODVerifyBar `class`
8
8
  * This is an Open Discord verifybar.
9
9
  *
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ODVerifyBarManager = exports.ODVerifyBar = void 0;
4
1
  ///////////////////////////////////////
5
2
  //VERIFYBAR MODULE
6
3
  ///////////////////////////////////////
7
- const base_1 = require("./base");
8
- const worker_1 = require("./worker");
4
+ import { ODManager, ODManagerData } from "./base.js";
5
+ import { ODWorkerManager } from "./worker.js";
9
6
  /**## ODVerifyBar `class`
10
7
  * This is an Open Discord verifybar.
11
8
  *
@@ -13,7 +10,7 @@ const worker_1 = require("./worker");
13
10
  *
14
11
  * It doesn't contain the code which activates or spawns the verifybars!
15
12
  */
16
- class ODVerifyBar extends base_1.ODManagerData {
13
+ export class ODVerifyBar extends ODManagerData {
17
14
  /**All workers that will run when the verifybar is accepted. */
18
15
  success;
19
16
  /**All workers that will run when the verifybar is stopped. */
@@ -24,8 +21,8 @@ class ODVerifyBar extends base_1.ODManagerData {
24
21
  enabled;
25
22
  constructor(id, message, enabled) {
26
23
  super(id);
27
- this.success = new worker_1.ODWorkerManager("descending");
28
- this.failure = new worker_1.ODWorkerManager("descending");
24
+ this.success = new ODWorkerManager("descending");
25
+ this.failure = new ODWorkerManager("descending");
29
26
  this.message = message;
30
27
  this.enabled = enabled ?? true;
31
28
  }
@@ -43,7 +40,6 @@ class ODVerifyBar extends base_1.ODManagerData {
43
40
  }
44
41
  }
45
42
  }
46
- exports.ODVerifyBar = ODVerifyBar;
47
43
  /**## ODVerifyBarManager `class`
48
44
  * This is an Open Discord verifybar manager.
49
45
  *
@@ -52,7 +48,7 @@ exports.ODVerifyBar = ODVerifyBar;
52
48
  *
53
49
  * It doesn't contain the code which activates the verifybars! This should be implemented by your own.
54
50
  */
55
- class ODVerifyBarManager extends base_1.ODManager {
51
+ export class ODVerifyBarManager extends ODManager {
56
52
  constructor(debug) {
57
53
  super(debug, "verifybar");
58
54
  }
@@ -66,4 +62,3 @@ class ODVerifyBarManager extends base_1.ODManager {
66
62
  return super.exists(id);
67
63
  }
68
64
  }
69
- exports.ODVerifyBarManager = ODVerifyBarManager;