@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,46 +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
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.ODAutocompleteManager = exports.ODContextMenu = exports.ODContextMenuManager = exports.ODContextMenuComparator = exports.ODTextCommandManager = exports.ODTextCommand = exports.ODSlashCommand = exports.ODSlashCommandManager = exports.ODSlashCommandComparator = exports.ODClientActivityManager = exports.ODClientManager = void 0;
37
1
  ///////////////////////////////////////
38
2
  //DISCORD CLIENT MODULE
39
3
  ///////////////////////////////////////
40
- const base_1 = require("./base");
41
- const discord = __importStar(require("discord.js"));
42
- const rest_1 = require("@discordjs/rest");
43
- const console_1 = require("./console");
4
+ import { ODManager, ODManagerData, ODSystemError } from "./base.js";
5
+ import * as discord from "discord.js";
6
+ import { REST } from "@discordjs/rest";
7
+ import { ODWarningConsoleMessage } from "./console.js";
44
8
  /**## ODClientManager `class`
45
9
  * This is an Open Discord client manager.
46
10
  *
@@ -48,7 +12,7 @@ const console_1 = require("./console");
48
12
  *
49
13
  * If you want, you can also listen for custom events on the `ODClientManager.client` variable (`discord.Client`)
50
14
  */
51
- class ODClientManager {
15
+ export class ODClientManager {
52
16
  /**Alias to Open Discord debugger. */
53
17
  #debug;
54
18
  /**List of required bot intents. Add intents to this list using the `onClientLoad` event. */
@@ -72,7 +36,7 @@ class ODClientManager {
72
36
  /**The discord.js `discord.Client`. Only use it when initiated! */
73
37
  client = new discord.Client({ intents: [] }); //temporary client
74
38
  /**The discord.js REST client. Used for stuff that discord.js can't handle :) */
75
- rest = new rest_1.REST({ version: "10" });
39
+ rest = new REST({ version: "10" });
76
40
  /**Is the bot initiated? */
77
41
  initiated = false;
78
42
  /**Is the bot logged in? */
@@ -104,13 +68,13 @@ class ODClientManager {
104
68
  /**Initiate the `client` variable & add the intents & partials to the bot. */
105
69
  initClient() {
106
70
  if (!this.intents.every((value) => typeof discord.GatewayIntentBits[value] != "undefined"))
107
- throw new base_1.ODSystemError("Client has non-existing intents!");
71
+ throw new ODSystemError("Client has non-existing intents!");
108
72
  if (!this.privileges.every((value) => typeof { GuildMembers: true, MessageContent: true, Presence: true }[value] != "undefined"))
109
- throw new base_1.ODSystemError("Client has non-existing privileged intents!");
73
+ throw new ODSystemError("Client has non-existing privileged intents!");
110
74
  if (!this.partials.every((value) => typeof discord.Partials[value] != "undefined"))
111
- throw new base_1.ODSystemError("Client has non-existing partials!");
75
+ throw new ODSystemError("Client has non-existing partials!");
112
76
  if (!this.permissions.every((value) => typeof discord.PermissionFlagsBits[value] != "undefined"))
113
- throw new base_1.ODSystemError("Client has non-existing partials!");
77
+ throw new ODSystemError("Client has non-existing partials!");
114
78
  const intents = this.intents.map((value) => discord.GatewayIntentBits[value]);
115
79
  const partials = this.partials.map((value) => discord.Partials[value]);
116
80
  const oldClient = this.client;
@@ -132,9 +96,9 @@ class ODClientManager {
132
96
  /**Get all servers the bot is part of. */
133
97
  async getGuilds() {
134
98
  if (!this.initiated)
135
- throw new base_1.ODSystemError("Client isn't initiated yet!");
99
+ throw new ODSystemError("Client isn't initiated yet!");
136
100
  if (!this.ready)
137
- throw new base_1.ODSystemError("Client isn't ready yet!");
101
+ throw new ODSystemError("Client isn't ready yet!");
138
102
  return this.client.guilds.cache.map((guild) => guild);
139
103
  }
140
104
  /**Check if the bot is in a specific guild */
@@ -144,7 +108,7 @@ class ODClientManager {
144
108
  /**Check if a specific guild has all required permissions (or `Administrator`) */
145
109
  checkGuildPerms(guild) {
146
110
  if (!guild.members.me)
147
- throw new base_1.ODSystemError("Client isn't a member in this server!");
111
+ throw new ODSystemError("Client isn't a member in this server!");
148
112
  const perms = guild.members.me.permissions;
149
113
  if (perms.has("Administrator"))
150
114
  return true;
@@ -166,7 +130,7 @@ class ODClientManager {
166
130
  this.ready = true;
167
131
  //set slashCommandManager & contextMenuManager to client applicationCommandManager
168
132
  if (!this.client.application)
169
- throw new base_1.ODSystemError("Couldn't get client application for slashCommand & contextMenu managers!");
133
+ throw new ODSystemError("Couldn't get client application for slashCommand & contextMenu managers!");
170
134
  this.slashCommands.commandManager = this.client.application.commands;
171
135
  this.contextMenus.commandManager = this.client.application.commands;
172
136
  this.autocompletes.commandManager = this.client.application.commands;
@@ -183,10 +147,10 @@ class ODClientManager {
183
147
  if (softErrors)
184
148
  return resolve(false);
185
149
  else if (err.message.toLowerCase().includes("used disallowed intents")) {
186
- process.emit("uncaughtException", new base_1.ODSystemError("Used disallowed intents"));
150
+ process.emit("uncaughtException", new ODSystemError("Used disallowed intents"));
187
151
  }
188
152
  else if (err.message.toLowerCase().includes("tokeninvalid") || err.message.toLowerCase().includes("an invalid token was provided")) {
189
- process.emit("uncaughtException", new base_1.ODSystemError("Invalid discord bot token provided"));
153
+ process.emit("uncaughtException", new ODSystemError("Invalid discord bot token provided"));
190
154
  }
191
155
  else
192
156
  reject("OD Login Error: " + err);
@@ -196,9 +160,9 @@ class ODClientManager {
196
160
  /**A simplified shortcut to get a `discord.User` :) */
197
161
  async fetchUser(id) {
198
162
  if (!this.initiated)
199
- throw new base_1.ODSystemError("Client isn't initiated yet!");
163
+ throw new ODSystemError("Client isn't initiated yet!");
200
164
  if (!this.ready)
201
- throw new base_1.ODSystemError("Client isn't ready yet!");
165
+ throw new ODSystemError("Client isn't ready yet!");
202
166
  try {
203
167
  return await this.client.users.fetch(id);
204
168
  }
@@ -209,9 +173,9 @@ class ODClientManager {
209
173
  /**A simplified shortcut to get a `discord.Guild` :) */
210
174
  async fetchGuild(id) {
211
175
  if (!this.initiated)
212
- throw new base_1.ODSystemError("Client isn't initiated yet!");
176
+ throw new ODSystemError("Client isn't initiated yet!");
213
177
  if (!this.ready)
214
- throw new base_1.ODSystemError("Client isn't ready yet!");
178
+ throw new ODSystemError("Client isn't ready yet!");
215
179
  try {
216
180
  return await this.client.guilds.fetch(id);
217
181
  }
@@ -222,9 +186,9 @@ class ODClientManager {
222
186
  /**A simplified shortcut to get a `discord.Channel` :) */
223
187
  async fetchChannel(id) {
224
188
  if (!this.initiated)
225
- throw new base_1.ODSystemError("Client isn't initiated yet!");
189
+ throw new ODSystemError("Client isn't initiated yet!");
226
190
  if (!this.ready)
227
- throw new base_1.ODSystemError("Client isn't ready yet!");
191
+ throw new ODSystemError("Client isn't ready yet!");
228
192
  try {
229
193
  return await this.client.channels.fetch(id);
230
194
  }
@@ -235,9 +199,9 @@ class ODClientManager {
235
199
  /**A simplified shortcut to get a `discord.GuildBasedChannel` :) */
236
200
  async fetchGuildChannel(guildId, id) {
237
201
  if (!this.initiated)
238
- throw new base_1.ODSystemError("Client isn't initiated yet!");
202
+ throw new ODSystemError("Client isn't initiated yet!");
239
203
  if (!this.ready)
240
- throw new base_1.ODSystemError("Client isn't ready yet!");
204
+ throw new ODSystemError("Client isn't ready yet!");
241
205
  try {
242
206
  const guild = (guildId instanceof discord.Guild) ? guildId : await this.fetchGuild(guildId);
243
207
  if (!guild)
@@ -252,9 +216,9 @@ class ODClientManager {
252
216
  /**A simplified shortcut to get a `discord.TextChannel` :) */
253
217
  async fetchGuildTextChannel(guildId, id) {
254
218
  if (!this.initiated)
255
- throw new base_1.ODSystemError("Client isn't initiated yet!");
219
+ throw new ODSystemError("Client isn't initiated yet!");
256
220
  if (!this.ready)
257
- throw new base_1.ODSystemError("Client isn't ready yet!");
221
+ throw new ODSystemError("Client isn't ready yet!");
258
222
  try {
259
223
  const guild = (guildId instanceof discord.Guild) ? guildId : await this.fetchGuild(guildId);
260
224
  if (!guild)
@@ -271,9 +235,9 @@ class ODClientManager {
271
235
  /**A simplified shortcut to get a `discord.CategoryChannel` :) */
272
236
  async fetchGuildCategoryChannel(guildId, id) {
273
237
  if (!this.initiated)
274
- throw new base_1.ODSystemError("Client isn't initiated yet!");
238
+ throw new ODSystemError("Client isn't initiated yet!");
275
239
  if (!this.ready)
276
- throw new base_1.ODSystemError("Client isn't ready yet!");
240
+ throw new ODSystemError("Client isn't ready yet!");
277
241
  try {
278
242
  const guild = (guildId instanceof discord.Guild) ? guildId : await this.fetchGuild(guildId);
279
243
  if (!guild)
@@ -290,11 +254,11 @@ class ODClientManager {
290
254
  /**A simplified shortcut to get a `discord.GuildMember` :) */
291
255
  async fetchGuildMember(guildId, id) {
292
256
  if (!this.initiated)
293
- throw new base_1.ODSystemError("Client isn't initiated yet!");
257
+ throw new ODSystemError("Client isn't initiated yet!");
294
258
  if (!this.ready)
295
- throw new base_1.ODSystemError("Client isn't ready yet!");
259
+ throw new ODSystemError("Client isn't ready yet!");
296
260
  if (typeof id != "string")
297
- throw new base_1.ODSystemError("TEMP ERROR => ODClientManager.fetchGuildMember() => id param isn't string");
261
+ throw new ODSystemError("TEMP ERROR => ODClientManager.fetchGuildMember() => id param isn't string");
298
262
  try {
299
263
  const guild = (guildId instanceof discord.Guild) ? guildId : await this.fetchGuild(guildId);
300
264
  if (!guild)
@@ -308,11 +272,11 @@ class ODClientManager {
308
272
  /**A simplified shortcut to get a `discord.Role` :) */
309
273
  async fetchGuildRole(guildId, id) {
310
274
  if (!this.initiated)
311
- throw new base_1.ODSystemError("Client isn't initiated yet!");
275
+ throw new ODSystemError("Client isn't initiated yet!");
312
276
  if (!this.ready)
313
- throw new base_1.ODSystemError("Client isn't ready yet!");
277
+ throw new ODSystemError("Client isn't ready yet!");
314
278
  if (typeof id != "string")
315
- throw new base_1.ODSystemError("TEMP ERROR => ODClientManager.fetchGuildRole() => id param isn't string");
279
+ throw new ODSystemError("TEMP ERROR => ODClientManager.fetchGuildRole() => id param isn't string");
316
280
  try {
317
281
  const guild = (guildId instanceof discord.Guild) ? guildId : await this.fetchGuild(guildId);
318
282
  if (!guild)
@@ -325,9 +289,9 @@ class ODClientManager {
325
289
  }
326
290
  async fetchGuildChannelMessage(guildId, channelId, id) {
327
291
  if (!this.initiated)
328
- throw new base_1.ODSystemError("Client isn't initiated yet!");
292
+ throw new ODSystemError("Client isn't initiated yet!");
329
293
  if (!this.ready)
330
- throw new base_1.ODSystemError("Client isn't ready yet!");
294
+ throw new ODSystemError("Client isn't ready yet!");
331
295
  try {
332
296
  if (guildId instanceof discord.TextChannel && typeof channelId == "string") {
333
297
  const channel = guildId;
@@ -349,9 +313,9 @@ class ODClientManager {
349
313
  /**A simplified shortcut to send a DM to a user :) */
350
314
  async sendUserDm(user, message) {
351
315
  if (!this.initiated)
352
- throw new base_1.ODSystemError("Client isn't initiated yet!");
316
+ throw new ODSystemError("Client isn't initiated yet!");
353
317
  if (!this.ready)
354
- throw new base_1.ODSystemError("Client isn't ready yet!");
318
+ throw new ODSystemError("Client isn't ready yet!");
355
319
  try {
356
320
  if (user instanceof discord.User) {
357
321
  if (user.bot)
@@ -383,7 +347,6 @@ class ODClientManager {
383
347
  }
384
348
  }
385
349
  }
386
- exports.ODClientManager = ODClientManager;
387
350
  /**## ODClientActivityManager `class`
388
351
  * This is an Open Discord client activity manager.
389
352
  *
@@ -391,7 +354,7 @@ exports.ODClientManager = ODClientManager;
391
354
  *
392
355
  * It also has a built-in refresh function, so the status will refresh every 10 minutes to keep it visible.
393
356
  */
394
- class ODClientActivityManager {
357
+ export class ODClientActivityManager {
395
358
  /**Alias to Open Discord debugger. */
396
359
  #debug;
397
360
  /**Copy of discord.js client */
@@ -439,7 +402,7 @@ class ODClientActivityManager {
439
402
  /**Update the client status */
440
403
  #updateClientActivity(type, text) {
441
404
  if (!this.#manager.client.user)
442
- throw new base_1.ODSystemError("Couldn't set client status: client.user == undefined");
405
+ throw new ODSystemError("Couldn't set client status: client.user == undefined");
443
406
  if (type == false) {
444
407
  this.#manager.client.user.setActivity();
445
408
  return;
@@ -474,11 +437,10 @@ class ODClientActivityManager {
474
437
  return "";
475
438
  }
476
439
  }
477
- exports.ODClientActivityManager = ODClientActivityManager;
478
440
  /**## ODSlashCommandComparator `class`
479
441
  * A utility class to compare existing slash commands with newly registered ones.
480
442
  */
481
- class ODSlashCommandComparator {
443
+ export class ODSlashCommandComparator {
482
444
  /**Convert a `discord.ApplicationCommandOptionChoiceData<string>` to a universal Open Discord slash command option choice object for comparison. */
483
445
  #convertOptionChoice(choice) {
484
446
  const nameLoc = choice.nameLocalizations ?? {};
@@ -715,7 +677,6 @@ class ODSlashCommandComparator {
715
677
  return true;
716
678
  }
717
679
  }
718
- exports.ODSlashCommandComparator = ODSlashCommandComparator;
719
680
  /**## ODSlashCommandManager `class`
720
681
  * This is an Open Discord client slash manager.
721
682
  *
@@ -723,7 +684,7 @@ exports.ODSlashCommandComparator = ODSlashCommandComparator;
723
684
  *
724
685
  * Here, you can add & remove slash commands & the bot will do the (de)registering.
725
686
  */
726
- class ODSlashCommandManager extends base_1.ODManager {
687
+ export class ODSlashCommandManager extends ODManager {
727
688
  /**Alias to Open Discord debugger. */
728
689
  #debug;
729
690
  /**Refrerence to discord.js client. */
@@ -745,7 +706,7 @@ class ODSlashCommandManager extends base_1.ODManager {
745
706
  /**Get all registered & unregistered slash commands. */
746
707
  async getAllRegisteredCommands(guildId) {
747
708
  if (!this.commandManager)
748
- throw new base_1.ODSystemError("Couldn't get client application to register slash commands!");
709
+ throw new ODSystemError("Couldn't get client application to register slash commands!");
749
710
  const cmds = (await this.commandManager.fetch({ guildId })).toJSON();
750
711
  const registered = [];
751
712
  const unregistered = [];
@@ -783,7 +744,7 @@ class ODSlashCommandManager extends base_1.ODManager {
783
744
  /**Create all commands that are not registered yet.*/
784
745
  async createNewCommands(instances, progress) {
785
746
  if (!this.#manager.ready)
786
- throw new base_1.ODSystemError("Client isn't ready yet! Unable to register slash commands!");
747
+ throw new ODSystemError("Client isn't ready yet! Unable to register slash commands!");
787
748
  if (instances.length > 0 && progress) {
788
749
  progress.max = instances.length;
789
750
  progress.start();
@@ -801,7 +762,7 @@ class ODSlashCommandManager extends base_1.ODManager {
801
762
  /**Update all commands that are already registered. */
802
763
  async updateExistingCommands(instances, progress) {
803
764
  if (!this.#manager.ready)
804
- throw new base_1.ODSystemError("Client isn't ready yet! Unable to register slash commands!");
765
+ throw new ODSystemError("Client isn't ready yet! Unable to register slash commands!");
805
766
  if (instances.length > 0 && progress) {
806
767
  progress.max = instances.length;
807
768
  progress.start();
@@ -816,9 +777,9 @@ class ODSlashCommandManager extends base_1.ODManager {
816
777
  /**Remove all commands that are registered but unused by Open Discord. */
817
778
  async removeUnusedCommands(instances, guildId, progress) {
818
779
  if (!this.#manager.ready)
819
- throw new base_1.ODSystemError("Client isn't ready yet! Unable to register slash commands!");
780
+ throw new ODSystemError("Client isn't ready yet! Unable to register slash commands!");
820
781
  if (!this.commandManager)
821
- throw new base_1.ODSystemError("Couldn't get client application to register slash commands!");
782
+ throw new ODSystemError("Couldn't get client application to register slash commands!");
822
783
  if (instances.length > 0 && progress) {
823
784
  progress.max = instances.length;
824
785
  progress.start();
@@ -833,7 +794,7 @@ class ODSlashCommandManager extends base_1.ODManager {
833
794
  }
834
795
  catch (err) {
835
796
  process.emit("uncaughtException", err);
836
- throw new base_1.ODSystemError("Failed to delete slash command '/" + cmd.name + "'!");
797
+ throw new ODSystemError("Failed to delete slash command '/" + cmd.name + "'!");
837
798
  }
838
799
  }
839
800
  if (progress)
@@ -843,13 +804,13 @@ class ODSlashCommandManager extends base_1.ODManager {
843
804
  /**Create a slash command. **(SYSTEM ONLY)** => Use `ODSlashCommandManager` for registering commands the default way! */
844
805
  async createCmd(cmd) {
845
806
  if (!this.commandManager)
846
- throw new base_1.ODSystemError("Couldn't get client application to register slash commands!");
807
+ throw new ODSystemError("Couldn't get client application to register slash commands!");
847
808
  try {
848
809
  await this.commandManager.create(cmd.builder, (cmd.guildId ?? undefined));
849
810
  }
850
811
  catch (err) {
851
812
  process.emit("uncaughtException", err);
852
- throw new base_1.ODSystemError("Failed to register slash command '/" + cmd.name + "'!");
813
+ throw new ODSystemError("Failed to register slash command '/" + cmd.name + "'!");
853
814
  }
854
815
  }
855
816
  /**Start listening to the discord.js client `interactionCreate` event. */
@@ -879,7 +840,7 @@ class ODSlashCommandManager extends base_1.ODManager {
879
840
  callback
880
841
  });
881
842
  if (this.#interactionListeners.length > this.listenerLimit) {
882
- this.#debug.console.log(new console_1.ODWarningConsoleMessage("Possible slash command interaction memory leak detected!", [
843
+ this.#debug.console.log(new ODWarningConsoleMessage("Possible slash command interaction memory leak detected!", [
883
844
  { key: "listeners", value: this.#interactionListeners.length.toString() }
884
845
  ]));
885
846
  }
@@ -894,7 +855,6 @@ class ODSlashCommandManager extends base_1.ODManager {
894
855
  return super.exists(id);
895
856
  }
896
857
  }
897
- exports.ODSlashCommandManager = ODSlashCommandManager;
898
858
  /**## ODSlashCommand `class`
899
859
  * This is an Open Discord slash command.
900
860
  *
@@ -907,7 +867,7 @@ exports.ODSlashCommandManager = ODSlashCommandManager;
907
867
  *
908
868
  * And more!
909
869
  */
910
- class ODSlashCommand extends base_1.ODManagerData {
870
+ export class ODSlashCommand extends ODManagerData {
911
871
  /**The discord.js builder for this slash command. */
912
872
  builder;
913
873
  /**The id of the guild this command is for. Null when not set. */
@@ -917,7 +877,7 @@ class ODSlashCommand extends base_1.ODManagerData {
917
877
  constructor(id, builder, requiresUpdate, guildId) {
918
878
  super(id);
919
879
  if (builder.type != discord.ApplicationCommandType.ChatInput)
920
- throw new base_1.ODSystemError("ApplicationCommandData is required to be the 'ChatInput' type!");
880
+ throw new ODSystemError("ApplicationCommandData is required to be the 'ChatInput' type!");
921
881
  this.builder = builder;
922
882
  this.guildId = guildId ?? null;
923
883
  this.requiresUpdate = requiresUpdate ?? null;
@@ -930,7 +890,6 @@ class ODSlashCommand extends base_1.ODManagerData {
930
890
  this.builder.name = name;
931
891
  }
932
892
  }
933
- exports.ODSlashCommand = ODSlashCommand;
934
893
  /**## ODTextCommand `class`
935
894
  * This is an Open Discord text command.
936
895
  *
@@ -942,7 +901,7 @@ exports.ODSlashCommand = ODSlashCommand;
942
901
  *
943
902
  * And more!
944
903
  */
945
- class ODTextCommand extends base_1.ODManagerData {
904
+ export class ODTextCommand extends ODManagerData {
946
905
  /**The builder for this slash command. */
947
906
  builder;
948
907
  /**The name of this slash command. */
@@ -953,7 +912,6 @@ class ODTextCommand extends base_1.ODManagerData {
953
912
  this.name = builder.name;
954
913
  }
955
914
  }
956
- exports.ODTextCommand = ODTextCommand;
957
915
  /**## ODTextCommandManager `class`
958
916
  * This is an Open Discord client text manager.
959
917
  *
@@ -961,7 +919,7 @@ exports.ODTextCommand = ODTextCommand;
961
919
  *
962
920
  * Here, you can add & remove text commands & the bot will do the (de)registering.
963
921
  */
964
- class ODTextCommandManager extends base_1.ODManager {
922
+ export class ODTextCommandManager extends ODManager {
965
923
  /**Alias to Open Discord debugger. */
966
924
  #debug;
967
925
  /**Copy of discord.js client. */
@@ -1492,7 +1450,7 @@ class ODTextCommandManager extends base_1.ODManager {
1492
1450
  callback
1493
1451
  });
1494
1452
  if (this.#interactionListeners.length > this.listenerLimit) {
1495
- this.#debug.console.log(new console_1.ODWarningConsoleMessage("Possible text command interaction memory leak detected!", [
1453
+ this.#debug.console.log(new ODWarningConsoleMessage("Possible text command interaction memory leak detected!", [
1496
1454
  { key: "listeners", value: this.#interactionListeners.length.toString() }
1497
1455
  ]));
1498
1456
  }
@@ -1513,18 +1471,17 @@ class ODTextCommandManager extends base_1.ODManager {
1513
1471
  add(data, overwrite) {
1514
1472
  const checkResult = this.#checkBuilderOptions(data.builder);
1515
1473
  if (!checkResult.valid && checkResult.reason == "required_after_optional")
1516
- throw new base_1.ODSystemError("Invalid text command '" + data.id.value + "' => optional options are only allowed at the end of a command!");
1474
+ throw new ODSystemError("Invalid text command '" + data.id.value + "' => optional options are only allowed at the end of a command!");
1517
1475
  else if (!checkResult.valid && checkResult.reason == "allowspaces_not_last")
1518
- throw new base_1.ODSystemError("Invalid text command '" + data.id.value + "' => string option with 'allowSpaces' is only allowed at the end of a command!");
1476
+ throw new ODSystemError("Invalid text command '" + data.id.value + "' => string option with 'allowSpaces' is only allowed at the end of a command!");
1519
1477
  else
1520
1478
  return super.add(data, overwrite);
1521
1479
  }
1522
1480
  }
1523
- exports.ODTextCommandManager = ODTextCommandManager;
1524
1481
  /**## ODContextMenuComparator `class`
1525
1482
  * A utility class to compare existing context menu's with newly registered ones.
1526
1483
  */
1527
- class ODContextMenuComparator {
1484
+ export class ODContextMenuComparator {
1528
1485
  /**Convert a `ODContextMenuBuilder` to a universal Open Discord context menu object for comparison. */
1529
1486
  convertBuilder(builder, guildId) {
1530
1487
  if (builder.type != discord.ApplicationCommandType.Message && builder.type != discord.ApplicationCommandType.User)
@@ -1601,7 +1558,6 @@ class ODContextMenuComparator {
1601
1558
  return true;
1602
1559
  }
1603
1560
  }
1604
- exports.ODContextMenuComparator = ODContextMenuComparator;
1605
1561
  /**## ODContextMenuManager `class`
1606
1562
  * This is an Open Discord client context menu manager.
1607
1563
  *
@@ -1609,7 +1565,7 @@ exports.ODContextMenuComparator = ODContextMenuComparator;
1609
1565
  *
1610
1566
  * Here, you can add & remove context interactions & the bot will do the (de)registering.
1611
1567
  */
1612
- class ODContextMenuManager extends base_1.ODManager {
1568
+ export class ODContextMenuManager extends ODManager {
1613
1569
  /**Alias to Open Discord debugger. */
1614
1570
  #debug;
1615
1571
  /**Refrerence to discord.js client. */
@@ -1631,7 +1587,7 @@ class ODContextMenuManager extends base_1.ODManager {
1631
1587
  /**Get all registered & unregistered message context menu commands. */
1632
1588
  async getAllRegisteredMenus(guildId) {
1633
1589
  if (!this.commandManager)
1634
- throw new base_1.ODSystemError("Couldn't get client application to register message context menus!");
1590
+ throw new ODSystemError("Couldn't get client application to register message context menus!");
1635
1591
  const menus = (await this.commandManager.fetch({ guildId })).toJSON();
1636
1592
  const registered = [];
1637
1593
  const unregistered = [];
@@ -1669,7 +1625,7 @@ class ODContextMenuManager extends base_1.ODManager {
1669
1625
  /**Create all context menus that are not registered yet.*/
1670
1626
  async createNewMenus(instances, progress) {
1671
1627
  if (!this.#manager.ready)
1672
- throw new base_1.ODSystemError("Client isn't ready yet! Unable to register context menus!");
1628
+ throw new ODSystemError("Client isn't ready yet! Unable to register context menus!");
1673
1629
  if (instances.length > 0 && progress) {
1674
1630
  progress.max = instances.length;
1675
1631
  progress.start();
@@ -1688,7 +1644,7 @@ class ODContextMenuManager extends base_1.ODManager {
1688
1644
  /**Update all context menus that are already registered. */
1689
1645
  async updateExistingMenus(instances, progress) {
1690
1646
  if (!this.#manager.ready)
1691
- throw new base_1.ODSystemError("Client isn't ready yet! Unable to register context menus!");
1647
+ throw new ODSystemError("Client isn't ready yet! Unable to register context menus!");
1692
1648
  if (instances.length > 0 && progress) {
1693
1649
  progress.max = instances.length;
1694
1650
  progress.start();
@@ -1707,9 +1663,9 @@ class ODContextMenuManager extends base_1.ODManager {
1707
1663
  /**Remove all context menus that are registered but unused by Open Discord. */
1708
1664
  async removeUnusedMenus(instances, guildId, progress) {
1709
1665
  if (!this.#manager.ready)
1710
- throw new base_1.ODSystemError("Client isn't ready yet! Unable to register context menus!");
1666
+ throw new ODSystemError("Client isn't ready yet! Unable to register context menus!");
1711
1667
  if (!this.commandManager)
1712
- throw new base_1.ODSystemError("Couldn't get client application to register context menus!");
1668
+ throw new ODSystemError("Couldn't get client application to register context menus!");
1713
1669
  if (instances.length > 0 && progress) {
1714
1670
  progress.max = instances.length;
1715
1671
  progress.start();
@@ -1728,7 +1684,7 @@ class ODContextMenuManager extends base_1.ODManager {
1728
1684
  }
1729
1685
  catch (err) {
1730
1686
  process.emit("uncaughtException", err);
1731
- throw new base_1.ODSystemError("Failed to delete context menu '" + menu.name + "'!");
1687
+ throw new ODSystemError("Failed to delete context menu '" + menu.name + "'!");
1732
1688
  }
1733
1689
  }
1734
1690
  if (progress)
@@ -1738,13 +1694,13 @@ class ODContextMenuManager extends base_1.ODManager {
1738
1694
  /**Create a context menu. **(SYSTEM ONLY)** => Use `ODContextMenuManager` for registering context menu's the default way! */
1739
1695
  async createMenu(menu) {
1740
1696
  if (!this.commandManager)
1741
- throw new base_1.ODSystemError("Couldn't get client application to register context menu's!");
1697
+ throw new ODSystemError("Couldn't get client application to register context menu's!");
1742
1698
  try {
1743
1699
  await this.commandManager.create(menu.builder, (menu.guildId ?? undefined));
1744
1700
  }
1745
1701
  catch (err) {
1746
1702
  process.emit("uncaughtException", err);
1747
- throw new base_1.ODSystemError("Failed to register context menu '" + menu.name + "'!");
1703
+ throw new ODSystemError("Failed to register context menu '" + menu.name + "'!");
1748
1704
  }
1749
1705
  }
1750
1706
  /**Start listening to the discord.js client `interactionCreate` event. */
@@ -1789,7 +1745,6 @@ class ODContextMenuManager extends base_1.ODManager {
1789
1745
  return super.exists(id);
1790
1746
  }
1791
1747
  }
1792
- exports.ODContextMenuManager = ODContextMenuManager;
1793
1748
  /**## ODContextMenu `class`
1794
1749
  * This is an Open Discord context menu.
1795
1750
  *
@@ -1801,7 +1756,7 @@ exports.ODContextMenuManager = ODContextMenuManager;
1801
1756
  *
1802
1757
  * And more!
1803
1758
  */
1804
- class ODContextMenu extends base_1.ODManagerData {
1759
+ export class ODContextMenu extends ODManagerData {
1805
1760
  /**The discord.js builder for this context menu. */
1806
1761
  builder;
1807
1762
  /**The id of the guild this context menu is for. `null` when not set. */
@@ -1811,7 +1766,7 @@ class ODContextMenu extends base_1.ODManagerData {
1811
1766
  constructor(id, builder, requiresUpdate, guildId) {
1812
1767
  super(id);
1813
1768
  if (builder.type != discord.ApplicationCommandType.Message && builder.type != discord.ApplicationCommandType.User)
1814
- throw new base_1.ODSystemError("ApplicationCommandData is required to be the 'Message'|'User' type!");
1769
+ throw new ODSystemError("ApplicationCommandData is required to be the 'Message'|'User' type!");
1815
1770
  this.builder = builder;
1816
1771
  this.guildId = guildId ?? null;
1817
1772
  this.requiresUpdate = requiresUpdate ?? null;
@@ -1824,13 +1779,12 @@ class ODContextMenu extends base_1.ODManagerData {
1824
1779
  this.builder.name = name;
1825
1780
  }
1826
1781
  }
1827
- exports.ODContextMenu = ODContextMenu;
1828
1782
  /**## ODAutocompleteManager `class`
1829
1783
  * This is an Open Discord client autocomplete interaction manager.
1830
1784
  *
1831
1785
  * It's responsible for managing all the autocomplete interactions from the client.
1832
1786
  */
1833
- class ODAutocompleteManager {
1787
+ export class ODAutocompleteManager {
1834
1788
  /**Alias to Open Discord debugger. */
1835
1789
  #debug;
1836
1790
  /**Refrerence to discord.js client. */
@@ -1880,4 +1834,3 @@ class ODAutocompleteManager {
1880
1834
  }
1881
1835
  }
1882
1836
  }
1883
- exports.ODAutocompleteManager = ODAutocompleteManager;
@@ -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
  /**## ODCode `class`
4
4
  * This is an Open Discord code runner.
5
5
  *
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ODCodeManager = exports.ODCode = void 0;
4
1
  ///////////////////////////////////////
5
2
  //CODE MODULE
6
3
  ///////////////////////////////////////
7
- const base_1 = require("./base");
4
+ import { ODManager, ODManagerData } from "./base.js";
8
5
  /**## ODCode `class`
9
6
  * This is an Open Discord code runner.
10
7
  *
@@ -17,7 +14,7 @@ const base_1 = require("./base");
17
14
  * - Database Garbage Collection (removing tickets that don't exist anymore)
18
15
  * - And more!
19
16
  */
20
- class ODCode extends base_1.ODManagerData {
17
+ export class ODCode extends ODManagerData {
21
18
  /**The priority of this code */
22
19
  priority;
23
20
  /**The main function of this code */
@@ -28,7 +25,6 @@ class ODCode extends base_1.ODManagerData {
28
25
  this.func = func;
29
26
  }
30
27
  }
31
- exports.ODCode = ODCode;
32
28
  /**## ODCodeManager `class`
33
29
  * This is an Open Discord code manager.
34
30
  *
@@ -36,7 +32,7 @@ exports.ODCode = ODCode;
36
32
  *
37
33
  * Use this to register a function/code which executes just before the startup screen. (90% is already loaded)
38
34
  */
39
- class ODCodeManager extends base_1.ODManager {
35
+ export class ODCodeManager extends ODManager {
40
36
  constructor(debug) {
41
37
  super(debug, "code");
42
38
  }
@@ -63,4 +59,3 @@ class ODCodeManager extends base_1.ODManager {
63
59
  return super.exists(id);
64
60
  }
65
61
  }
66
- exports.ODCodeManager = ODCodeManager;
@@ -1,5 +1,5 @@
1
- import { ODManager, ODManagerData, ODNoGeneric, ODPromiseVoid, ODValidId } from "./base";
2
- import { ODDebugger } from "./console";
1
+ import { ODManager, ODManagerData, ODNoGeneric, ODPromiseVoid, ODValidId } from "./base.js";
2
+ import { ODDebugger } from "./console.js";
3
3
  import * as fjs from "formatted-json-stringify";
4
4
  /**## ODConfigManagerIdConstraint `type`
5
5
  * The constraint/layout for id mappings/interfaces of the `ODConfigManager` class.