@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,65 +1,14 @@
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.easterEggs = exports.sharedFuses = void 0;
40
- exports.checkNodeVersion = checkNodeVersion;
41
- exports.moduleInstalled = moduleInstalled;
42
- exports.initialStartupLogs = initialStartupLogs;
43
- exports.timer = timer;
44
- exports.emojiTitle = emojiTitle;
45
- exports.runAsync = runAsync;
46
- exports.timedAwait = timedAwait;
47
- exports.dateString = dateString;
48
- exports.asyncReplace = asyncReplace;
49
- exports.getLongestLength = getLongestLength;
50
- exports.ordinalNumber = ordinalNumber;
51
- exports.trimEmojis = trimEmojis;
52
- const fs = __importStar(require("fs"));
53
- const ansis_1 = __importDefault(require("ansis"));
54
- const api = __importStar(require("../api/index"));
1
+ import * as fs from "fs";
2
+ import ansis from "ansis";
3
+ import * as api from "../api/index.js";
55
4
  /**## sharedFuses `utility variable`
56
5
  * All shared fuses from Open Discord. Please use `opendiscord.sharedFuses` instead!
57
6
  */
58
- exports.sharedFuses = new api.ODSharedFuseManager();
7
+ export const sharedFuses = new api.ODSharedFuseManager();
59
8
  /**## checkNodeVersion `utility function`
60
9
  * Check if the node.js version is v20 or higher.
61
10
  */
62
- function checkNodeVersion(project) {
11
+ export function checkNodeVersion(project) {
63
12
  const nodev = process.versions.node.split(".");
64
13
  if (Number(nodev[0]) < 20) {
65
14
  const title = (project == "openticket") ? "OPEN TICKET" : "OPEN MODERATION";
@@ -71,7 +20,7 @@ function checkNodeVersion(project) {
71
20
  * Use this function to check if an npm package is installed or not!
72
21
  * @example utilities.moduleInstalled("discord.js") //check if discord.js is installed
73
22
  */
74
- function moduleInstalled(id, throwError) {
23
+ export function moduleInstalled(id, throwError) {
75
24
  try {
76
25
  require.resolve(id);
77
26
  return true;
@@ -86,7 +35,7 @@ function moduleInstalled(id, throwError) {
86
35
  * Use this function to check if an npm package is installed or not!
87
36
  * @example utilities.moduleInstalled("discord.js") //check if discord.js is installed
88
37
  */
89
- function initialStartupLogs(opendiscord, project) {
38
+ export function initialStartupLogs(opendiscord, project) {
90
39
  const title = (project == "openticket") ? "OPEN TICKET" : "OPEN MODERATION";
91
40
  console.log("\n--------------------------- " + title + " STARTUP ---------------------------");
92
41
  opendiscord.log("Logging system activated!", "system");
@@ -109,7 +58,7 @@ function initialStartupLogs(opendiscord, project) {
109
58
  * Use this to wait for a certain amount of milliseconds. This only works when using `await`
110
59
  * @example await utilities.timer(1000) //wait 1sec
111
60
  */
112
- async function timer(ms) {
61
+ export async function timer(ms) {
113
62
  return new Promise((resolve) => {
114
63
  setTimeout(() => {
115
64
  resolve();
@@ -120,9 +69,9 @@ async function timer(ms) {
120
69
  * Use this function to create a title with an emoji before/after the text. The style & divider are set in `opendiscord.sharedFuses`
121
70
  * @example utilities.emojiTitle("📎","Links") //create a title with an emoji based on the bot emoji style
122
71
  */
123
- function emojiTitle(emoji, text) {
124
- const style = exports.sharedFuses.getFuse("emojiTitleStyle");
125
- const divider = exports.sharedFuses.getFuse("emojiTitleDivider");
72
+ export function emojiTitle(emoji, text) {
73
+ const style = sharedFuses.getFuse("emojiTitleStyle");
74
+ const divider = sharedFuses.getFuse("emojiTitleDivider");
126
75
  if (style == "disabled")
127
76
  return text;
128
77
  else if (style == "before")
@@ -137,13 +86,13 @@ function emojiTitle(emoji, text) {
137
86
  /**## runAsync `utility function`
138
87
  * Use this function to run a snippet of code asyncronous without creating a separate function for it!
139
88
  */
140
- async function runAsync(func) {
89
+ export async function runAsync(func) {
141
90
  func();
142
91
  }
143
92
  /**## timedAwait `utility function`
144
93
  * Use this function to await a promise but reject after the certain timeout has been reached.
145
94
  */
146
- function timedAwait(promise, timeout, onError) {
95
+ export function timedAwait(promise, timeout, onError) {
147
96
  let allowResolve = true;
148
97
  return new Promise(async (resolve, reject) => {
149
98
  //set timeout & stop if it is before the promise resolved
@@ -166,13 +115,13 @@ function timedAwait(promise, timeout, onError) {
166
115
  /**## dateString `utility function`
167
116
  * Use this function to create a short date string in the following format: `DD/MM/YYYY HH:MM:SS`
168
117
  */
169
- function dateString(date) {
118
+ export function dateString(date) {
170
119
  return `${date.getDate()}/${date.getMonth() + 1}/${date.getFullYear()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
171
120
  }
172
121
  /**## asyncReplace `utility function`
173
122
  * Same as `string.replace(search, value)` but with async compatibility
174
123
  */
175
- async function asyncReplace(text, regex, func) {
124
+ export async function asyncReplace(text, regex, func) {
176
125
  const promises = [];
177
126
  text.replace(regex, (match, ...args) => {
178
127
  promises.push(func(match, ...args));
@@ -188,13 +137,13 @@ async function asyncReplace(text, regex, func) {
188
137
  /**## getLongestLength `utility function`
189
138
  * Get the length of the longest string in the array.
190
139
  */
191
- function getLongestLength(texts) {
192
- return Math.max(...texts.map((t) => ansis_1.default.strip(t).length));
140
+ export function getLongestLength(texts) {
141
+ return Math.max(...texts.map((t) => ansis.strip(t).length));
193
142
  }
194
143
  /**## ordinalNumber `utility function`
195
144
  * Get a human readable ordinal number (e.g. 1st, 2nd, 3rd, 4th, ...) from a Javascript number.
196
145
  */
197
- function ordinalNumber(num) {
146
+ export function ordinalNumber(num) {
198
147
  const i = Math.abs(Math.round(num));
199
148
  const cent = i % 100;
200
149
  if (cent >= 10 && cent <= 20)
@@ -211,13 +160,13 @@ function ordinalNumber(num) {
211
160
  /**## trimEmojis `utility function`
212
161
  * Trim/remove all emoji's from a Javascript string.
213
162
  */
214
- function trimEmojis(text) {
163
+ export function trimEmojis(text) {
215
164
  return text.replace(/(\p{Extended_Pictographic}(?:\uFE0F|\uFE0E)?(?:\u200D\p{Extended_Pictographic}(?:\uFE0F|\uFE0E)?)*)/gu, "");
216
165
  }
217
166
  /**## easterEggs `utility object`
218
167
  * Object containing data for Open Ticket easter eggs.
219
168
  */
220
- exports.easterEggs = {
169
+ export const easterEggs = {
221
170
  /* THANK YOU TO ALL OUR CONTRIBUTORS!!! */
222
171
  creator: "779742674932072469", //DJj123dj
223
172
  translators: [
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@open-discord-bots/framework",
3
3
  "author": "DJj123dj",
4
- "version": "0.2.11",
4
+ "version": "0.2.13",
5
5
  "description": "The core framework of the popular open-source discord bots: Open Ticket & Open Moderation.",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
8
+ "type": "module",
8
9
  "scripts": {
9
10
  "build": "node ./tools/cleanup.js && tsc -p ./tsconfig.json"
10
11
  },
@@ -14,10 +15,10 @@
14
15
  "@discordjs/rest": "^2.6.1",
15
16
  "@types/terminal-kit": "^2.5.7",
16
17
  "ansis": "^4.2.0",
17
- "discord.js": "^14.26.0",
18
- "formatted-json-stringify": "^1.2.1",
18
+ "discord.js": "^14.26.3",
19
+ "formatted-json-stringify": "^1.3.0",
19
20
  "terminal-kit": "^3.1.2",
20
- "typescript": "^5.9.3"
21
+ "typescript": "^6.0.3"
21
22
  },
22
23
  "repository": {
23
24
  "type": "git",
package/src/api/index.ts CHANGED
@@ -1,29 +1,29 @@
1
1
  //MAIN MODULE
2
- export * from "./main"
2
+ export * from "./main.js"
3
3
 
4
4
  //BASE MODULES
5
- export * from "./modules/base"
6
- export * from "./modules/event"
7
- export * from "./modules/config"
8
- export * from "./modules/database"
9
- export * from "./modules/language"
10
- export * from "./modules/flag"
11
- export * from "./modules/console"
12
- export * from "./modules/fuse"
13
- export * from "./modules/plugin"
14
- export * from "./modules/checker"
15
- export * from "./modules/client"
16
- export * from "./modules/worker"
17
- export * from "./modules/builder"
18
- export * from "./modules/responder"
19
- export * from "./modules/action"
20
- export * from "./modules/permission"
21
- export * from "./modules/helpmenu"
22
- export * from "./modules/session"
23
- export * from "./modules/statistic"
24
- export * from "./modules/code"
25
- export * from "./modules/cooldown"
26
- export * from "./modules/post"
27
- export * from "./modules/verifybar"
28
- export * from "./modules/progressbar"
29
- export * from "./modules/startscreen"
5
+ export * from "./modules/base.js"
6
+ export * from "./modules/event.js"
7
+ export * from "./modules/config.js"
8
+ export * from "./modules/database.js"
9
+ export * from "./modules/language.js"
10
+ export * from "./modules/flag.js"
11
+ export * from "./modules/console.js"
12
+ export * from "./modules/fuse.js"
13
+ export * from "./modules/plugin.js"
14
+ export * from "./modules/checker.js"
15
+ export * from "./modules/client.js"
16
+ export * from "./modules/worker.js"
17
+ export * from "./modules/builder.js"
18
+ export * from "./modules/responder.js"
19
+ export * from "./modules/action.js"
20
+ export * from "./modules/permission.js"
21
+ export * from "./modules/helpmenu.js"
22
+ export * from "./modules/session.js"
23
+ export * from "./modules/statistic.js"
24
+ export * from "./modules/code.js"
25
+ export * from "./modules/cooldown.js"
26
+ export * from "./modules/post.js"
27
+ export * from "./modules/verifybar.js"
28
+ export * from "./modules/progressbar.js"
29
+ export * from "./modules/startscreen.js"
package/src/api/main.ts CHANGED
@@ -1,28 +1,28 @@
1
1
  //BASE MODULES
2
- import { ODEnvHelper, ODProjectType, ODVersion, ODVersionManager } from "./modules/base"
3
- import { ODConsoleManager, ODConsoleMessage, ODConsoleMessageParam, ODConsoleMessageTypes, ODDebugFileManager, ODDebugger, ODError, ODLiveStatusManager } from "./modules/console"
4
- import { ODCheckerManager } from "./modules/checker"
5
- import { ODEventManager } from "./modules/event"
6
- import { ODPluginManager } from "./modules/plugin"
7
- import { ODFlagManager } from "./modules/flag"
8
- import { ODProgressBarManager } from "./modules/progressbar"
9
- import { ODConfigManager } from "./modules/config"
10
- import { ODDatabaseManager } from "./modules/database"
11
- import { ODSessionManager } from "./modules/session"
12
- import { ODLanguageManager } from "./modules/language"
13
- import { ODBuilderManager } from "./modules/builder"
14
- import { ODResponderManager } from "./modules/responder"
15
- import { ODActionManager } from "./modules/action"
16
- import { ODVerifyBarManager } from "./modules/verifybar"
17
- import { ODPermissionManager } from "./modules/permission"
18
- import { ODCooldownManager } from "./modules/cooldown"
19
- import { ODHelpMenuManager } from "./modules/helpmenu"
20
- import { ODStatisticManager } from "./modules/statistic"
21
- import { ODCodeManager } from "./modules/code"
22
- import { ODPostManager } from "./modules/post"
23
- import { ODClientManager } from "./modules/client"
24
- import { ODSharedFuseManager } from "./modules/fuse"
25
- import { ODStartScreenManager } from "./modules/startscreen"
2
+ import { ODEnvHelper, ODProjectType, ODVersion, ODVersionManager } from "./modules/base.js"
3
+ import { ODConsoleManager, ODConsoleMessage, ODConsoleMessageParam, ODConsoleMessageTypes, ODDebugFileManager, ODDebugger, ODError, ODLiveStatusManager } from "./modules/console.js"
4
+ import { ODCheckerManager } from "./modules/checker.js"
5
+ import { ODEventManager } from "./modules/event.js"
6
+ import { ODPluginManager } from "./modules/plugin.js"
7
+ import { ODFlagManager } from "./modules/flag.js"
8
+ import { ODProgressBarManager } from "./modules/progressbar.js"
9
+ import { ODConfigManager } from "./modules/config.js"
10
+ import { ODDatabaseManager } from "./modules/database.js"
11
+ import { ODSessionManager } from "./modules/session.js"
12
+ import { ODLanguageManager } from "./modules/language.js"
13
+ import { ODBuilderManager } from "./modules/builder.js"
14
+ import { ODResponderManager } from "./modules/responder.js"
15
+ import { ODActionManager } from "./modules/action.js"
16
+ import { ODVerifyBarManager } from "./modules/verifybar.js"
17
+ import { ODPermissionManager } from "./modules/permission.js"
18
+ import { ODCooldownManager } from "./modules/cooldown.js"
19
+ import { ODHelpMenuManager } from "./modules/helpmenu.js"
20
+ import { ODStatisticManager } from "./modules/statistic.js"
21
+ import { ODCodeManager } from "./modules/code.js"
22
+ import { ODPostManager } from "./modules/post.js"
23
+ import { ODClientManager } from "./modules/client.js"
24
+ import { ODSharedFuseManager } from "./modules/fuse.js"
25
+ import { ODStartScreenManager } from "./modules/startscreen.js"
26
26
 
27
27
  /**## ODMainManagers `interface`
28
28
  * The global properties for the main class of the bot.
@@ -142,7 +142,7 @@ export class ODMain implements ODMainManagers {
142
142
  constructor(managers:ODMainManagers,project:ODProjectType){
143
143
  this.project = project
144
144
  this.versions = managers.versions
145
- this.versions.add(ODVersion.fromString("opendiscord:api","v0.2.11"))
145
+ this.versions.add(ODVersion.fromString("opendiscord:api","v0.2.13"))
146
146
  this.versions.add(ODVersion.fromString("opendiscord:livestatus","v2.0.0"))
147
147
 
148
148
  this.debugfile = managers.debugfile
@@ -1,9 +1,9 @@
1
1
  ///////////////////////////////////////
2
2
  //ACTION MODULE
3
3
  ///////////////////////////////////////
4
- import { ODId, ODManager, ODValidId, ODSystemError, ODManagerData, ODNoGeneric } from "./base"
5
- import { ODWorkerManager, ODWorkerCallback, ODWorker } from "./worker"
6
- import { ODDebugger } from "./console"
4
+ import { ODId, ODManager, ODValidId, ODSystemError, ODManagerData, ODNoGeneric } from "./base.js"
5
+ import { ODWorkerManager, ODWorkerCallback, ODWorker } from "./worker.js"
6
+ import { ODDebugger } from "./console.js"
7
7
 
8
8
  /**## ODActionImplementation `class`
9
9
  * This is an Open Discord action implementation.
@@ -12,17 +12,17 @@ import { ODDebugger } from "./console"
12
12
  *
13
13
  * This class can't be used stand-alone & needs to be extended from!
14
14
  */
15
- export class ODActionImplementation<Source extends string,Params extends object,Result extends object,WorkerIds extends string = string> extends ODManagerData {
15
+ export class ODActionImplementation<Origin extends string,Params extends object,Result extends object,WorkerIds extends string = string> extends ODManagerData {
16
16
  /**The manager that has all workers of this implementation */
17
- workers: ODWorkerManager<Partial<Result>,Source,Params,WorkerIds>
17
+ workers: ODWorkerManager<Partial<Result>,Origin,Params,WorkerIds>
18
18
 
19
- constructor(id:ODValidId, callback?:ODWorkerCallback<Result,Source,Params>, priority?:number, callbackId?:ODValidId){
19
+ constructor(id:ODValidId, callback?:ODWorkerCallback<Partial<Result>,Origin,Params>, priority?:number, callbackId?:ODValidId){
20
20
  super(id)
21
21
  this.workers = new ODWorkerManager("descending")
22
22
  if (callback) this.workers.add(new ODWorker(callbackId ? callbackId : id,priority ?? 0,callback))
23
23
  }
24
24
  /**Execute all workers & return the result. */
25
- async run(source:Source, params:Params): Promise<Partial<Result>> {
25
+ async run(origin:Origin, params:Params): Promise<Partial<Result>> {
26
26
  throw new ODSystemError("Tried to build an unimplemented ODResponderImplementation")
27
27
  }
28
28
  }
@@ -30,7 +30,7 @@ export class ODActionImplementation<Source extends string,Params extends object,
30
30
  /**## ODActionManagerIdConstraint `type`
31
31
  * The constraint/layout for id mappings/interfaces of the `ODActionManager` class.
32
32
  */
33
- export type ODActionManagerIdConstraint = Record<string,{source:string,params:object,result:object,workers:string}>
33
+ export type ODActionManagerIdConstraint = Record<string,{origin:string,params:object,result:object,workers:string}>
34
34
 
35
35
  /**## ODActionManager `class`
36
36
  * This is an Open Discord action manager.
@@ -47,14 +47,14 @@ export class ODActionManager<IdList extends ODActionManagerIdConstraint = ODActi
47
47
  super(debug,"action")
48
48
  }
49
49
 
50
- get<ActionId extends keyof ODNoGeneric<IdList>>(id:ActionId): ODAction<IdList[ActionId]["source"],IdList[ActionId]["params"],IdList[ActionId]["result"],IdList[ActionId]["workers"]>
50
+ get<ActionId extends keyof ODNoGeneric<IdList>>(id:ActionId): ODAction<IdList[ActionId]["origin"],IdList[ActionId]["params"],IdList[ActionId]["result"],IdList[ActionId]["workers"]>
51
51
  get(id:ODValidId): ODAction<string,{},{},string>|null
52
52
 
53
53
  get(id:ODValidId): ODAction<string,{},{},string>|null {
54
54
  return super.get(id)
55
55
  }
56
56
 
57
- remove<ActionId extends keyof ODNoGeneric<IdList>>(id:ActionId): ODAction<IdList[ActionId]["source"],IdList[ActionId]["params"],IdList[ActionId]["result"],IdList[ActionId]["workers"]>
57
+ remove<ActionId extends keyof ODNoGeneric<IdList>>(id:ActionId): ODAction<IdList[ActionId]["origin"],IdList[ActionId]["params"],IdList[ActionId]["result"],IdList[ActionId]["workers"]>
58
58
  remove(id:ODValidId): ODAction<string,{},{},string>|null
59
59
 
60
60
  remove(id:ODValidId): ODAction<string,{},{},string>|null {
@@ -76,14 +76,14 @@ export class ODActionManager<IdList extends ODActionManagerIdConstraint = ODActi
76
76
  *
77
77
  * Can be used standalone.
78
78
  */
79
- export class ODAction<Source extends string,Params extends object,Result extends object,WorkerIds extends string = string> extends ODActionImplementation<Source,Params,Result,WorkerIds> {
79
+ export class ODAction<Origin extends string,Params extends object,Result extends object,WorkerIds extends string = string> extends ODActionImplementation<Origin,Params,Result,WorkerIds> {
80
80
  /**Run this action */
81
- async run(source:Source, params:Params): Promise<Partial<Result>> {
81
+ async run(origin:Origin, params:Params): Promise<Partial<Result>> {
82
82
  //create instance
83
83
  const instance = {}
84
84
 
85
85
  //wait for workers to finish
86
- await this.workers.executeWorkers(instance,source,params)
86
+ await this.workers.executeWorkers(instance,origin,params)
87
87
 
88
88
  //return data generated by workers
89
89
  return instance
@@ -2,8 +2,8 @@
2
2
  //BASE MODULE
3
3
  ///////////////////////////////////////
4
4
  import * as fs from "fs"
5
- import { ODDebugger } from "./console"
6
- import type { ODMain } from "../main"
5
+ import { ODDebugger } from "./console.js"
6
+ import type { ODMain } from "../main.js"
7
7
 
8
8
  /**## ODPromiseVoid `type`
9
9
  * This is a simple type to represent a callback return value that could be a promise or not.
@@ -37,7 +37,7 @@ export type ODValidId = string|number|symbol|ODId
37
37
  *
38
38
  * list: `string`, `number`, `boolean`, `array`, `object`, `null`
39
39
  */
40
- export type ODValidJsonType = string|number|boolean|object|ODValidJsonType[]|null
40
+ export type ODValidJsonType = string|number|boolean|{[key:string]:ODValidJsonType}|ODValidJsonType[]|null
41
41
 
42
42
  /**## ODInterfaceWithPartialProperty `type`
43
43
  * A utility type to create an interface where some properties are optional!
@@ -734,9 +734,9 @@ export class ODHTTPPostRequest {
734
734
  */
735
735
  export class ODEnvHelper {
736
736
  /**All variables found in the `.env` file */
737
- dotenv: object
737
+ dotenv: Record<string,any>
738
738
  /**All variables found in `process.env` */
739
- env: object
739
+ env: Record<string,any>
740
740
 
741
741
  constructor(customEnvPath?:string){
742
742
  if (typeof customEnvPath != "undefined" && typeof customEnvPath != "string") throw new ODSystemError("Invalid constructor parameter => customEnvPath?:string")
@@ -767,7 +767,7 @@ export class ODEnvHelper {
767
767
  //Source: https://github.com/motdotla/dotenv/blob/master/lib/main.js#L12
768
768
  #readDotEnv(src:Buffer){
769
769
  const LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg
770
- const obj = {}
770
+ const obj: Record<string,any> = {}
771
771
 
772
772
  // Convert buffer to string
773
773
  let lines = src.toString()
@@ -815,8 +815,10 @@ export class ODSystemError extends Error {
815
815
 
816
816
  /**Create an `ODSystemError` directly from an `Error` class */
817
817
  static fromError(err:Error){
818
- err["_ODErrorType"] = "system"
819
- return err as ODSystemError
818
+ const modifiedErr: ODSystemError = Object.assign(err,{
819
+ _ODErrorType:"system"
820
+ })
821
+ return modifiedErr as ODSystemError
820
822
  }
821
823
  }
822
824
 
@@ -831,8 +833,10 @@ export class ODPluginError extends Error {
831
833
 
832
834
  /**Create an `ODPluginError` directly from an `Error` class */
833
835
  static fromError(err:Error){
834
- err["_ODErrorType"] = "plugin"
835
- return err as ODPluginError
836
+ const modifiedErr: ODPluginError = Object.assign(err,{
837
+ _ODErrorType:"plugin"
838
+ })
839
+ return modifiedErr as ODPluginError
836
840
  }
837
841
  }
838
842