@open-discord-bots/framework 0.2.17 → 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 (76) hide show
  1. package/dist/api/index.d.ts +16 -15
  2. package/dist/api/index.js +16 -15
  3. package/dist/api/main.d.ts +31 -23
  4. package/dist/api/main.js +3 -1
  5. package/dist/api/modules/action.d.ts +2 -2
  6. package/dist/api/modules/action.js +1 -5
  7. package/dist/api/modules/base.d.ts +29 -11
  8. package/dist/api/modules/base.js +78 -80
  9. package/dist/api/modules/builder.d.ts +2 -11
  10. package/dist/api/modules/builder.js +0 -4
  11. package/dist/api/modules/checker.d.ts +28 -7
  12. package/dist/api/modules/checker.js +33 -37
  13. package/dist/api/modules/client.d.ts +66 -14
  14. package/dist/api/modules/client.js +146 -132
  15. package/dist/api/modules/component.d.ts +928 -0
  16. package/dist/api/modules/component.js +1346 -0
  17. package/dist/api/modules/config.d.ts +30 -2
  18. package/dist/api/modules/config.js +90 -7
  19. package/dist/api/modules/console.d.ts +16 -4
  20. package/dist/api/modules/console.js +25 -25
  21. package/dist/api/modules/cooldown.d.ts +5 -5
  22. package/dist/api/modules/cooldown.js +1 -17
  23. package/dist/api/modules/database.d.ts +21 -13
  24. package/dist/api/modules/database.js +0 -23
  25. package/dist/api/modules/event.d.ts +4 -2
  26. package/dist/api/modules/event.js +8 -10
  27. package/dist/api/modules/fuse.d.ts +1 -1
  28. package/dist/api/modules/helpmenu.d.ts +11 -9
  29. package/dist/api/modules/helpmenu.js +24 -22
  30. package/dist/api/modules/language.d.ts +4 -3
  31. package/dist/api/modules/language.js +9 -16
  32. package/dist/api/modules/permission.d.ts +10 -1
  33. package/dist/api/modules/permission.js +17 -20
  34. package/dist/api/modules/plugin.d.ts +2 -1
  35. package/dist/api/modules/plugin.js +2 -2
  36. package/dist/api/modules/post.d.ts +12 -4
  37. package/dist/api/modules/post.js +36 -10
  38. package/dist/api/modules/progressbar.d.ts +18 -6
  39. package/dist/api/modules/progressbar.js +35 -35
  40. package/dist/api/modules/responder.d.ts +97 -28
  41. package/dist/api/modules/responder.js +213 -176
  42. package/dist/api/modules/session.d.ts +11 -2
  43. package/dist/api/modules/session.js +16 -16
  44. package/dist/api/modules/startscreen.d.ts +2 -3
  45. package/dist/api/modules/startscreen.js +8 -9
  46. package/dist/api/modules/statistic.d.ts +2 -1
  47. package/dist/api/modules/statistic.js +4 -7
  48. package/dist/api/modules/worker.d.ts +2 -1
  49. package/dist/api/modules/worker.js +3 -3
  50. package/package.json +3 -2
  51. package/src/api/index.ts +16 -15
  52. package/src/api/main.ts +33 -24
  53. package/src/api/modules/action.ts +2 -4
  54. package/src/api/modules/base.ts +77 -79
  55. package/src/api/modules/builder.ts +2 -14
  56. package/src/api/modules/checker.ts +36 -37
  57. package/src/api/modules/client.ts +144 -136
  58. package/src/api/modules/component.ts +1826 -0
  59. package/src/api/modules/config.ts +86 -7
  60. package/src/api/modules/console.ts +25 -25
  61. package/src/api/modules/cooldown.ts +8 -13
  62. package/src/api/modules/database.ts +24 -32
  63. package/src/api/modules/event.ts +6 -10
  64. package/src/api/modules/fuse.ts +1 -1
  65. package/src/api/modules/helpmenu.ts +31 -27
  66. package/src/api/modules/language.ts +11 -16
  67. package/src/api/modules/permission.ts +17 -20
  68. package/src/api/modules/plugin.ts +2 -2
  69. package/src/api/modules/post.ts +31 -10
  70. package/src/api/modules/progressbar.ts +36 -37
  71. package/src/api/modules/responder.ts +234 -185
  72. package/src/api/modules/session.ts +15 -15
  73. package/src/api/modules/startscreen.ts +9 -10
  74. package/src/api/modules/statistic.ts +4 -7
  75. package/src/api/modules/worker.ts +3 -3
  76. package/src/api/modules/component.txt +0 -350
@@ -58,30 +58,30 @@ export class ODProgressBarManager extends ODManager {
58
58
  */
59
59
  export class ODProgressBarRenderer extends ODManagerData {
60
60
  settings;
61
- #render;
62
- constructor(id, render, settings) {
61
+ renderFunction;
62
+ constructor(id, renderFunction, settings) {
63
63
  super(id);
64
- this.#render = render;
64
+ this.renderFunction = renderFunction;
65
65
  this.settings = settings;
66
66
  }
67
67
  /**Render a progress bar using this renderer. */
68
68
  render(min, max, value, prefix, suffix) {
69
69
  try {
70
- return this.#render(this.settings, min, max, value, prefix, suffix);
70
+ return this.renderFunction(this.settings, min, max, value, prefix, suffix);
71
71
  }
72
72
  catch (err) {
73
73
  process.emit("uncaughtException", err);
74
74
  return "<PROGRESS-BAR-ERROR>";
75
75
  }
76
76
  }
77
+ /**Create a clone of this progress bar renderer, but with additional settings. */
77
78
  withAdditionalSettings(settings) {
78
79
  const newSettings = { ...this.settings };
79
80
  for (const key of Object.keys(settings)) {
80
81
  if (typeof settings[key] != "undefined")
81
82
  newSettings[key] = settings[key];
82
83
  }
83
- const idk = Object.keys(settings);
84
- return new ODProgressBarRenderer(this.id, this.#render, newSettings);
84
+ return new ODProgressBarRenderer(this.id, this.renderFunction, newSettings);
85
85
  }
86
86
  }
87
87
  /**## ODProgressBar `class`
@@ -96,9 +96,9 @@ export class ODProgressBar extends ODManagerData {
96
96
  /**The renderer of this progress bar. */
97
97
  renderer;
98
98
  /**Is this progress bar currently active? */
99
- #active = false;
99
+ active = false;
100
100
  /**A list of listeners when the progress bar stops. */
101
- #stopListeners = [];
101
+ stopListeners = [];
102
102
  /**The current value of the progress bar. */
103
103
  value;
104
104
  /**The minimum value of the progress bar. */
@@ -118,14 +118,14 @@ export class ODProgressBar extends ODManagerData {
118
118
  this.renderer = renderer;
119
119
  this.min = min;
120
120
  this.max = max;
121
- this.initialValue = this.#parseValue(value);
122
- this.value = this.#parseValue(value);
121
+ this.initialValue = this.parseValue(value);
122
+ this.value = this.parseValue(value);
123
123
  this.autoStop = autoStop;
124
124
  this.prefix = prefix;
125
125
  this.suffix = suffix;
126
126
  }
127
127
  /**Parse a value in such a way that it doesn't go below/above the min/max limits. */
128
- #parseValue(value) {
128
+ parseValue(value) {
129
129
  if (value > this.max)
130
130
  return this.max;
131
131
  else if (value < this.min)
@@ -134,8 +134,8 @@ export class ODProgressBar extends ODManagerData {
134
134
  return value;
135
135
  }
136
136
  /**Render progress bar to the console. */
137
- #renderStdout() {
138
- if (!this.#active)
137
+ renderStdout() {
138
+ if (!this.active)
139
139
  return;
140
140
  readline.clearLine(process.stdout, 0);
141
141
  readline.cursorTo(process.stdout, 0);
@@ -143,31 +143,31 @@ export class ODProgressBar extends ODManagerData {
143
143
  }
144
144
  /**Start showing this progress bar in the console. */
145
145
  start() {
146
- if (this.#active)
146
+ if (this.active)
147
147
  return false;
148
- this.value = this.#parseValue(this.initialValue);
149
- this.#active = true;
150
- this.#renderStdout();
148
+ this.value = this.parseValue(this.initialValue);
149
+ this.active = true;
150
+ this.renderStdout();
151
151
  return true;
152
152
  }
153
153
  /**Update this progress bar while active. (will automatically update the progress bar in the console) */
154
154
  update(value, stop) {
155
- if (!this.#active)
155
+ if (!this.active)
156
156
  return false;
157
- this.value = this.#parseValue(value);
158
- this.#renderStdout();
157
+ this.value = this.parseValue(value);
158
+ this.renderStdout();
159
159
  if (stop || (this.autoStop == "max" && this.value == this.max) || (this.autoStop == "min" && this.value == this.min)) {
160
160
  process.stdout.write("\n");
161
- this.#active = false;
162
- this.#stopListeners.forEach((cb) => cb());
163
- this.#stopListeners = [];
161
+ this.active = false;
162
+ this.stopListeners.forEach((cb) => cb());
163
+ this.stopListeners = [];
164
164
  }
165
165
  return true;
166
166
  }
167
167
  /**Wait for the progress bar to finish. */
168
168
  finished() {
169
169
  return new Promise((resolve) => {
170
- this.#stopListeners.push(resolve);
170
+ this.stopListeners.push(resolve);
171
171
  });
172
172
  }
173
173
  }
@@ -188,7 +188,7 @@ export class ODTimedProgressBar extends ODProgressBar {
188
188
  this.mode = mode;
189
189
  }
190
190
  /**The timer which is used. */
191
- async #timer(ms) {
191
+ async timer(ms) {
192
192
  return new Promise((resolve) => {
193
193
  setTimeout(() => {
194
194
  resolve();
@@ -196,11 +196,11 @@ export class ODTimedProgressBar extends ODProgressBar {
196
196
  });
197
197
  }
198
198
  /**Run the timed progress bar. */
199
- async #execute() {
199
+ async execute() {
200
200
  let i = 0;
201
201
  const fragment = this.time / 100;
202
202
  while (i < 100) {
203
- await this.#timer(fragment);
203
+ await this.timer(fragment);
204
204
  i++;
205
205
  super.update((this.mode == "increasing") ? (i * fragment) : this.time - (i * fragment));
206
206
  }
@@ -209,7 +209,7 @@ export class ODTimedProgressBar extends ODProgressBar {
209
209
  const res = super.start();
210
210
  if (!res)
211
211
  return false;
212
- this.#execute();
212
+ this.execute();
213
213
  return true;
214
214
  }
215
215
  }
@@ -245,12 +245,12 @@ export class ODDefaultProgressBarRenderer extends ODProgressBarRenderer {
245
245
  super(id, (settings, min, max, value, rawPrefix, rawSuffix) => {
246
246
  const percentage = (value - min) / (max - min);
247
247
  const barLevel = Math.round(percentage * settings.barWidth);
248
- const borderAnsis = this.#switchColorAnsis(settings.borderColor);
249
- const filledBarAnsis = this.#switchColorAnsis(settings.filledBarColor);
250
- const emptyBarAnsis = this.#switchColorAnsis(settings.emptyBarColor);
251
- const labelAnsis = this.#switchColorAnsis(settings.labelColor);
252
- const prefixAnsis = this.#switchColorAnsis(settings.prefixColor);
253
- const suffixAnsis = this.#switchColorAnsis(settings.suffixColor);
248
+ const borderAnsis = this.switchColorAnsis(settings.borderColor);
249
+ const filledBarAnsis = this.switchColorAnsis(settings.filledBarColor);
250
+ const emptyBarAnsis = this.switchColorAnsis(settings.emptyBarColor);
251
+ const labelAnsis = this.switchColorAnsis(settings.labelColor);
252
+ const prefixAnsis = this.switchColorAnsis(settings.prefixColor);
253
+ const suffixAnsis = this.switchColorAnsis(settings.suffixColor);
254
254
  const leftBorder = (settings.showBorder) ? borderAnsis(settings.leftBorderChar) : "";
255
255
  const rightBorder = (settings.showBorder) ? borderAnsis(settings.rightBorderChar) : "";
256
256
  const bar = (settings.showBar) ? filledBarAnsis(settings.filledBarChar.repeat(barLevel)) + emptyBarAnsis(settings.emptyBarChar.repeat(settings.barWidth - barLevel)) : "";
@@ -276,7 +276,7 @@ export class ODDefaultProgressBarRenderer extends ODProgressBarRenderer {
276
276
  }, settings);
277
277
  }
278
278
  /**Switch between Ansis functions based on the specified color. */
279
- #switchColorAnsis(c) {
279
+ switchColorAnsis(c) {
280
280
  return (c === "openticket") ? ansis.hex("#f8ba00") : (c === "openmoderation") ? ansis.hex("#1690ff") : ansis[c];
281
281
  }
282
282
  }
@@ -3,7 +3,8 @@ import * as discord from "discord.js";
3
3
  import { ODWorkerManager, ODWorkerCallback } from "./worker.js";
4
4
  import { ODDebugger } from "./console.js";
5
5
  import { ODClientManager, ODContextMenu, ODSlashCommand, ODTextCommand, ODTextCommandInteractionOption } from "./client.js";
6
- import { ODDropdownData, ODMessageBuildResult, ODMessageBuildSentResult, ODModalBuildResult } from "./builder.js";
6
+ import { ODDropdownData, ODMessageBuildResult, ODModalBuildResult } from "./builder.js";
7
+ import { ODMessageComponentBuildResult } from "./component.js";
7
8
  /**## ODResponderImplementation `class`
8
9
  * This is an Open Discord responder implementation.
9
10
  *
@@ -11,19 +12,33 @@ import { ODDropdownData, ODMessageBuildResult, ODMessageBuildSentResult, ODModal
11
12
  *
12
13
  * This class can't be used stand-alone & needs to be extended from!
13
14
  */
14
- export declare class ODResponderImplementation<Instance, Origin extends string, Params, WorkerIds extends string = string> extends ODManagerData {
15
+ export declare abstract class ODResponderImplementation<Instance, Origin extends string, Params, WorkerIds extends string = string> extends ODManagerData {
15
16
  /**The manager that has all workers of this implementation */
16
17
  workers: ODWorkerManager<Instance, Origin, Params, WorkerIds>;
17
18
  /**The `commandName` or `customId` needs to match this string or regex for this responder to be executed. */
18
19
  match: string | RegExp;
19
20
  constructor(id: ODValidId, match: string | RegExp, callback?: ODWorkerCallback<Instance, Origin, Params>, priority?: number, callbackId?: ODValidId);
20
21
  /**Execute all workers & return the result. */
21
- respond(instance: Instance, origin: Origin, params: Params): Promise<void>;
22
+ abstract respond(instance: Instance, origin: Origin, params: Params): Promise<void>;
22
23
  }
23
24
  /**## ODResponderTimeoutErrorCallback `type`
24
25
  * This is the callback for the responder timeout function. It will be executed when something went wrong or the action takes too much time.
25
26
  */
26
- export type ODResponderTimeoutErrorCallback<Instance, Origin extends "slash" | "text" | "button" | "dropdown" | "modal" | "other" | "context-menu" | "autocomplete"> = (instance: Instance, origin: Origin) => void | Promise<void>;
27
+ export type ODResponderTimeoutErrorCallback<Instance, Origin extends "slash" | "text" | "button" | "dropdown" | "modal" | "other" | "context-menu" | "autocomplete"> = (instance: Instance, origin: Origin) => ODResponderSendResult<boolean> | Promise<ODResponderSendResult<boolean>>;
28
+ /**## ODResponderSendResult `type`
29
+ * The result from a sent message using responders. Can be used to edit, view & save the message that got created.
30
+ */
31
+ export type ODResponderSendResult<InGuild extends boolean> = {
32
+ /**Did the message get sent successfully? */
33
+ success: true;
34
+ /**The message that got sent. */
35
+ message: discord.Message<InGuild>;
36
+ } | {
37
+ /**Did the message get sent successfully? */
38
+ success: boolean;
39
+ /**The message that got sent. */
40
+ message: null;
41
+ };
27
42
  /**## ODResponderManager `class`
28
43
  * This is an Open Discord responder manager.
29
44
  *
@@ -53,6 +68,15 @@ export declare class ODResponderManager<CommandIdList extends ODCommandResponder
53
68
  autocomplete: ODAutocompleteResponderManager<AutocompleteIdList>;
54
69
  constructor(debug: ODDebugger, client: ODClientManager);
55
70
  }
71
+ /**## ODBaseResponderInstance `class`
72
+ * A base class for creating responder instances.
73
+ */
74
+ export declare abstract class ODBaseResponderInstance {
75
+ /**Get the final `messageCreateOptions` from a returned build result from builders/components. */
76
+ protected getMessageFromBuildResult(build: ODMessageBuildResult | ODMessageComponentBuildResult, type: "interaction" | "message"): discord.MessageCreateOptions & {
77
+ flags: number[];
78
+ };
79
+ }
56
80
  /**## ODCommandResponderManagerIdConstraint `type`
57
81
  * The constraint/layout for id mappings/interfaces of the `ODCommandResponderManager` class.
58
82
  */
@@ -76,7 +100,12 @@ export type ODCommandResponderManagerIdConstraint = Record<string, {
76
100
  * - And so much more!
77
101
  */
78
102
  export declare class ODCommandResponderManager<IdList extends ODCommandResponderManagerIdConstraint = ODCommandResponderManagerIdConstraint> extends ODManager<ODCommandResponder<"slash" | "text", any>> {
79
- #private;
103
+ /**An alias to the Open Discord client manager. */
104
+ private client;
105
+ /**The callback executed when the default workers take too much time to reply. */
106
+ private timeoutErrorCallback;
107
+ /**The amount of milliseconds before the timeout error callback is executed. */
108
+ private timeoutMs;
80
109
  constructor(debug: ODDebugger, debugname: string, client: ODClientManager);
81
110
  /**Set the message to send when the response times out! */
82
111
  setTimeoutErrorCallback(callback: ODResponderTimeoutErrorCallback<ODCommandResponderInstance, "slash" | "text"> | null, ms: number | null): void;
@@ -94,7 +123,12 @@ export declare class ODCommandResponderManager<IdList extends ODCommandResponder
94
123
  * This class will manage all options & subcommands from slash & text commands.
95
124
  */
96
125
  export declare class ODCommandResponderInstanceOptions {
97
- #private;
126
+ /**The interaction to get data from. */
127
+ private interaction;
128
+ /**The command which is related to the interaction. */
129
+ private cmd;
130
+ /**A list of options which have been parsed by the text command parser. */
131
+ private options;
98
132
  constructor(interaction: discord.ChatInputCommandInteraction | discord.Message, cmd: ODSlashCommand | ODTextCommand, options?: ODTextCommandInteractionOption[]);
99
133
  /**Get a string option. */
100
134
  getString(name: string, required: true): string;
@@ -130,7 +164,7 @@ export declare class ODCommandResponderInstanceOptions {
130
164
  *
131
165
  * An instance is an active slash interaction or used text command. You can reply to the command using `reply()` for both slash & text commands.
132
166
  */
133
- export declare class ODCommandResponderInstance {
167
+ export declare class ODCommandResponderInstance extends ODBaseResponderInstance {
134
168
  /**The interaction which is the source of this instance. */
135
169
  interaction: discord.ChatInputCommandInteraction | discord.Message;
136
170
  /**The command wich is the source of this instance. */
@@ -151,7 +185,7 @@ export declare class ODCommandResponderInstance {
151
185
  channel: discord.TextBasedChannel;
152
186
  constructor(interaction: discord.ChatInputCommandInteraction | discord.Message, cmd: ODSlashCommand | ODTextCommand, errorCallback: ODResponderTimeoutErrorCallback<ODCommandResponderInstance, "slash" | "text"> | null, timeoutMs: number | null, options?: ODTextCommandInteractionOption[]);
153
187
  /**Reply to this command. */
154
- reply(msg: ODMessageBuildResult): Promise<ODMessageBuildSentResult<boolean>>;
188
+ reply(build: ODMessageBuildResult | ODMessageComponentBuildResult): Promise<ODResponderSendResult<boolean>>;
155
189
  /**Defer this command. */
156
190
  defer(ephemeral: boolean): Promise<boolean>;
157
191
  /**Show a modal as reply to this command. */
@@ -191,7 +225,14 @@ export type ODButtonResponderManagerIdConstraint = Record<string, {
191
225
  * - And so much more!
192
226
  */
193
227
  export declare class ODButtonResponderManager<IdList extends ODButtonResponderManagerIdConstraint = ODButtonResponderManagerIdConstraint> extends ODManager<ODButtonResponder<"button", any>> {
194
- #private;
228
+ /**An alias to the Open Discord client manager. */
229
+ private client;
230
+ /**The callback executed when the default workers take too much time to reply. */
231
+ private timeoutErrorCallback;
232
+ /**The amount of milliseconds before the timeout error callback is executed. */
233
+ private timeoutMs;
234
+ /**A list of listeners which will listen to the raw interactionCreate event from discord.js */
235
+ private listeners;
195
236
  constructor(debug: ODDebugger, debugname: string, client: ODClientManager);
196
237
  /**Set the message to send when the response times out! */
197
238
  setTimeoutErrorCallback(callback: ODResponderTimeoutErrorCallback<ODButtonResponderInstance, "button"> | null, ms: number | null): void;
@@ -208,7 +249,7 @@ export declare class ODButtonResponderManager<IdList extends ODButtonResponderMa
208
249
  *
209
250
  * An instance is an active button interaction. You can reply to the button using `reply()`.
210
251
  */
211
- export declare class ODButtonResponderInstance {
252
+ export declare class ODButtonResponderInstance extends ODBaseResponderInstance {
212
253
  /**The interaction which is the source of this instance. */
213
254
  interaction: discord.ButtonInteraction;
214
255
  /**Did a worker already reply to this instance/interaction? */
@@ -225,9 +266,9 @@ export declare class ODButtonResponderInstance {
225
266
  message: discord.Message;
226
267
  constructor(interaction: discord.ButtonInteraction, errorCallback: ODResponderTimeoutErrorCallback<ODButtonResponderInstance, "button"> | null, timeoutMs: number | null);
227
268
  /**Reply to this button. */
228
- reply(msg: ODMessageBuildResult): Promise<ODMessageBuildSentResult<boolean>>;
269
+ reply(build: ODMessageBuildResult | ODMessageComponentBuildResult): Promise<ODResponderSendResult<boolean>>;
229
270
  /**Update the message of this button. */
230
- update(msg: ODMessageBuildResult): Promise<ODMessageBuildSentResult<boolean>>;
271
+ update(build: ODMessageBuildResult | ODMessageComponentBuildResult): Promise<ODResponderSendResult<boolean>>;
231
272
  /**Defer this button. */
232
273
  defer(type: "reply" | "update", ephemeral: boolean): Promise<boolean>;
233
274
  /**Show a modal as reply to this button. */
@@ -273,7 +314,14 @@ export type ODDropdownResponderManagerIdConstraint = Record<string, {
273
314
  * - And so much more!
274
315
  */
275
316
  export declare class ODDropdownResponderManager<IdList extends ODDropdownResponderManagerIdConstraint = ODDropdownResponderManagerIdConstraint> extends ODManager<ODDropdownResponder<"dropdown", any>> {
276
- #private;
317
+ /**An alias to the Open Discord client manager. */
318
+ private client;
319
+ /**The callback executed when the default workers take too much time to reply. */
320
+ private timeoutErrorCallback;
321
+ /**The amount of milliseconds before the timeout error callback is executed. */
322
+ private timeoutMs;
323
+ /**A list of listeners which will listen to the raw interactionCreate event from discord.js */
324
+ private listeners;
277
325
  constructor(debug: ODDebugger, debugname: string, client: ODClientManager);
278
326
  /**Set the message to send when the response times out! */
279
327
  setTimeoutErrorCallback(callback: ODResponderTimeoutErrorCallback<ODDropdownResponderInstance, "dropdown"> | null, ms: number | null): void;
@@ -291,7 +339,10 @@ export declare class ODDropdownResponderManager<IdList extends ODDropdownRespond
291
339
  * This class will manage all values from the dropdowns & select menus.
292
340
  */
293
341
  export declare class ODDropdownResponderInstanceValues {
294
- #private;
342
+ /**The interaction to get data from. */
343
+ private interaction;
344
+ /**The type of this dropdown. */
345
+ private type;
295
346
  constructor(interaction: discord.AnySelectMenuInteraction, type: ODDropdownData["type"]);
296
347
  /**Get the selected values. */
297
348
  getStringValues(): string[];
@@ -307,7 +358,7 @@ export declare class ODDropdownResponderInstanceValues {
307
358
  *
308
359
  * An instance is an active dropdown interaction. You can reply to the dropdown using `reply()`.
309
360
  */
310
- export declare class ODDropdownResponderInstance {
361
+ export declare class ODDropdownResponderInstance extends ODBaseResponderInstance {
311
362
  /**The interaction which is the source of this instance. */
312
363
  interaction: discord.AnySelectMenuInteraction;
313
364
  /**Did a worker already reply to this instance/interaction? */
@@ -328,9 +379,9 @@ export declare class ODDropdownResponderInstance {
328
379
  message: discord.Message;
329
380
  constructor(interaction: discord.AnySelectMenuInteraction, errorCallback: ODResponderTimeoutErrorCallback<ODDropdownResponderInstance, "dropdown"> | null, timeoutMs: number | null);
330
381
  /**Reply to this dropdown. */
331
- reply(msg: ODMessageBuildResult): Promise<ODMessageBuildSentResult<boolean>>;
382
+ reply(build: ODMessageBuildResult | ODMessageComponentBuildResult): Promise<ODResponderSendResult<boolean>>;
332
383
  /**Update the message of this dropdown. */
333
- update(msg: ODMessageBuildResult): Promise<ODMessageBuildSentResult<boolean>>;
384
+ update(build: ODMessageBuildResult | ODMessageComponentBuildResult): Promise<ODResponderSendResult<boolean>>;
334
385
  /**Defer this dropdown. */
335
386
  defer(type: "reply" | "update", ephemeral: boolean): Promise<boolean>;
336
387
  /**Show a modal as reply to this dropdown. */
@@ -376,7 +427,14 @@ export type ODModalResponderManagerIdConstraint = Record<string, {
376
427
  * - And so much more!
377
428
  */
378
429
  export declare class ODModalResponderManager<IdList extends ODModalResponderManagerIdConstraint = ODModalResponderManagerIdConstraint> extends ODManager<ODModalResponder<"modal", any>> {
379
- #private;
430
+ /**An alias to the Open Discord client manager. */
431
+ private client;
432
+ /**The callback executed when the default workers take too much time to reply. */
433
+ private timeoutErrorCallback;
434
+ /**The amount of milliseconds before the timeout error callback is executed. */
435
+ private timeoutMs;
436
+ /**A list of listeners which will listen to the raw interactionCreate event from discord.js */
437
+ private listeners;
380
438
  constructor(debug: ODDebugger, debugname: string, client: ODClientManager);
381
439
  /**Set the message to send when the response times out! */
382
440
  setTimeoutErrorCallback(callback: ODResponderTimeoutErrorCallback<ODModalResponderInstance, "modal"> | null, ms: number | null): void;
@@ -394,7 +452,8 @@ export declare class ODModalResponderManager<IdList extends ODModalResponderMana
394
452
  * This class will manage all fields from the modals.
395
453
  */
396
454
  export declare class ODModalResponderInstanceValues {
397
- #private;
455
+ /**The interaction to get data from. */
456
+ private interaction;
398
457
  constructor(interaction: discord.ModalSubmitInteraction);
399
458
  /**Get the value of a text field. */
400
459
  getTextField(name: string, required: true): string;
@@ -405,7 +464,7 @@ export declare class ODModalResponderInstanceValues {
405
464
  *
406
465
  * An instance is an active modal interaction. You can reply to the modal using `reply()`.
407
466
  */
408
- export declare class ODModalResponderInstance {
467
+ export declare class ODModalResponderInstance extends ODBaseResponderInstance {
409
468
  /**The interaction which is the source of this instance. */
410
469
  interaction: discord.ModalSubmitInteraction;
411
470
  /**Did a worker already reply to this instance/interaction? */
@@ -422,9 +481,9 @@ export declare class ODModalResponderInstance {
422
481
  channel: discord.TextBasedChannel | null;
423
482
  constructor(interaction: discord.ModalSubmitInteraction, errorCallback: ODResponderTimeoutErrorCallback<ODModalResponderInstance, "modal"> | null, timeoutMs: number | null);
424
483
  /**Reply to this modal. */
425
- reply(msg: ODMessageBuildResult): Promise<ODMessageBuildSentResult<boolean>>;
484
+ reply(build: ODMessageBuildResult | ODMessageComponentBuildResult): Promise<ODResponderSendResult<boolean>>;
426
485
  /**Update the message of this modal. */
427
- update(msg: ODMessageBuildResult): Promise<ODMessageBuildSentResult<boolean>>;
486
+ update(build: ODMessageBuildResult | ODMessageComponentBuildResult): Promise<ODResponderSendResult<boolean>>;
428
487
  /**Defer this modal. */
429
488
  defer(type: "reply" | "update", ephemeral: boolean): Promise<boolean>;
430
489
  }
@@ -459,7 +518,12 @@ export type ODContextMenuResponderManagerIdConstraint = Record<string, {
459
518
  * - And so much more!
460
519
  */
461
520
  export declare class ODContextMenuResponderManager<IdList extends ODContextMenuResponderManagerIdConstraint = ODContextMenuResponderManagerIdConstraint> extends ODManager<ODContextMenuResponder<"context-menu", any>> {
462
- #private;
521
+ /**An alias to the Open Discord client manager. */
522
+ private client;
523
+ /**The callback executed when the default workers take too much time to reply. */
524
+ private timeoutErrorCallback;
525
+ /**The amount of milliseconds before the timeout error callback is executed. */
526
+ private timeoutMs;
463
527
  constructor(debug: ODDebugger, debugname: string, client: ODClientManager);
464
528
  /**Set the message to send when the response times out! */
465
529
  setTimeoutErrorCallback(callback: ODResponderTimeoutErrorCallback<ODContextMenuResponderInstance, "context-menu"> | null, ms: number | null): void;
@@ -476,7 +540,7 @@ export declare class ODContextMenuResponderManager<IdList extends ODContextMenuR
476
540
  *
477
541
  * An instance is an active context menu interaction. You can reply to the context menu using `reply()`.
478
542
  */
479
- export declare class ODContextMenuResponderInstance {
543
+ export declare class ODContextMenuResponderInstance extends ODBaseResponderInstance {
480
544
  /**The interaction which is the source of this instance. */
481
545
  interaction: discord.ContextMenuCommandInteraction;
482
546
  /**Did a worker already reply to this instance/interaction? */
@@ -495,9 +559,9 @@ export declare class ODContextMenuResponderInstance {
495
559
  target: discord.Message | discord.User;
496
560
  constructor(interaction: discord.ContextMenuCommandInteraction, menu: ODContextMenu, errorCallback: ODResponderTimeoutErrorCallback<ODContextMenuResponderInstance, "context-menu"> | null, timeoutMs: number | null);
497
561
  /**Reply to this context menu. */
498
- reply(msg: ODMessageBuildResult): Promise<ODMessageBuildSentResult<boolean>>;
562
+ reply(build: ODMessageBuildResult | ODMessageComponentBuildResult): Promise<ODResponderSendResult<boolean>>;
499
563
  /**Update the message of this context menu. */
500
- update(msg: ODMessageBuildResult): Promise<ODMessageBuildSentResult<boolean>>;
564
+ update(build: ODMessageBuildResult | ODMessageComponentBuildResult): Promise<ODResponderSendResult<boolean>>;
501
565
  /**Defer this context menu. */
502
566
  defer(type: "reply", ephemeral: boolean): Promise<boolean>;
503
567
  /**Show a modal as reply to this context menu. */
@@ -534,7 +598,12 @@ export type ODAutocompleteResponderManagerIdConstraint = Record<string, {
534
598
  * - And so much more!
535
599
  */
536
600
  export declare class ODAutocompleteResponderManager<IdList extends ODAutocompleteResponderManagerIdConstraint = ODAutocompleteResponderManagerIdConstraint> extends ODManager<ODAutocompleteResponder<"autocomplete", any>> {
537
- #private;
601
+ /**An alias to the Open Discord client manager. */
602
+ private client;
603
+ /**The callback executed when the default workers take too much time to reply. */
604
+ private timeoutErrorCallback;
605
+ /**The amount of milliseconds before the timeout error callback is executed. */
606
+ private timeoutMs;
538
607
  constructor(debug: ODDebugger, debugname: string, client: ODClientManager);
539
608
  /**Set the message to send when the response times out! */
540
609
  setTimeoutErrorCallback(callback: ODResponderTimeoutErrorCallback<ODAutocompleteResponderInstance, "autocomplete"> | null, ms: number | null): void;
@@ -551,7 +620,7 @@ export declare class ODAutocompleteResponderManager<IdList extends ODAutocomplet
551
620
  *
552
621
  * An instance is an active autocomplete interaction. You can reply to the autocomplete using `reply()`.
553
622
  */
554
- export declare class ODAutocompleteResponderInstance {
623
+ export declare class ODAutocompleteResponderInstance extends ODBaseResponderInstance {
555
624
  /**The interaction which is the source of this instance. */
556
625
  interaction: discord.AutocompleteInteraction;
557
626
  /**Did a worker already respond to this instance/interaction? */