@open-discord-bots/framework 0.3.0 → 0.3.1

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 (61) hide show
  1. package/dist/api/main.js +1 -1
  2. package/dist/api/modules/base.d.ts +27 -9
  3. package/dist/api/modules/base.js +78 -80
  4. package/dist/api/modules/builder.d.ts +0 -9
  5. package/dist/api/modules/checker.d.ts +26 -5
  6. package/dist/api/modules/checker.js +31 -31
  7. package/dist/api/modules/client.d.ts +66 -14
  8. package/dist/api/modules/client.js +146 -132
  9. package/dist/api/modules/component.d.ts +8 -2
  10. package/dist/api/modules/component.js +8 -6
  11. package/dist/api/modules/config.d.ts +0 -1
  12. package/dist/api/modules/config.js +9 -7
  13. package/dist/api/modules/console.d.ts +16 -4
  14. package/dist/api/modules/console.js +25 -25
  15. package/dist/api/modules/event.d.ts +4 -2
  16. package/dist/api/modules/event.js +8 -10
  17. package/dist/api/modules/fuse.d.ts +1 -1
  18. package/dist/api/modules/helpmenu.d.ts +2 -2
  19. package/dist/api/modules/helpmenu.js +4 -7
  20. package/dist/api/modules/language.d.ts +2 -1
  21. package/dist/api/modules/language.js +6 -9
  22. package/dist/api/modules/permission.d.ts +10 -1
  23. package/dist/api/modules/permission.js +17 -20
  24. package/dist/api/modules/plugin.d.ts +2 -1
  25. package/dist/api/modules/plugin.js +2 -2
  26. package/dist/api/modules/post.d.ts +12 -4
  27. package/dist/api/modules/post.js +36 -10
  28. package/dist/api/modules/progressbar.d.ts +16 -5
  29. package/dist/api/modules/progressbar.js +34 -34
  30. package/dist/api/modules/responder.d.ts +95 -26
  31. package/dist/api/modules/responder.js +213 -172
  32. package/dist/api/modules/session.d.ts +10 -1
  33. package/dist/api/modules/session.js +15 -15
  34. package/dist/api/modules/startscreen.d.ts +0 -1
  35. package/dist/api/modules/startscreen.js +3 -6
  36. package/dist/api/modules/statistic.d.ts +2 -1
  37. package/dist/api/modules/statistic.js +4 -7
  38. package/dist/api/modules/worker.d.ts +2 -1
  39. package/dist/api/modules/worker.js +3 -3
  40. package/package.json +1 -1
  41. package/src/api/main.ts +1 -1
  42. package/src/api/modules/base.ts +75 -77
  43. package/src/api/modules/builder.ts +0 -10
  44. package/src/api/modules/checker.ts +31 -31
  45. package/src/api/modules/client.ts +144 -136
  46. package/src/api/modules/component.ts +11 -7
  47. package/src/api/modules/config.ts +8 -6
  48. package/src/api/modules/console.ts +25 -25
  49. package/src/api/modules/event.ts +6 -10
  50. package/src/api/modules/fuse.ts +1 -1
  51. package/src/api/modules/helpmenu.ts +4 -7
  52. package/src/api/modules/language.ts +6 -9
  53. package/src/api/modules/permission.ts +17 -20
  54. package/src/api/modules/plugin.ts +2 -2
  55. package/src/api/modules/post.ts +31 -10
  56. package/src/api/modules/progressbar.ts +34 -34
  57. package/src/api/modules/responder.ts +232 -181
  58. package/src/api/modules/session.ts +14 -14
  59. package/src/api/modules/startscreen.ts +3 -6
  60. package/src/api/modules/statistic.ts +4 -7
  61. package/src/api/modules/worker.ts +3 -3
@@ -221,17 +221,17 @@ export class ODDefaultCheckerRenderer extends ODCheckerRenderer {
221
221
  const finalFooter = [footerErrorText, footerWarningText, footerSupportText, ...this.extraFooterText];
222
222
  const finalTop = [...this.extraTopText];
223
223
  const finalBottom = [bottomCompactInfo, ...this.extraBottomText];
224
- const borderLength = this.#getLongestLength([...finalHeader, ...finalFooter]);
224
+ const borderLength = this.getLongestLength([...finalHeader, ...finalFooter]);
225
225
  const finalComponents = [];
226
226
  //header
227
227
  if (!this.disableHeader) {
228
228
  finalHeader.forEach((text) => {
229
229
  if (text.length < 1)
230
230
  return;
231
- finalComponents.push(this.#createBlockFromText(text, borderLength));
231
+ finalComponents.push(this.createBlockFromText(text, borderLength));
232
232
  });
233
233
  }
234
- finalComponents.push(this.#getHorizontalDivider(borderLength + 4));
234
+ finalComponents.push(this.getHorizontalDivider(borderLength + 4));
235
235
  //top
236
236
  finalTop.forEach((text) => {
237
237
  if (text.length < 1)
@@ -289,24 +289,24 @@ export class ODDefaultCheckerRenderer extends ODCheckerRenderer {
289
289
  finalComponents.push(this.verticalFiller + " " + text);
290
290
  });
291
291
  //footer
292
- finalComponents.push(this.#getHorizontalDivider(borderLength + 4));
292
+ finalComponents.push(this.getHorizontalDivider(borderLength + 4));
293
293
  if (!this.disableFooter) {
294
294
  finalFooter.forEach((text) => {
295
295
  if (text.length < 1)
296
296
  return;
297
- finalComponents.push(this.#createBlockFromText(text, borderLength));
297
+ finalComponents.push(this.createBlockFromText(text, borderLength));
298
298
  });
299
- finalComponents.push(this.#getHorizontalDivider(borderLength + 4));
299
+ finalComponents.push(this.getHorizontalDivider(borderLength + 4));
300
300
  }
301
301
  //return all components
302
302
  return finalComponents;
303
303
  }
304
304
  /**Get the length of the longest string in the array. */
305
- #getLongestLength(texts) {
305
+ getLongestLength(texts) {
306
306
  return Math.max(...texts.map((t) => ansis.strip(t).length));
307
307
  }
308
308
  /**Get a horizontal divider used between different parts of the config checker result. */
309
- #getHorizontalDivider(width) {
309
+ getHorizontalDivider(width) {
310
310
  if (width > 2)
311
311
  width = width - 2;
312
312
  else
@@ -315,7 +315,7 @@ export class ODDefaultCheckerRenderer extends ODCheckerRenderer {
315
315
  return divider;
316
316
  }
317
317
  /**Create a block of text with a vertical divider on the left & right side. */
318
- #createBlockFromText(text, width) {
318
+ createBlockFromText(text, width) {
319
319
  if (width < 3)
320
320
  return this.verticalFiller + this.verticalFiller;
321
321
  let newWidth = width - ansis.strip(text).length + 1;
@@ -333,28 +333,28 @@ export class ODDefaultCheckerRenderer extends ODCheckerRenderer {
333
333
  */
334
334
  export class ODCheckerTranslationRegister {
335
335
  /**This is the array that stores all the data. ❌ **(don't edit unless really needed!)***/
336
- #translations = [];
336
+ translations = [];
337
337
  get(type, id) {
338
- const result = this.#translations.find(d => (d.id == id) && (d.type == type));
338
+ const result = this.translations.find(d => (d.id == id) && (d.type == type));
339
339
  return (result) ? result.translation : null;
340
340
  }
341
341
  set(type, id, translation) {
342
- const index = this.#translations.findIndex(d => (d.id == id) && (d.type == type));
342
+ const index = this.translations.findIndex(d => (d.id == id) && (d.type == type));
343
343
  if (index > -1) {
344
344
  //overwrite
345
- this.#translations[index] = { type, id, translation };
345
+ this.translations[index] = { type, id, translation };
346
346
  return true;
347
347
  }
348
348
  else {
349
- this.#translations.push({ type, id, translation });
349
+ this.translations.push({ type, id, translation });
350
350
  return false;
351
351
  }
352
352
  }
353
353
  delete(type, id) {
354
- const index = this.#translations.findIndex(d => (d.id == id) && (d.type == type));
354
+ const index = this.translations.findIndex(d => (d.id == id) && (d.type == type));
355
355
  if (index > -1) {
356
356
  //delete
357
- this.#translations.splice(index, 1);
357
+ this.translations.splice(index, 1);
358
358
  return true;
359
359
  }
360
360
  else
@@ -362,7 +362,7 @@ export class ODCheckerTranslationRegister {
362
362
  }
363
363
  /**Get all translations */
364
364
  getAll() {
365
- return this.#translations;
365
+ return this.translations;
366
366
  }
367
367
  /**Insert the translation params into the text. */
368
368
  insertTranslationParams(text, translationParams) {
@@ -473,7 +473,7 @@ export class ODChecker extends ODManagerData {
473
473
  this.options = options ?? {};
474
474
  }
475
475
  /**Get a human-readable number string. */
476
- #ordinalNumber(num) {
476
+ ordinalNumber(num) {
477
477
  const i = Math.abs(Math.round(num));
478
478
  const cent = i % 100;
479
479
  if (cent >= 10 && cent <= 20)
@@ -502,7 +502,7 @@ export class ODChecker extends ODManagerData {
502
502
  const final = [];
503
503
  trace.forEach((t) => {
504
504
  if (typeof t == "number") {
505
- final.push(`:(${this.#ordinalNumber(t + 1)})`);
505
+ final.push(`:(${this.ordinalNumber(t + 1)})`);
506
506
  }
507
507
  else {
508
508
  final.push(`."${t}"`);
@@ -845,11 +845,11 @@ export class ODCheckerArrayStructure extends ODCheckerStructure {
845
845
  checker.createMessage("opendiscord:array-length-invalid", "error", `This array needs to have a length of ${this.options.length}!`, lt, null, [this.options.length.toString()], this.id, (this.options.docs ?? null));
846
846
  return false;
847
847
  }
848
- else if (typeof this.options.allowedTypes != "undefined" && !this.#arrayAllowedTypesCheck(value, this.options.allowedTypes)) {
848
+ else if (typeof this.options.allowedTypes != "undefined" && !this.arrayAllowedTypesCheck(value, this.options.allowedTypes)) {
849
849
  checker.createMessage("opendiscord:array-invalid-types", "error", `This array can only contain the following types: ${this.options.allowedTypes.join(", ")}!`, lt, null, [this.options.allowedTypes.join(", ").toString()], this.id, (this.options.docs ?? null));
850
850
  return false;
851
851
  }
852
- else if (typeof this.options.allowDoubles != "undefined" && !this.options.allowDoubles && this.#arrayHasDoubles(value)) {
852
+ else if (typeof this.options.allowDoubles != "undefined" && !this.options.allowDoubles && this.arrayHasDoubles(value)) {
853
853
  checker.createMessage("opendiscord:array-double", "error", "This array doesn't allow the same value twice!", lt, null, [], this.id, (this.options.docs ?? null));
854
854
  return false;
855
855
  }
@@ -875,7 +875,7 @@ export class ODCheckerArrayStructure extends ODCheckerStructure {
875
875
  }
876
876
  }
877
877
  /**Check this array for the allowed types */
878
- #arrayAllowedTypesCheck(array, allowedTypes) {
878
+ arrayAllowedTypesCheck(array, allowedTypes) {
879
879
  //return TRUE if ALL values are valid
880
880
  return !array.some((value) => {
881
881
  if (allowedTypes.includes("string") && typeof value == "string") {
@@ -905,7 +905,7 @@ export class ODCheckerArrayStructure extends ODCheckerStructure {
905
905
  });
906
906
  }
907
907
  /**Check this array for doubles */
908
- #arrayHasDoubles(array) {
908
+ arrayHasDoubles(array) {
909
909
  const alreadyFound = [];
910
910
  let hasDoubles = false;
911
911
  array.forEach((value) => {
@@ -1270,7 +1270,7 @@ export class ODCheckerCustomStructure_UrlString extends ODCheckerStringStructure
1270
1270
  else if (emptyAllowed && value.length == 0) {
1271
1271
  return true;
1272
1272
  }
1273
- else if (!this.#urlIsValid(value)) {
1273
+ else if (!this.urlIsValid(value)) {
1274
1274
  checker.createMessage("opendiscord:url-invalid", "error", "This url is invalid!", lt, null, [], this.id, (this.options.docs ?? null));
1275
1275
  return false;
1276
1276
  }
@@ -1282,15 +1282,15 @@ export class ODCheckerCustomStructure_UrlString extends ODCheckerStringStructure
1282
1282
  checker.createMessage("opendiscord:url-invalid-protocol", "error", "This url can only use the http:// & https:// protocols!", lt, null, [], this.id, (this.options.docs ?? null));
1283
1283
  return false;
1284
1284
  }
1285
- else if (typeof this.urlSettings.allowedHostnames != "undefined" && !this.#urlHasValidHostname(value, this.urlSettings.allowedHostnames)) {
1285
+ else if (typeof this.urlSettings.allowedHostnames != "undefined" && !this.urlHasValidHostname(value, this.urlSettings.allowedHostnames)) {
1286
1286
  checker.createMessage("opendiscord:url-invalid-hostname", "error", "This url has a disallowed hostname!", lt, null, [], this.id, (this.options.docs ?? null));
1287
1287
  return false;
1288
1288
  }
1289
- else if (typeof this.urlSettings.allowedExtensions != "undefined" && !this.#urlHasValidExtension(value, this.urlSettings.allowedExtensions)) {
1289
+ else if (typeof this.urlSettings.allowedExtensions != "undefined" && !this.urlHasValidExtension(value, this.urlSettings.allowedExtensions)) {
1290
1290
  checker.createMessage("opendiscord:url-invalid-extension", "error", `This url has an invalid extension! Choose between: ${this.urlSettings.allowedExtensions.join(", ")}!"`, lt, null, [this.urlSettings.allowedExtensions.join(", ")], this.id, (this.options.docs ?? null));
1291
1291
  return false;
1292
1292
  }
1293
- else if (typeof this.urlSettings.allowedPaths != "undefined" && !this.#urlHasValidPath(value, this.urlSettings.allowedPaths)) {
1293
+ else if (typeof this.urlSettings.allowedPaths != "undefined" && !this.urlHasValidPath(value, this.urlSettings.allowedPaths)) {
1294
1294
  checker.createMessage("opendiscord:url-invalid-path", "error", "This url has an invalid path!", lt, null, [], this.id, (this.options.docs ?? null));
1295
1295
  return false;
1296
1296
  }
@@ -1306,7 +1306,7 @@ export class ODCheckerCustomStructure_UrlString extends ODCheckerStringStructure
1306
1306
  this.emptyAllowed = emptyAllowed;
1307
1307
  }
1308
1308
  /**Check for the hostname */
1309
- #urlHasValidHostname(url, hostnames) {
1309
+ urlHasValidHostname(url, hostnames) {
1310
1310
  try {
1311
1311
  const hostname = new URL(url).hostname;
1312
1312
  return hostnames.some((rule) => {
@@ -1323,7 +1323,7 @@ export class ODCheckerCustomStructure_UrlString extends ODCheckerStringStructure
1323
1323
  }
1324
1324
  }
1325
1325
  /**Check for the extension */
1326
- #urlHasValidExtension(url, extensions) {
1326
+ urlHasValidExtension(url, extensions) {
1327
1327
  try {
1328
1328
  const path = new URL(url).pathname;
1329
1329
  return extensions.some((rule) => {
@@ -1335,7 +1335,7 @@ export class ODCheckerCustomStructure_UrlString extends ODCheckerStringStructure
1335
1335
  }
1336
1336
  }
1337
1337
  /**Check for the path */
1338
- #urlHasValidPath(url, paths) {
1338
+ urlHasValidPath(url, paths) {
1339
1339
  try {
1340
1340
  const path = new URL(url).pathname;
1341
1341
  return paths.some((rule) => {
@@ -1352,7 +1352,7 @@ export class ODCheckerCustomStructure_UrlString extends ODCheckerStringStructure
1352
1352
  }
1353
1353
  }
1354
1354
  /**Do general syntax check on url */
1355
- #urlIsValid(url) {
1355
+ urlIsValid(url) {
1356
1356
  try {
1357
1357
  new URL(url);
1358
1358
  return true;
@@ -1,8 +1,10 @@
1
1
  import { ODManager, ODManagerData, ODNoGeneric, ODValidId } from "./base.js";
2
2
  import * as discord from "discord.js";
3
3
  import { ODDebugger } from "./console.js";
4
- import { ODMessageBuildResult, ODMessageBuildSentResult } from "./builder.js";
4
+ import { ODMessageBuildResult } from "./builder.js";
5
5
  import { ODManualProgressBar } from "./progressbar.js";
6
+ import { ODResponderSendResult } from "./responder.js";
7
+ import { ODMessageComponentBuildResult } from "./component.js";
6
8
  /**## ODClientIntents `type`
7
9
  * A list of intents required when inviting the bot.
8
10
  */
@@ -27,7 +29,8 @@ export type ODClientPermissions = ("CreateInstantInvite" | "KickMembers" | "BanM
27
29
  * If you want, you can also listen for custom events on the `ODClientManager.client` variable (`discord.Client`)
28
30
  */
29
31
  export declare class ODClientManager<SlashIdList extends ODSlashCommandManagerIdConstraint = ODSlashCommandManagerIdConstraint, TextIdList extends ODTextCommandManagerIdConstraint = ODTextCommandManagerIdConstraint, ContextMenuIdList extends ODContextMenuManagerIdConstraint = ODContextMenuManagerIdConstraint> {
30
- #private;
32
+ /**Alias to Open Discord debugger. */
33
+ protected debug: ODDebugger;
31
34
  /**List of required bot intents. Add intents to this list using the `onClientLoad` event. */
32
35
  intents: ODClientIntents[];
33
36
  /**List of required bot privileged intents. Add intents to this list using the `onClientLoad` event. */
@@ -39,6 +42,8 @@ export declare class ODClientManager<SlashIdList extends ODSlashCommandManagerId
39
42
  /**The discord bot token, empty by default. */
40
43
  set token(value: string);
41
44
  get token(): string;
45
+ /**The discord bot token. **DON'T USE THIS!!!** (use `ODClientManager.token` instead) */
46
+ private rawBotToken;
42
47
  /**The discord.js `discord.Client`. Only use it when initiated! */
43
48
  client: discord.Client<true>;
44
49
  /**The discord.js REST client. Used for stuff that discord.js can't handle :) */
@@ -94,7 +99,7 @@ export declare class ODClientManager<SlashIdList extends ODSlashCommandManagerId
94
99
  fetchGuildChannelMessage(guildId: string | discord.Guild, channelId: string | discord.TextChannel, id: string): Promise<discord.Message<true> | null>;
95
100
  fetchGuildChannelMessage(channelId: discord.TextChannel, id: string): Promise<discord.Message<true> | null>;
96
101
  /**A simplified shortcut to send a DM to a user :) */
97
- sendUserDm(user: string | discord.User, message: ODMessageBuildResult): Promise<ODMessageBuildSentResult<false>>;
102
+ sendUserDm(user: string | discord.User, build: ODMessageBuildResult | ODMessageComponentBuildResult): Promise<ODResponderSendResult<false>>;
98
103
  }
99
104
  /**## ODClientActivityType `type`
100
105
  * Possible activity types for the bot.
@@ -112,7 +117,10 @@ export type ODClientActivityMode = ("online" | "invisible" | "idle" | "dnd");
112
117
  * It also has a built-in refresh function, so the status will refresh every 10 minutes to keep it visible.
113
118
  */
114
119
  export declare class ODClientActivityManager {
115
- #private;
120
+ /**Alias to Open Discord debugger. */
121
+ protected debug: ODDebugger;
122
+ /**Copy of discord.js client */
123
+ protected client: ODClientManager<ODSlashCommandManagerIdConstraint, ODTextCommandManagerIdConstraint, ODContextMenuManagerIdConstraint>;
116
124
  /**The current status type */
117
125
  type: ODClientActivityType;
118
126
  /**The current status text */
@@ -127,11 +135,15 @@ export declare class ODClientActivityManager {
127
135
  refreshInterval: number;
128
136
  /**Is the status already initiated? */
129
137
  initiated: boolean;
130
- constructor(debug: ODDebugger, manager: ODClientManager<ODSlashCommandManagerIdConstraint, ODTextCommandManagerIdConstraint, ODContextMenuManagerIdConstraint>);
138
+ constructor(debug: ODDebugger, client: ODClientManager<ODSlashCommandManagerIdConstraint, ODTextCommandManagerIdConstraint, ODContextMenuManagerIdConstraint>);
131
139
  /**Update the status. When already initiated, it can take up to 10min to see the updated status in discord. */
132
140
  setStatus(type: ODClientActivityType, text: string, mode: ODClientActivityMode, state: string, forceUpdate?: boolean): void;
133
141
  /**When initiating the status, the bot starts updating the status using `discord.js`. Returns `true` when successfull. */
134
142
  initStatus(): boolean;
143
+ /**Update the client status */
144
+ private updateClientActivity;
145
+ /**Get the enum that links to the correct type */
146
+ private getStatusTypeEnum;
135
147
  /**Get the status type (for displaying the status) */
136
148
  getStatusType(): "listening " | "playing " | "watching " | "";
137
149
  }
@@ -238,7 +250,12 @@ export interface ODSlashCommandBuilder extends discord.ChatInputApplicationComma
238
250
  * A utility class to compare existing slash commands with newly registered ones.
239
251
  */
240
252
  export declare class ODSlashCommandComparator {
241
- #private;
253
+ /**Convert a `discord.ApplicationCommandOptionChoiceData<string>` to a universal Open Discord slash command option choice object for comparison. */
254
+ protected convertOptionChoice(choice: discord.ApplicationCommandOptionChoiceData<string>): ODSlashCommandUniversalOptionChoice;
255
+ /**Convert a `discord.ApplicationCommandOptionData` to a universal Open Discord slash command option object for comparison. */
256
+ protected convertBuilderOption(option: discord.ApplicationCommandOptionData): ODSlashCommandUniversalOption;
257
+ /**Convert a `discord.ApplicationCommandOption` to a universal Open Discord slash command option object for comparison. */
258
+ protected convertCommandOption(option: discord.ApplicationCommandOption): ODSlashCommandUniversalOption;
242
259
  /**Convert a `ODSlashCommandBuilder` to a universal Open Discord slash command object for comparison. */
243
260
  convertBuilder(builder: ODSlashCommandBuilder, guildId: string | null): ODSlashCommandUniversalCommand | null;
244
261
  /**Convert a `discord.ApplicationCommand` to a universal Open Discord slash command object for comparison. */
@@ -296,14 +313,20 @@ export type ODSlashCommandManagerIdConstraint = Record<string, ODSlashCommand>;
296
313
  * Here, you can add & remove slash commands & the bot will do the (de)registering.
297
314
  */
298
315
  export declare class ODSlashCommandManager<IdList extends ODSlashCommandManagerIdConstraint = ODSlashCommandManagerIdConstraint> extends ODManager<ODSlashCommand> {
299
- #private;
316
+ /**Refrerence to discord.js client. */
317
+ protected client: ODClientManager<ODSlashCommandManagerIdConstraint, ODTextCommandManagerIdConstraint, ODContextMenuManagerIdConstraint>;
300
318
  /**Discord.js application commands manager. */
301
319
  commandManager: discord.ApplicationCommandManager | null;
320
+ /**Collection of all interaction listeners. */
321
+ protected interactionListeners: {
322
+ name: string | RegExp;
323
+ callback: ODSlashCommandInteractionCallback;
324
+ }[];
302
325
  /**Set the soft limit for maximum amount of listeners. A warning will be shown when there are more listeners than this limit. */
303
326
  listenerLimit: number;
304
327
  /**A utility class used to compare 2 slash commands with each other. */
305
328
  comparator: ODSlashCommandComparator;
306
- constructor(debug: ODDebugger, manager: ODClientManager<ODSlashCommandManagerIdConstraint, ODTextCommandManagerIdConstraint, ODContextMenuManagerIdConstraint>);
329
+ constructor(debug: ODDebugger, client: ODClientManager<ODSlashCommandManagerIdConstraint, ODTextCommandManagerIdConstraint, ODContextMenuManagerIdConstraint>);
307
330
  /**Get all registered & unregistered slash commands. */
308
331
  getAllRegisteredCommands(guildId?: string): Promise<ODSlashCommandRegisteredResult>;
309
332
  /**Create all commands that are not registered yet.*/
@@ -586,12 +609,26 @@ export type ODTextCommandManagerIdConstraint = Record<string, ODTextCommand>;
586
609
  * Here, you can add & remove text commands & the bot will do the (de)registering.
587
610
  */
588
611
  export declare class ODTextCommandManager<IdList extends ODTextCommandManagerIdConstraint = ODTextCommandManagerIdConstraint> extends ODManager<ODTextCommand> {
589
- #private;
612
+ /**Copy of discord.js client. */
613
+ protected client: ODClientManager<ODSlashCommandManagerIdConstraint, ODTextCommandManagerIdConstraint, ODContextMenuManagerIdConstraint>;
614
+ /**Collection of all interaction listeners. */
615
+ protected interactionListeners: {
616
+ prefix: string;
617
+ name: string | RegExp;
618
+ callback: ODTextCommandInteractionCallback;
619
+ }[];
620
+ /**Collection of all error listeners. */
621
+ protected errorListeners: ODTextCommandErrorCallback[];
590
622
  /**Set the soft limit for maximum amount of listeners. A warning will be shown when there are more listeners than this limit. */
591
623
  listenerLimit: number;
592
- constructor(debug: ODDebugger, manager: ODClientManager<ODSlashCommandManagerIdConstraint, ODTextCommandManagerIdConstraint, ODContextMenuManagerIdConstraint>);
624
+ constructor(debug: ODDebugger, client: ODClientManager<ODSlashCommandManagerIdConstraint, ODTextCommandManagerIdConstraint, ODContextMenuManagerIdConstraint>);
625
+ private checkMessage;
626
+ /**Check if all options of a command are correct. */
627
+ private checkOptions;
593
628
  /**Start listening to the discord.js client `messageCreate` event. */
594
629
  startListeningToInteractions(): void;
630
+ /**Check if optional values are only present at the end of the command. */
631
+ private checkBuilderOptions;
595
632
  /**Callback on interaction from one of the registered text commands */
596
633
  onInteraction(commandPrefix: string, commandName: keyof ODNoGeneric<IdList>, callback: ODTextCommandInteractionCallback): void;
597
634
  onInteraction(commandPrefix: string, commandName: string | RegExp, callback: ODTextCommandInteractionCallback): void;
@@ -711,14 +748,20 @@ export type ODContextMenuManagerIdConstraint = Record<string, ODContextMenu>;
711
748
  * Here, you can add & remove context interactions & the bot will do the (de)registering.
712
749
  */
713
750
  export declare class ODContextMenuManager<IdList extends ODContextMenuManagerIdConstraint = ODContextMenuManagerIdConstraint> extends ODManager<ODContextMenu> {
714
- #private;
751
+ /**Refrerence to discord.js client. */
752
+ protected client: ODClientManager<ODSlashCommandManagerIdConstraint, ODTextCommandManagerIdConstraint, ODContextMenuManagerIdConstraint>;
715
753
  /**Discord.js application commands manager. */
716
754
  commandManager: discord.ApplicationCommandManager | null;
755
+ /**Collection of all interaction listeners. */
756
+ protected interactionListeners: {
757
+ name: string | RegExp;
758
+ callback: ODContextMenuInteractionCallback;
759
+ }[];
717
760
  /**Set the soft limit for maximum amount of listeners. A warning will be shown when there are more listeners than this limit. */
718
761
  listenerLimit: number;
719
762
  /**A utility class used to compare 2 context menus with each other. */
720
763
  comparator: ODContextMenuComparator;
721
- constructor(debug: ODDebugger, manager: ODClientManager<ODSlashCommandManagerIdConstraint, ODTextCommandManagerIdConstraint, ODContextMenuManagerIdConstraint>);
764
+ constructor(debug: ODDebugger, client: ODClientManager<ODSlashCommandManagerIdConstraint, ODTextCommandManagerIdConstraint, ODContextMenuManagerIdConstraint>);
722
765
  /**Get all registered & unregistered message context menu commands. */
723
766
  getAllRegisteredMenus(guildId?: string): Promise<ODContextMenuRegisteredResult>;
724
767
  /**Create all context menus that are not registered yet.*/
@@ -778,12 +821,21 @@ export type ODAutocompleteInteractionCallback = (interaction: discord.Autocomple
778
821
  * It's responsible for managing all the autocomplete interactions from the client.
779
822
  */
780
823
  export declare class ODAutocompleteManager {
781
- #private;
824
+ /**Alias to Open Discord debugger. */
825
+ protected debug: ODDebugger;
826
+ /**Refrerence to discord.js client. */
827
+ protected client: ODClientManager<ODSlashCommandManagerIdConstraint, ODTextCommandManagerIdConstraint, ODContextMenuManagerIdConstraint>;
782
828
  /**Discord.js application commands manager. */
783
829
  commandManager: discord.ApplicationCommandManager | null;
830
+ /**Collection of all interaction listeners. */
831
+ protected interactionListeners: {
832
+ cmdName: string | RegExp;
833
+ optName: string | RegExp;
834
+ callback: ODAutocompleteInteractionCallback;
835
+ }[];
784
836
  /**Set the soft limit for maximum amount of listeners. A warning will be shown when there are more listeners than this limit. */
785
837
  listenerLimit: number;
786
- constructor(debug: ODDebugger, manager: ODClientManager<ODSlashCommandManagerIdConstraint, ODTextCommandManagerIdConstraint, ODContextMenuManagerIdConstraint>);
838
+ constructor(debug: ODDebugger, client: ODClientManager<ODSlashCommandManagerIdConstraint, ODTextCommandManagerIdConstraint, ODContextMenuManagerIdConstraint>);
787
839
  /**Start listening to the discord.js client `interactionCreate` event. */
788
840
  startListeningToInteractions(): void;
789
841
  /**Callback on interaction from one or multiple autocompletes. */