@open-discord-bots/framework 0.2.12 → 0.2.14

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 +3 -3
  6. package/dist/api/modules/action.js +8 -14
  7. package/dist/api/modules/base.d.ts +2 -2
  8. package/dist/api/modules/base.js +14 -63
  9. package/dist/api/modules/builder.d.ts +3 -3
  10. package/dist/api/modules/builder.js +61 -122
  11. package/dist/api/modules/checker.d.ts +4 -4
  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 +2 -2
  20. package/dist/api/modules/console.js +45 -67
  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 +10 -19
  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 +13 -26
  42. package/dist/api/modules/responder.d.ts +5 -5
  43. package/dist/api/modules/responder.js +66 -125
  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 -20
  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 +1 -1
  53. package/dist/api/modules/worker.js +6 -11
  54. package/dist/cli/editConfig.d.ts +2 -2
  55. package/dist/cli/editConfig.js +189 -229
  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 +36 -43
  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 +9 -49
  68. package/dist/utilities/index.d.ts +1 -1
  69. package/dist/utilities/index.js +21 -72
  70. package/package.json +2 -1
  71. package/src/api/index.ts +26 -26
  72. package/src/api/main.ts +25 -25
  73. package/src/api/modules/action.ts +3 -3
  74. package/src/api/modules/base.ts +2 -2
  75. package/src/api/modules/builder.ts +3 -3
  76. package/src/api/modules/checker.ts +4 -4
  77. package/src/api/modules/client.ts +4 -4
  78. package/src/api/modules/code.ts +2 -2
  79. package/src/api/modules/component.txt +3 -3
  80. package/src/api/modules/config.ts +2 -2
  81. package/src/api/modules/console.ts +2 -2
  82. package/src/api/modules/cooldown.ts +2 -2
  83. package/src/api/modules/database.ts +2 -2
  84. package/src/api/modules/event.ts +2 -2
  85. package/src/api/modules/flag.ts +2 -2
  86. package/src/api/modules/helpmenu.ts +2 -2
  87. package/src/api/modules/language.ts +2 -2
  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 +2 -2
  92. package/src/api/modules/responder.ts +5 -5
  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 -3
  96. package/src/api/modules/verifybar.ts +5 -5
  97. package/src/api/modules/worker.ts +1 -1
  98. package/src/cli/editConfig.ts +3 -3
  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 +2 -2
  105. package/src/utilities/index.ts +2 -2
  106. package/tools/cleanup.js +1 -1
  107. package/tsconfig.json +1 -1
@@ -1,49 +1,10 @@
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
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.ODJsonConfig = exports.ODConfig = exports.ODConfigManager = void 0;
40
1
  ///////////////////////////////////////
41
2
  //CONFIG MODULE
42
3
  ///////////////////////////////////////
43
- const base_1 = require("./base");
44
- const path_1 = __importDefault(require("path"));
45
- const fs_1 = __importDefault(require("fs"));
46
- const fjs = __importStar(require("formatted-json-stringify"));
4
+ import { ODManager, ODManagerData, ODSystemError } from "./base.js";
5
+ import nodepath from "path";
6
+ import fs from "fs";
7
+ import * as fjs from "formatted-json-stringify";
47
8
  /**## ODConfigManager `class`
48
9
  * This is an Open Discord config manager.
49
10
  *
@@ -51,7 +12,7 @@ const fjs = __importStar(require("formatted-json-stringify"));
51
12
  *
52
13
  * You can use this class to get/change/add a config file (`ODConfig`) in your plugin!
53
14
  */
54
- class ODConfigManager extends base_1.ODManager {
15
+ export class ODConfigManager extends ODManager {
55
16
  /**Alias to Open Discord debugger. */
56
17
  #debug;
57
18
  constructor(debug) {
@@ -72,7 +33,7 @@ class ODConfigManager extends base_1.ODManager {
72
33
  await config.init();
73
34
  }
74
35
  catch (err) {
75
- process.emit("uncaughtException", new base_1.ODSystemError(err));
36
+ process.emit("uncaughtException", new ODSystemError(err));
76
37
  }
77
38
  }
78
39
  }
@@ -86,14 +47,13 @@ class ODConfigManager extends base_1.ODManager {
86
47
  return super.exists(id);
87
48
  }
88
49
  }
89
- exports.ODConfigManager = ODConfigManager;
90
50
  /**## ODConfig `class`
91
51
  * This is an Open Discord config helper.
92
52
  * This class doesn't do anything at all, it just gives a template & basic methods for a config. Use `ODJsonConfig` instead!
93
53
  *
94
54
  * You can use this class if you want to create your own config implementation (e.g. `yml`, `xml`,...)!
95
55
  */
96
- class ODConfig extends base_1.ODManagerData {
56
+ export class ODConfig extends ODManagerData {
97
57
  /**The name of the file with extension. */
98
58
  file = "";
99
59
  /**The path to the file relative to the main directory. */
@@ -142,7 +102,6 @@ class ODConfig extends base_1.ODManagerData {
142
102
  this.reloadListeners = [];
143
103
  }
144
104
  }
145
- exports.ODConfig = ODConfig;
146
105
  /**## ODJsonConfig `class`
147
106
  * This is an Open Discord JSON config.
148
107
  * You can use this class to get & edit variables from the config files or to create your own JSON config!
@@ -153,35 +112,35 @@ exports.ODConfig = ODConfig;
153
112
  * //create a config with custom dir: ./plugins/testplugin/test.json
154
113
  * const config = new api.ODJsonConfig("plugin-config","test.json","./plugins/testplugin/")
155
114
  */
156
- class ODJsonConfig extends ODConfig {
115
+ export class ODJsonConfig extends ODConfig {
157
116
  formatter;
158
117
  constructor(id, file, customPath, formatter) {
159
118
  super(id, {});
160
119
  this.file = (file.endsWith(".json")) ? file : file + ".json";
161
- this.path = customPath ? path_1.default.join("./", customPath, this.file) : path_1.default.join("./config/", this.file);
120
+ this.path = customPath ? nodepath.join("./", customPath, this.file) : nodepath.join("./config/", this.file);
162
121
  this.formatter = formatter ?? new fjs.DefaultFormatter(null, true, " ");
163
122
  }
164
123
  /**Init the config. */
165
124
  init() {
166
- if (!fs_1.default.existsSync(this.path))
167
- throw new base_1.ODSystemError("Unable to parse config \"" + path_1.default.join("./", this.path) + "\", the file doesn't exist!");
125
+ if (!fs.existsSync(this.path))
126
+ throw new ODSystemError("Unable to parse config \"" + nodepath.join("./", this.path) + "\", the file doesn't exist!");
168
127
  try {
169
- this.data = JSON.parse(fs_1.default.readFileSync(this.path).toString());
128
+ this.data = JSON.parse(fs.readFileSync(this.path).toString());
170
129
  super.init();
171
130
  }
172
131
  catch (err) {
173
132
  process.emit("uncaughtException", err);
174
- throw new base_1.ODSystemError("Unable to parse config \"" + path_1.default.join("./", this.path) + "\"!");
133
+ throw new ODSystemError("Unable to parse config \"" + nodepath.join("./", this.path) + "\"!");
175
134
  }
176
135
  }
177
136
  /**Reload the config. Be aware that this doesn't update the config data everywhere in the bot! */
178
137
  reload() {
179
138
  if (!this.initiated)
180
- throw new base_1.ODSystemError("Unable to reload config \"" + path_1.default.join("./", this.path) + "\", the file hasn't been initiated yet!");
181
- if (!fs_1.default.existsSync(this.path))
182
- throw new base_1.ODSystemError("Unable to reload config \"" + path_1.default.join("./", this.path) + "\", the file doesn't exist!");
139
+ throw new ODSystemError("Unable to reload config \"" + nodepath.join("./", this.path) + "\", the file hasn't been initiated yet!");
140
+ if (!fs.existsSync(this.path))
141
+ throw new ODSystemError("Unable to reload config \"" + nodepath.join("./", this.path) + "\", the file doesn't exist!");
183
142
  try {
184
- this.data = JSON.parse(fs_1.default.readFileSync(this.path).toString());
143
+ this.data = JSON.parse(fs.readFileSync(this.path).toString());
185
144
  super.reload();
186
145
  this.reloadListeners.forEach((cb) => {
187
146
  try {
@@ -194,22 +153,21 @@ class ODJsonConfig extends ODConfig {
194
153
  }
195
154
  catch (err) {
196
155
  process.emit("uncaughtException", err);
197
- throw new base_1.ODSystemError("Unable to reload config \"" + path_1.default.join("./", this.path) + "\"!");
156
+ throw new ODSystemError("Unable to reload config \"" + nodepath.join("./", this.path) + "\"!");
198
157
  }
199
158
  }
200
159
  /**Save the edited config to the filesystem. This is used by the Interactive Setup CLI. It's not recommended to use this while the bot is running. */
201
160
  save() {
202
161
  if (!this.initiated)
203
- throw new base_1.ODSystemError("Unable to save config \"" + path_1.default.join("./", this.path) + "\", the file hasn't been initiated yet!");
162
+ throw new ODSystemError("Unable to save config \"" + nodepath.join("./", this.path) + "\", the file hasn't been initiated yet!");
204
163
  try {
205
164
  const contents = this.formatter.stringify(this.data);
206
- fs_1.default.writeFileSync(this.path, contents);
165
+ fs.writeFileSync(this.path, contents);
207
166
  super.save();
208
167
  }
209
168
  catch (err) {
210
169
  process.emit("uncaughtException", err);
211
- throw new base_1.ODSystemError("Unable to save config \"" + path_1.default.join("./", this.path) + "\"!");
170
+ throw new ODSystemError("Unable to save config \"" + nodepath.join("./", this.path) + "\"!");
212
171
  }
213
172
  }
214
173
  }
215
- exports.ODJsonConfig = ODJsonConfig;
@@ -1,5 +1,5 @@
1
- import { ODHTTPGetRequest, ODVersion, ODManager, ODManagerData, ODValidId, ODNoGeneric } from "./base";
2
- import { ODMain } from "../main";
1
+ import { ODHTTPGetRequest, ODVersion, ODManager, ODManagerData, ODValidId, ODNoGeneric } from "./base.js";
2
+ import { ODMain } from "../main.js";
3
3
  /**## ODValidConsoleColor `type`
4
4
  * This is a collection of all the supported console colors within Open Discord.
5
5
  */
@@ -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.ODErrorConsoleMessage = exports.ODWarningConsoleMessage = exports.ODDebugConsoleMessage = exports.ODPluginConsoleMessage = exports.ODSystemConsoleMessage = exports.ODInfoConsoleMessage = 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
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 ODInfoConsoleMessage 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.ODInfoConsoleMessage = ODInfoConsoleMessage;
115
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 ODSystemConsoleMessage 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.ODSystemConsoleMessage = ODSystemConsoleMessage;
126
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 ODPluginConsoleMessage 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.ODPluginConsoleMessage = ODPluginConsoleMessage;
137
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 ODDebugConsoleMessage 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.ODDebugConsoleMessage = ODDebugConsoleMessage;
148
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 ODWarningConsoleMessage 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.ODWarningConsoleMessage = ODWarningConsoleMessage;
159
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 ODErrorConsoleMessage 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.ODErrorConsoleMessage = ODErrorConsoleMessage;
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 */
@@ -186,16 +173,16 @@ class ODError {
186
173
  try {
187
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 */
@@ -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. */
@@ -414,7 +398,6 @@ class ODDebugger {
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 == "normal" ? "white" : 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 == "normal" ? "white" : 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
  */