@open-discord-bots/framework 0.2.11 → 0.2.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/index.d.ts +26 -26
- package/dist/api/index.js +26 -42
- package/dist/api/main.d.ts +24 -24
- package/dist/api/main.js +7 -11
- package/dist/api/modules/action.d.ts +12 -12
- package/dist/api/modules/action.js +11 -17
- package/dist/api/modules/base.d.ts +7 -5
- package/dist/api/modules/base.js +22 -67
- package/dist/api/modules/builder.d.ts +44 -44
- package/dist/api/modules/builder.js +81 -142
- package/dist/api/modules/checker.d.ts +7 -7
- package/dist/api/modules/checker.js +55 -87
- package/dist/api/modules/client.d.ts +4 -4
- package/dist/api/modules/client.js +71 -118
- package/dist/api/modules/code.d.ts +2 -2
- package/dist/api/modules/code.js +3 -8
- package/dist/api/modules/config.d.ts +2 -2
- package/dist/api/modules/config.js +21 -63
- package/dist/api/modules/console.d.ts +16 -16
- package/dist/api/modules/console.js +61 -83
- package/dist/api/modules/cooldown.d.ts +2 -2
- package/dist/api/modules/cooldown.js +13 -23
- package/dist/api/modules/database.d.ts +2 -2
- package/dist/api/modules/database.js +19 -29
- package/dist/api/modules/event.d.ts +2 -2
- package/dist/api/modules/event.js +6 -11
- package/dist/api/modules/flag.d.ts +2 -2
- package/dist/api/modules/flag.js +3 -8
- package/dist/api/modules/fuse.js +2 -7
- package/dist/api/modules/helpmenu.d.ts +2 -2
- package/dist/api/modules/helpmenu.js +8 -16
- package/dist/api/modules/language.d.ts +2 -2
- package/dist/api/modules/language.js +12 -21
- package/dist/api/modules/permission.d.ts +3 -3
- package/dist/api/modules/permission.js +9 -47
- package/dist/api/modules/plugin.d.ts +2 -2
- package/dist/api/modules/plugin.js +9 -18
- package/dist/api/modules/post.d.ts +3 -3
- package/dist/api/modules/post.js +3 -8
- package/dist/api/modules/progressbar.d.ts +2 -2
- package/dist/api/modules/progressbar.js +14 -26
- package/dist/api/modules/responder.d.ts +42 -42
- package/dist/api/modules/responder.js +79 -138
- package/dist/api/modules/session.d.ts +2 -2
- package/dist/api/modules/session.js +4 -42
- package/dist/api/modules/startscreen.d.ts +4 -4
- package/dist/api/modules/startscreen.js +28 -44
- package/dist/api/modules/statistic.d.ts +3 -3
- package/dist/api/modules/statistic.js +11 -22
- package/dist/api/modules/verifybar.d.ts +5 -5
- package/dist/api/modules/verifybar.js +6 -11
- package/dist/api/modules/worker.d.ts +15 -15
- package/dist/api/modules/worker.js +12 -17
- package/dist/cli/editConfig.d.ts +2 -2
- package/dist/cli/editConfig.js +194 -248
- package/dist/cli/index.d.ts +2 -2
- package/dist/cli/index.js +37 -62
- package/dist/index.d.ts +4 -4
- package/dist/index.js +6 -13
- package/dist/startup/compilation.d.ts +1 -1
- package/dist/startup/compilation.js +35 -42
- package/dist/startup/dump.d.ts +1 -1
- package/dist/startup/dump.js +4 -41
- package/dist/startup/errorHandling.d.ts +1 -1
- package/dist/startup/errorHandling.js +2 -38
- package/dist/startup/pluginLauncher.d.ts +1 -1
- package/dist/startup/pluginLauncher.js +14 -52
- package/dist/utilities/index.d.ts +3 -3
- package/dist/utilities/index.js +20 -71
- package/package.json +5 -4
- package/src/api/index.ts +26 -26
- package/src/api/main.ts +25 -25
- package/src/api/modules/action.ts +13 -13
- package/src/api/modules/base.ts +14 -10
- package/src/api/modules/builder.ts +56 -56
- package/src/api/modules/checker.ts +7 -7
- package/src/api/modules/client.ts +18 -18
- package/src/api/modules/code.ts +2 -2
- package/src/api/modules/component.txt +350 -0
- package/src/api/modules/config.ts +3 -3
- package/src/api/modules/console.ts +28 -28
- package/src/api/modules/cooldown.ts +2 -2
- package/src/api/modules/database.ts +3 -3
- package/src/api/modules/event.ts +5 -5
- package/src/api/modules/flag.ts +2 -2
- package/src/api/modules/helpmenu.ts +4 -4
- package/src/api/modules/language.ts +3 -3
- package/src/api/modules/permission.ts +3 -3
- package/src/api/modules/plugin.ts +4 -4
- package/src/api/modules/post.ts +3 -3
- package/src/api/modules/progressbar.ts +5 -3
- package/src/api/modules/responder.ts +48 -48
- package/src/api/modules/session.ts +2 -2
- package/src/api/modules/startscreen.ts +4 -4
- package/src/api/modules/statistic.ts +3 -4
- package/src/api/modules/verifybar.ts +5 -5
- package/src/api/modules/worker.ts +25 -25
- package/src/cli/editConfig.ts +23 -37
- package/src/cli/index.ts +3 -3
- package/src/index.ts +5 -5
- package/src/startup/compilation.ts +2 -2
- package/src/startup/dump.ts +2 -2
- package/src/startup/errorHandling.ts +2 -2
- package/src/startup/pluginLauncher.ts +11 -8
- package/src/utilities/index.ts +4 -4
- package/tools/cleanup.js +1 -1
- package/tsconfig.json +2 -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.ODAutocompleteResponder = exports.ODAutocompleteResponderInstance = exports.ODAutocompleteResponderManager = exports.ODContextMenuResponder = exports.ODContextMenuResponderInstance = exports.ODContextMenuResponderManager = exports.ODModalResponder = exports.ODModalResponderInstance = exports.ODModalResponderInstanceValues = exports.ODModalResponderManager = exports.ODDropdownResponder = exports.ODDropdownResponderInstance = exports.ODDropdownResponderInstanceValues = exports.ODDropdownResponderManager = exports.ODButtonResponder = exports.ODButtonResponderInstance = exports.ODButtonResponderManager = exports.ODCommandResponder = exports.ODCommandResponderInstance = exports.ODCommandResponderInstanceOptions = exports.ODCommandResponderManager = exports.ODResponderManager = exports.ODResponderImplementation = void 0;
|
|
37
1
|
///////////////////////////////////////
|
|
38
2
|
//RESPONDER MODULE
|
|
39
3
|
///////////////////////////////////////
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
4
|
+
import { ODId, ODManager, ODSystemError, ODManagerData } from "./base.js";
|
|
5
|
+
import * as discord from "discord.js";
|
|
6
|
+
import { ODWorkerManager, ODWorker } from "./worker.js";
|
|
7
|
+
import { ODTextCommand } from "./client.js";
|
|
44
8
|
/**## ODResponderImplementation `class`
|
|
45
9
|
* This is an Open Discord responder implementation.
|
|
46
10
|
*
|
|
@@ -48,7 +12,7 @@ const client_1 = require("./client");
|
|
|
48
12
|
*
|
|
49
13
|
* This class can't be used stand-alone & needs to be extended from!
|
|
50
14
|
*/
|
|
51
|
-
class ODResponderImplementation extends
|
|
15
|
+
export class ODResponderImplementation extends ODManagerData {
|
|
52
16
|
/**The manager that has all workers of this implementation */
|
|
53
17
|
workers;
|
|
54
18
|
/**The `commandName` or `customId` needs to match this string or regex for this responder to be executed. */
|
|
@@ -56,16 +20,15 @@ class ODResponderImplementation extends base_1.ODManagerData {
|
|
|
56
20
|
constructor(id, match, callback, priority, callbackId) {
|
|
57
21
|
super(id);
|
|
58
22
|
this.match = match;
|
|
59
|
-
this.workers = new
|
|
23
|
+
this.workers = new ODWorkerManager("descending");
|
|
60
24
|
if (callback)
|
|
61
|
-
this.workers.add(new
|
|
25
|
+
this.workers.add(new ODWorker(callbackId ? callbackId : id, priority ?? 0, callback));
|
|
62
26
|
}
|
|
63
27
|
/**Execute all workers & return the result. */
|
|
64
|
-
async respond(instance,
|
|
65
|
-
throw new
|
|
28
|
+
async respond(instance, origin, params) {
|
|
29
|
+
throw new ODSystemError("Tried to build an unimplemented ODResponderImplementation");
|
|
66
30
|
}
|
|
67
31
|
}
|
|
68
|
-
exports.ODResponderImplementation = ODResponderImplementation;
|
|
69
32
|
/**## ODResponderManager `class`
|
|
70
33
|
* This is an Open Discord responder manager.
|
|
71
34
|
*
|
|
@@ -80,7 +43,7 @@ exports.ODResponderImplementation = ODResponderImplementation;
|
|
|
80
43
|
* - know where the request came from & parse options/subcommands & without errors!
|
|
81
44
|
* - And so much more!
|
|
82
45
|
*/
|
|
83
|
-
class ODResponderManager {
|
|
46
|
+
export class ODResponderManager {
|
|
84
47
|
/**A manager for all (text & slash) command responders. */
|
|
85
48
|
commands;
|
|
86
49
|
/**A manager for all button responders. */
|
|
@@ -102,7 +65,6 @@ class ODResponderManager {
|
|
|
102
65
|
this.autocomplete = new ODAutocompleteResponderManager(debug, "autocomplete responder", client);
|
|
103
66
|
}
|
|
104
67
|
}
|
|
105
|
-
exports.ODResponderManager = ODResponderManager;
|
|
106
68
|
/**## ODCommandResponderManager `class`
|
|
107
69
|
* This is an Open Discord command responder manager.
|
|
108
70
|
*
|
|
@@ -117,7 +79,7 @@ exports.ODResponderManager = ODResponderManager;
|
|
|
117
79
|
* - know where the request came from & parse options/subcommands & without errors!
|
|
118
80
|
* - And so much more!
|
|
119
81
|
*/
|
|
120
|
-
class ODCommandResponderManager extends
|
|
82
|
+
export class ODCommandResponderManager extends ODManager {
|
|
121
83
|
/**An alias to the Open Discord client manager. */
|
|
122
84
|
#client;
|
|
123
85
|
/**The callback executed when the default workers take too much time to reply. */
|
|
@@ -161,13 +123,12 @@ class ODCommandResponderManager extends base_1.ODManager {
|
|
|
161
123
|
return super.exists(id);
|
|
162
124
|
}
|
|
163
125
|
}
|
|
164
|
-
exports.ODCommandResponderManager = ODCommandResponderManager;
|
|
165
126
|
/**## ODCommandResponderInstanceOptions `class`
|
|
166
127
|
* This is an Open Discord command responder instance options manager.
|
|
167
128
|
*
|
|
168
129
|
* This class will manage all options & subcommands from slash & text commands.
|
|
169
130
|
*/
|
|
170
|
-
class ODCommandResponderInstanceOptions {
|
|
131
|
+
export class ODCommandResponderInstanceOptions {
|
|
171
132
|
/**The interaction to get data from. */
|
|
172
133
|
#interaction;
|
|
173
134
|
/**The command which is related to the interaction. */
|
|
@@ -185,7 +146,7 @@ class ODCommandResponderInstanceOptions {
|
|
|
185
146
|
return this.#interaction.options.getString(name, required);
|
|
186
147
|
}
|
|
187
148
|
catch {
|
|
188
|
-
throw new
|
|
149
|
+
throw new ODSystemError("ODCommandResponderInstanceOptions:getString() slash command option not found!");
|
|
189
150
|
}
|
|
190
151
|
}
|
|
191
152
|
else if (this.#interaction instanceof discord.Message) {
|
|
@@ -204,7 +165,7 @@ class ODCommandResponderInstanceOptions {
|
|
|
204
165
|
return this.#interaction.options.getBoolean(name, required);
|
|
205
166
|
}
|
|
206
167
|
catch {
|
|
207
|
-
throw new
|
|
168
|
+
throw new ODSystemError("ODCommandResponderInstanceOptions:getBoolean() slash command option not found!");
|
|
208
169
|
}
|
|
209
170
|
}
|
|
210
171
|
else if (this.#interaction instanceof discord.Message) {
|
|
@@ -223,7 +184,7 @@ class ODCommandResponderInstanceOptions {
|
|
|
223
184
|
return this.#interaction.options.getNumber(name, required);
|
|
224
185
|
}
|
|
225
186
|
catch {
|
|
226
|
-
throw new
|
|
187
|
+
throw new ODSystemError("ODCommandResponderInstanceOptions:getNumber() slash command option not found!");
|
|
227
188
|
}
|
|
228
189
|
}
|
|
229
190
|
else if (this.#interaction instanceof discord.Message) {
|
|
@@ -242,7 +203,7 @@ class ODCommandResponderInstanceOptions {
|
|
|
242
203
|
return this.#interaction.options.getChannel(name, required);
|
|
243
204
|
}
|
|
244
205
|
catch {
|
|
245
|
-
throw new
|
|
206
|
+
throw new ODSystemError("ODCommandResponderInstanceOptions:getChannel() slash command option not found!");
|
|
246
207
|
}
|
|
247
208
|
}
|
|
248
209
|
else if (this.#interaction instanceof discord.Message) {
|
|
@@ -261,7 +222,7 @@ class ODCommandResponderInstanceOptions {
|
|
|
261
222
|
return this.#interaction.options.getRole(name, required);
|
|
262
223
|
}
|
|
263
224
|
catch {
|
|
264
|
-
throw new
|
|
225
|
+
throw new ODSystemError("ODCommandResponderInstanceOptions:getRole() slash command option not found!");
|
|
265
226
|
}
|
|
266
227
|
}
|
|
267
228
|
else if (this.#interaction instanceof discord.Message) {
|
|
@@ -280,7 +241,7 @@ class ODCommandResponderInstanceOptions {
|
|
|
280
241
|
return this.#interaction.options.getUser(name, required);
|
|
281
242
|
}
|
|
282
243
|
catch {
|
|
283
|
-
throw new
|
|
244
|
+
throw new ODSystemError("ODCommandResponderInstanceOptions:getUser() slash command option not found!");
|
|
284
245
|
}
|
|
285
246
|
}
|
|
286
247
|
else if (this.#interaction instanceof discord.Message) {
|
|
@@ -298,11 +259,11 @@ class ODCommandResponderInstanceOptions {
|
|
|
298
259
|
try {
|
|
299
260
|
const member = this.#interaction.options.getMember(name);
|
|
300
261
|
if (!member && required)
|
|
301
|
-
throw new
|
|
262
|
+
throw new ODSystemError("ODCommandResponderInstanceOptions:getGuildMember() slash command option not found!");
|
|
302
263
|
return member;
|
|
303
264
|
}
|
|
304
265
|
catch {
|
|
305
|
-
throw new
|
|
266
|
+
throw new ODSystemError("ODCommandResponderInstanceOptions:getGuildMember() slash command option not found!");
|
|
306
267
|
}
|
|
307
268
|
}
|
|
308
269
|
else if (this.#interaction instanceof discord.Message) {
|
|
@@ -321,7 +282,7 @@ class ODCommandResponderInstanceOptions {
|
|
|
321
282
|
return this.#interaction.options.getMentionable(name, required);
|
|
322
283
|
}
|
|
323
284
|
catch {
|
|
324
|
-
throw new
|
|
285
|
+
throw new ODSystemError("ODCommandResponderInstanceOptions:getGuildMember() slash command option not found!");
|
|
325
286
|
}
|
|
326
287
|
}
|
|
327
288
|
else if (this.#interaction instanceof discord.Message) {
|
|
@@ -340,10 +301,10 @@ class ODCommandResponderInstanceOptions {
|
|
|
340
301
|
return this.#interaction.options.getSubcommandGroup(true);
|
|
341
302
|
}
|
|
342
303
|
catch {
|
|
343
|
-
throw new
|
|
304
|
+
throw new ODSystemError("ODCommandResponderInstanceOptions:getSubGroup() slash command option not found!");
|
|
344
305
|
}
|
|
345
306
|
}
|
|
346
|
-
else if (this.#interaction instanceof discord.Message && this.#cmd instanceof
|
|
307
|
+
else if (this.#interaction instanceof discord.Message && this.#cmd instanceof ODTextCommand) {
|
|
347
308
|
//0: name, 1:sub/group, 2:sub
|
|
348
309
|
const splittedName = this.#cmd.builder.name.split(" ");
|
|
349
310
|
return splittedName[1] ?? null;
|
|
@@ -357,10 +318,10 @@ class ODCommandResponderInstanceOptions {
|
|
|
357
318
|
return this.#interaction.options.getSubcommand(true);
|
|
358
319
|
}
|
|
359
320
|
catch {
|
|
360
|
-
throw new
|
|
321
|
+
throw new ODSystemError("ODCommandResponderInstanceOptions:getSubCommand() slash command option not found!");
|
|
361
322
|
}
|
|
362
323
|
}
|
|
363
|
-
else if (this.#interaction instanceof discord.Message && this.#cmd instanceof
|
|
324
|
+
else if (this.#interaction instanceof discord.Message && this.#cmd instanceof ODTextCommand) {
|
|
364
325
|
//0: name, 1:sub/group, 2:sub
|
|
365
326
|
const splittedName = this.#cmd.builder.name.split(" ");
|
|
366
327
|
//return the second subcommand when there is a subgroup
|
|
@@ -374,13 +335,12 @@ class ODCommandResponderInstanceOptions {
|
|
|
374
335
|
return null;
|
|
375
336
|
}
|
|
376
337
|
}
|
|
377
|
-
exports.ODCommandResponderInstanceOptions = ODCommandResponderInstanceOptions;
|
|
378
338
|
/**## ODCommandResponderInstance `class`
|
|
379
339
|
* This is an Open Discord command responder instance.
|
|
380
340
|
*
|
|
381
341
|
* An instance is an active slash interaction or used text command. You can reply to the command using `reply()` for both slash & text commands.
|
|
382
342
|
*/
|
|
383
|
-
class ODCommandResponderInstance {
|
|
343
|
+
export class ODCommandResponderInstance {
|
|
384
344
|
/**The interaction which is the source of this instance. */
|
|
385
345
|
interaction;
|
|
386
346
|
/**The command wich is the source of this instance. */
|
|
@@ -401,7 +361,7 @@ class ODCommandResponderInstance {
|
|
|
401
361
|
channel;
|
|
402
362
|
constructor(interaction, cmd, errorCallback, timeoutMs, options) {
|
|
403
363
|
if (!interaction.channel)
|
|
404
|
-
throw new
|
|
364
|
+
throw new ODSystemError("ODCommandResponderInstance: Unable to find interaction channel!");
|
|
405
365
|
this.interaction = interaction;
|
|
406
366
|
this.cmd = cmd;
|
|
407
367
|
this.type = (interaction instanceof discord.Message) ? "message" : "interaction";
|
|
@@ -414,7 +374,7 @@ class ODCommandResponderInstance {
|
|
|
414
374
|
if (!this.didReply) {
|
|
415
375
|
try {
|
|
416
376
|
if (!errorCallback) {
|
|
417
|
-
this.reply({ id: new
|
|
377
|
+
this.reply({ id: new ODId("looks-like-we-got-an-error-here"), ephemeral: true, message: {
|
|
418
378
|
content: ":x: **Something went wrong while replying to this command!**"
|
|
419
379
|
} });
|
|
420
380
|
}
|
|
@@ -478,13 +438,12 @@ class ODCommandResponderInstance {
|
|
|
478
438
|
return true;
|
|
479
439
|
}
|
|
480
440
|
}
|
|
481
|
-
exports.ODCommandResponderInstance = ODCommandResponderInstance;
|
|
482
441
|
/**## ODCommandResponder `class`
|
|
483
442
|
* This is an Open Discord command responder.
|
|
484
443
|
*
|
|
485
444
|
* This class manages all workers which are executed when the related command is triggered.
|
|
486
445
|
*/
|
|
487
|
-
class ODCommandResponder extends ODResponderImplementation {
|
|
446
|
+
export class ODCommandResponder extends ODResponderImplementation {
|
|
488
447
|
/**The prefix of the text command needs to match this */
|
|
489
448
|
prefix;
|
|
490
449
|
constructor(id, prefix, match, callback, priority, callbackId) {
|
|
@@ -492,12 +451,11 @@ class ODCommandResponder extends ODResponderImplementation {
|
|
|
492
451
|
this.prefix = prefix;
|
|
493
452
|
}
|
|
494
453
|
/**Respond to this command */
|
|
495
|
-
async respond(instance,
|
|
454
|
+
async respond(instance, origin, params) {
|
|
496
455
|
//wait for workers to finish
|
|
497
|
-
await this.workers.executeWorkers(instance,
|
|
456
|
+
await this.workers.executeWorkers(instance, origin, params);
|
|
498
457
|
}
|
|
499
458
|
}
|
|
500
|
-
exports.ODCommandResponder = ODCommandResponder;
|
|
501
459
|
/**## ODButtonResponderManager `class`
|
|
502
460
|
* This is an Open Discord button responder manager.
|
|
503
461
|
*
|
|
@@ -511,7 +469,7 @@ exports.ODCommandResponder = ODCommandResponder;
|
|
|
511
469
|
* - know where the request came from!
|
|
512
470
|
* - And so much more!
|
|
513
471
|
*/
|
|
514
|
-
class ODButtonResponderManager extends
|
|
472
|
+
export class ODButtonResponderManager extends ODManager {
|
|
515
473
|
/**An alias to the Open Discord client manager. */
|
|
516
474
|
#client;
|
|
517
475
|
/**The callback executed when the default workers take too much time to reply. */
|
|
@@ -555,13 +513,12 @@ class ODButtonResponderManager extends base_1.ODManager {
|
|
|
555
513
|
return super.exists(id);
|
|
556
514
|
}
|
|
557
515
|
}
|
|
558
|
-
exports.ODButtonResponderManager = ODButtonResponderManager;
|
|
559
516
|
/**## ODButtonResponderInstance `class`
|
|
560
517
|
* This is an Open Discord button responder instance.
|
|
561
518
|
*
|
|
562
519
|
* An instance is an active button interaction. You can reply to the button using `reply()`.
|
|
563
520
|
*/
|
|
564
|
-
class ODButtonResponderInstance {
|
|
521
|
+
export class ODButtonResponderInstance {
|
|
565
522
|
/**The interaction which is the source of this instance. */
|
|
566
523
|
interaction;
|
|
567
524
|
/**Did a worker already reply to this instance/interaction? */
|
|
@@ -578,7 +535,7 @@ class ODButtonResponderInstance {
|
|
|
578
535
|
message;
|
|
579
536
|
constructor(interaction, errorCallback, timeoutMs) {
|
|
580
537
|
if (!interaction.channel)
|
|
581
|
-
throw new
|
|
538
|
+
throw new ODSystemError("ODButtonResponderInstance: Unable to find interaction channel!");
|
|
582
539
|
this.interaction = interaction;
|
|
583
540
|
this.user = interaction.user;
|
|
584
541
|
this.member = (interaction.member instanceof discord.GuildMember) ? interaction.member : null;
|
|
@@ -589,7 +546,7 @@ class ODButtonResponderInstance {
|
|
|
589
546
|
if (!this.didReply) {
|
|
590
547
|
try {
|
|
591
548
|
if (!errorCallback) {
|
|
592
|
-
this.reply({ id: new
|
|
549
|
+
this.reply({ id: new ODId("looks-like-we-got-an-error-here"), ephemeral: true, message: {
|
|
593
550
|
content: ":x: **Something went wrong while replying to this button!**"
|
|
594
551
|
} });
|
|
595
552
|
}
|
|
@@ -690,20 +647,18 @@ class ODButtonResponderInstance {
|
|
|
690
647
|
return this.message.embeds[0] ?? null;
|
|
691
648
|
}
|
|
692
649
|
}
|
|
693
|
-
exports.ODButtonResponderInstance = ODButtonResponderInstance;
|
|
694
650
|
/**## ODButtonResponder `class`
|
|
695
651
|
* This is an Open Discord button responder.
|
|
696
652
|
*
|
|
697
653
|
* This class manages all workers which are executed when the related button is triggered.
|
|
698
654
|
*/
|
|
699
|
-
class ODButtonResponder extends ODResponderImplementation {
|
|
655
|
+
export class ODButtonResponder extends ODResponderImplementation {
|
|
700
656
|
/**Respond to this button */
|
|
701
|
-
async respond(instance,
|
|
657
|
+
async respond(instance, origin, params) {
|
|
702
658
|
//wait for workers to finish
|
|
703
|
-
await this.workers.executeWorkers(instance,
|
|
659
|
+
await this.workers.executeWorkers(instance, origin, params);
|
|
704
660
|
}
|
|
705
661
|
}
|
|
706
|
-
exports.ODButtonResponder = ODButtonResponder;
|
|
707
662
|
/**## ODDropdownResponderManager `class`
|
|
708
663
|
* This is an Open Discord dropdown responder manager.
|
|
709
664
|
*
|
|
@@ -717,7 +672,7 @@ exports.ODButtonResponder = ODButtonResponder;
|
|
|
717
672
|
* - know where the request came from!
|
|
718
673
|
* - And so much more!
|
|
719
674
|
*/
|
|
720
|
-
class ODDropdownResponderManager extends
|
|
675
|
+
export class ODDropdownResponderManager extends ODManager {
|
|
721
676
|
/**An alias to the Open Discord client manager. */
|
|
722
677
|
#client;
|
|
723
678
|
/**The callback executed when the default workers take too much time to reply. */
|
|
@@ -761,13 +716,12 @@ class ODDropdownResponderManager extends base_1.ODManager {
|
|
|
761
716
|
return super.exists(id);
|
|
762
717
|
}
|
|
763
718
|
}
|
|
764
|
-
exports.ODDropdownResponderManager = ODDropdownResponderManager;
|
|
765
719
|
/**## ODDropdownResponderInstanceValues `class`
|
|
766
720
|
* This is an Open Discord dropdown responder instance values manager.
|
|
767
721
|
*
|
|
768
722
|
* This class will manage all values from the dropdowns & select menus.
|
|
769
723
|
*/
|
|
770
|
-
class ODDropdownResponderInstanceValues {
|
|
724
|
+
export class ODDropdownResponderInstanceValues {
|
|
771
725
|
/**The interaction to get data from. */
|
|
772
726
|
#interaction;
|
|
773
727
|
/**The type of this dropdown. */
|
|
@@ -785,13 +739,13 @@ class ODDropdownResponderInstanceValues {
|
|
|
785
739
|
return this.#interaction.values;
|
|
786
740
|
}
|
|
787
741
|
catch {
|
|
788
|
-
throw new
|
|
742
|
+
throw new ODSystemError("ODDropdownResponderInstanceValues:getStringValues() invalid values!");
|
|
789
743
|
}
|
|
790
744
|
}
|
|
791
745
|
/**Get the selected roles. */
|
|
792
746
|
async getRoleValues() {
|
|
793
747
|
if (this.#type != "role")
|
|
794
|
-
throw new
|
|
748
|
+
throw new ODSystemError("ODDropdownResponderInstanceValues:getRoleValues() dropdown type isn't role!");
|
|
795
749
|
try {
|
|
796
750
|
const result = [];
|
|
797
751
|
for (const id of this.#interaction.values) {
|
|
@@ -804,13 +758,13 @@ class ODDropdownResponderInstanceValues {
|
|
|
804
758
|
return result;
|
|
805
759
|
}
|
|
806
760
|
catch {
|
|
807
|
-
throw new
|
|
761
|
+
throw new ODSystemError("ODDropdownResponderInstanceValues:getRoleValues() invalid values!");
|
|
808
762
|
}
|
|
809
763
|
}
|
|
810
764
|
/**Get the selected users. */
|
|
811
765
|
async getUserValues() {
|
|
812
766
|
if (this.#type != "role")
|
|
813
|
-
throw new
|
|
767
|
+
throw new ODSystemError("ODDropdownResponderInstanceValues:getUserValues() dropdown type isn't user!");
|
|
814
768
|
try {
|
|
815
769
|
const result = [];
|
|
816
770
|
for (const id of this.#interaction.values) {
|
|
@@ -821,13 +775,13 @@ class ODDropdownResponderInstanceValues {
|
|
|
821
775
|
return result;
|
|
822
776
|
}
|
|
823
777
|
catch {
|
|
824
|
-
throw new
|
|
778
|
+
throw new ODSystemError("ODDropdownResponderInstanceValues:getUserValues() invalid values!");
|
|
825
779
|
}
|
|
826
780
|
}
|
|
827
781
|
/**Get the selected channels. */
|
|
828
782
|
async getChannelValues() {
|
|
829
783
|
if (this.#type != "role")
|
|
830
|
-
throw new
|
|
784
|
+
throw new ODSystemError("ODDropdownResponderInstanceValues:getChannelValues() dropdown type isn't channel!");
|
|
831
785
|
try {
|
|
832
786
|
const result = [];
|
|
833
787
|
for (const id of this.#interaction.values) {
|
|
@@ -840,17 +794,16 @@ class ODDropdownResponderInstanceValues {
|
|
|
840
794
|
return result;
|
|
841
795
|
}
|
|
842
796
|
catch {
|
|
843
|
-
throw new
|
|
797
|
+
throw new ODSystemError("ODDropdownResponderInstanceValues:getChannelValues() invalid values!");
|
|
844
798
|
}
|
|
845
799
|
}
|
|
846
800
|
}
|
|
847
|
-
exports.ODDropdownResponderInstanceValues = ODDropdownResponderInstanceValues;
|
|
848
801
|
/**## ODDropdownResponderInstance `class`
|
|
849
802
|
* This is an Open Discord dropdown responder instance.
|
|
850
803
|
*
|
|
851
804
|
* An instance is an active dropdown interaction. You can reply to the dropdown using `reply()`.
|
|
852
805
|
*/
|
|
853
|
-
class ODDropdownResponderInstance {
|
|
806
|
+
export class ODDropdownResponderInstance {
|
|
854
807
|
/**The interaction which is the source of this instance. */
|
|
855
808
|
interaction;
|
|
856
809
|
/**Did a worker already reply to this instance/interaction? */
|
|
@@ -871,7 +824,7 @@ class ODDropdownResponderInstance {
|
|
|
871
824
|
message;
|
|
872
825
|
constructor(interaction, errorCallback, timeoutMs) {
|
|
873
826
|
if (!interaction.channel)
|
|
874
|
-
throw new
|
|
827
|
+
throw new ODSystemError("ODDropdownResponderInstance: Unable to find interaction channel!");
|
|
875
828
|
this.interaction = interaction;
|
|
876
829
|
if (interaction.isStringSelectMenu()) {
|
|
877
830
|
this.type = "string";
|
|
@@ -889,7 +842,7 @@ class ODDropdownResponderInstance {
|
|
|
889
842
|
this.type = "mentionable";
|
|
890
843
|
}
|
|
891
844
|
else
|
|
892
|
-
throw new
|
|
845
|
+
throw new ODSystemError("ODDropdownResponderInstance: invalid dropdown type!");
|
|
893
846
|
this.values = new ODDropdownResponderInstanceValues(interaction, this.type);
|
|
894
847
|
this.user = interaction.user;
|
|
895
848
|
this.member = (interaction.member instanceof discord.GuildMember) ? interaction.member : null;
|
|
@@ -900,7 +853,7 @@ class ODDropdownResponderInstance {
|
|
|
900
853
|
if (!this.didReply) {
|
|
901
854
|
try {
|
|
902
855
|
if (!errorCallback) {
|
|
903
|
-
this.reply({ id: new
|
|
856
|
+
this.reply({ id: new ODId("looks-like-we-got-an-error-here"), ephemeral: true, message: {
|
|
904
857
|
content: ":x: **Something went wrong while replying to this dropdown!**"
|
|
905
858
|
} });
|
|
906
859
|
}
|
|
@@ -1001,20 +954,18 @@ class ODDropdownResponderInstance {
|
|
|
1001
954
|
return this.message.embeds[0] ?? null;
|
|
1002
955
|
}
|
|
1003
956
|
}
|
|
1004
|
-
exports.ODDropdownResponderInstance = ODDropdownResponderInstance;
|
|
1005
957
|
/**## ODDropdownResponder `class`
|
|
1006
958
|
* This is an Open Discord dropdown responder.
|
|
1007
959
|
*
|
|
1008
960
|
* This class manages all workers which are executed when the related dropdown is triggered.
|
|
1009
961
|
*/
|
|
1010
|
-
class ODDropdownResponder extends ODResponderImplementation {
|
|
962
|
+
export class ODDropdownResponder extends ODResponderImplementation {
|
|
1011
963
|
/**Respond to this dropdown */
|
|
1012
|
-
async respond(instance,
|
|
964
|
+
async respond(instance, origin, params) {
|
|
1013
965
|
//wait for workers to finish
|
|
1014
|
-
await this.workers.executeWorkers(instance,
|
|
966
|
+
await this.workers.executeWorkers(instance, origin, params);
|
|
1015
967
|
}
|
|
1016
968
|
}
|
|
1017
|
-
exports.ODDropdownResponder = ODDropdownResponder;
|
|
1018
969
|
/**## ODModalResponderManager `class`
|
|
1019
970
|
* This is an Open Discord modal responder manager.
|
|
1020
971
|
*
|
|
@@ -1028,7 +979,7 @@ exports.ODDropdownResponder = ODDropdownResponder;
|
|
|
1028
979
|
* - know where the request came from!
|
|
1029
980
|
* - And so much more!
|
|
1030
981
|
*/
|
|
1031
|
-
class ODModalResponderManager extends
|
|
982
|
+
export class ODModalResponderManager extends ODManager {
|
|
1032
983
|
/**An alias to the Open Discord client manager. */
|
|
1033
984
|
#client;
|
|
1034
985
|
/**The callback executed when the default workers take too much time to reply. */
|
|
@@ -1072,13 +1023,12 @@ class ODModalResponderManager extends base_1.ODManager {
|
|
|
1072
1023
|
return super.exists(id);
|
|
1073
1024
|
}
|
|
1074
1025
|
}
|
|
1075
|
-
exports.ODModalResponderManager = ODModalResponderManager;
|
|
1076
1026
|
/**## ODModalResponderInstanceValues `class`
|
|
1077
1027
|
* This is an Open Discord modal responder instance values manager.
|
|
1078
1028
|
*
|
|
1079
1029
|
* This class will manage all fields from the modals.
|
|
1080
1030
|
*/
|
|
1081
|
-
class ODModalResponderInstanceValues {
|
|
1031
|
+
export class ODModalResponderInstanceValues {
|
|
1082
1032
|
/**The interaction to get data from. */
|
|
1083
1033
|
#interaction;
|
|
1084
1034
|
constructor(interaction) {
|
|
@@ -1088,21 +1038,20 @@ class ODModalResponderInstanceValues {
|
|
|
1088
1038
|
try {
|
|
1089
1039
|
const data = this.#interaction.fields.getField(name, discord.ComponentType.TextInput);
|
|
1090
1040
|
if (!data && required)
|
|
1091
|
-
throw new
|
|
1041
|
+
throw new ODSystemError("ODModalResponderInstanceValues:getTextField() field not found!");
|
|
1092
1042
|
return (data) ? data.value : null;
|
|
1093
1043
|
}
|
|
1094
1044
|
catch {
|
|
1095
|
-
throw new
|
|
1045
|
+
throw new ODSystemError("ODModalResponderInstanceValues:getTextField() field not found!");
|
|
1096
1046
|
}
|
|
1097
1047
|
}
|
|
1098
1048
|
}
|
|
1099
|
-
exports.ODModalResponderInstanceValues = ODModalResponderInstanceValues;
|
|
1100
1049
|
/**## ODModalResponderInstance `class`
|
|
1101
1050
|
* This is an Open Discord modal responder instance.
|
|
1102
1051
|
*
|
|
1103
1052
|
* An instance is an active modal interaction. You can reply to the modal using `reply()`.
|
|
1104
1053
|
*/
|
|
1105
|
-
class ODModalResponderInstance {
|
|
1054
|
+
export class ODModalResponderInstance {
|
|
1106
1055
|
/**The interaction which is the source of this instance. */
|
|
1107
1056
|
interaction;
|
|
1108
1057
|
/**Did a worker already reply to this instance/interaction? */
|
|
@@ -1128,7 +1077,7 @@ class ODModalResponderInstance {
|
|
|
1128
1077
|
if (!this.didReply) {
|
|
1129
1078
|
try {
|
|
1130
1079
|
if (!errorCallback) {
|
|
1131
|
-
this.reply({ id: new
|
|
1080
|
+
this.reply({ id: new ODId("looks-like-we-got-an-error-here"), ephemeral: true, message: {
|
|
1132
1081
|
content: ":x: **Something went wrong while replying to this modal!**"
|
|
1133
1082
|
} });
|
|
1134
1083
|
}
|
|
@@ -1188,20 +1137,18 @@ class ODModalResponderInstance {
|
|
|
1188
1137
|
return true;
|
|
1189
1138
|
}
|
|
1190
1139
|
}
|
|
1191
|
-
exports.ODModalResponderInstance = ODModalResponderInstance;
|
|
1192
1140
|
/**## ODModalResponder `class`
|
|
1193
1141
|
* This is an Open Discord modal responder.
|
|
1194
1142
|
*
|
|
1195
1143
|
* This class manages all workers which are executed when the related modal is triggered.
|
|
1196
1144
|
*/
|
|
1197
|
-
class ODModalResponder extends ODResponderImplementation {
|
|
1145
|
+
export class ODModalResponder extends ODResponderImplementation {
|
|
1198
1146
|
/**Respond to this modal */
|
|
1199
|
-
async respond(instance,
|
|
1147
|
+
async respond(instance, origin, params) {
|
|
1200
1148
|
//wait for workers to finish
|
|
1201
|
-
await this.workers.executeWorkers(instance,
|
|
1149
|
+
await this.workers.executeWorkers(instance, origin, params);
|
|
1202
1150
|
}
|
|
1203
1151
|
}
|
|
1204
|
-
exports.ODModalResponder = ODModalResponder;
|
|
1205
1152
|
/**## ODContextMenuResponderManager `class`
|
|
1206
1153
|
* This is an Open Discord context menu responder manager.
|
|
1207
1154
|
*
|
|
@@ -1215,7 +1162,7 @@ exports.ODModalResponder = ODModalResponder;
|
|
|
1215
1162
|
* - know where the request came from!
|
|
1216
1163
|
* - And so much more!
|
|
1217
1164
|
*/
|
|
1218
|
-
class ODContextMenuResponderManager extends
|
|
1165
|
+
export class ODContextMenuResponderManager extends ODManager {
|
|
1219
1166
|
/**An alias to the Open Discord client manager. */
|
|
1220
1167
|
#client;
|
|
1221
1168
|
/**The callback executed when the default workers take too much time to reply. */
|
|
@@ -1251,13 +1198,12 @@ class ODContextMenuResponderManager extends base_1.ODManager {
|
|
|
1251
1198
|
return super.exists(id);
|
|
1252
1199
|
}
|
|
1253
1200
|
}
|
|
1254
|
-
exports.ODContextMenuResponderManager = ODContextMenuResponderManager;
|
|
1255
1201
|
/**## ODContextMenuResponderInstance `class`
|
|
1256
1202
|
* This is an Open Discord context menu responder instance.
|
|
1257
1203
|
*
|
|
1258
1204
|
* An instance is an active context menu interaction. You can reply to the context menu using `reply()`.
|
|
1259
1205
|
*/
|
|
1260
|
-
class ODContextMenuResponderInstance {
|
|
1206
|
+
export class ODContextMenuResponderInstance {
|
|
1261
1207
|
/**The interaction which is the source of this instance. */
|
|
1262
1208
|
interaction;
|
|
1263
1209
|
/**Did a worker already reply to this instance/interaction? */
|
|
@@ -1276,7 +1222,7 @@ class ODContextMenuResponderInstance {
|
|
|
1276
1222
|
target;
|
|
1277
1223
|
constructor(interaction, menu, errorCallback, timeoutMs) {
|
|
1278
1224
|
if (!interaction.channel)
|
|
1279
|
-
throw new
|
|
1225
|
+
throw new ODSystemError("ODContextMenuResponderInstance: Unable to find interaction channel!");
|
|
1280
1226
|
this.interaction = interaction;
|
|
1281
1227
|
this.menu = menu;
|
|
1282
1228
|
this.user = interaction.user;
|
|
@@ -1288,12 +1234,12 @@ class ODContextMenuResponderInstance {
|
|
|
1288
1234
|
else if (interaction.isUserContextMenuCommand())
|
|
1289
1235
|
this.target = interaction.targetUser;
|
|
1290
1236
|
else
|
|
1291
|
-
throw new
|
|
1237
|
+
throw new ODSystemError("ODContextMenuResponderInstance: Invalid context menu type. Should be of the type User/Message!");
|
|
1292
1238
|
setTimeout(async () => {
|
|
1293
1239
|
if (!this.didReply) {
|
|
1294
1240
|
try {
|
|
1295
1241
|
if (!errorCallback) {
|
|
1296
|
-
this.reply({ id: new
|
|
1242
|
+
this.reply({ id: new ODId("looks-like-we-got-an-error-here"), ephemeral: true, message: {
|
|
1297
1243
|
content: ":x: **Something went wrong while replying to this context menu!**"
|
|
1298
1244
|
} });
|
|
1299
1245
|
}
|
|
@@ -1336,7 +1282,7 @@ class ODContextMenuResponderInstance {
|
|
|
1336
1282
|
return { success: true, message: await sent.fetch() };
|
|
1337
1283
|
}
|
|
1338
1284
|
else
|
|
1339
|
-
throw new
|
|
1285
|
+
throw new ODSystemError("Unable to update context menu interaction!");
|
|
1340
1286
|
}
|
|
1341
1287
|
catch {
|
|
1342
1288
|
return { success: false, message: null };
|
|
@@ -1362,20 +1308,18 @@ class ODContextMenuResponderInstance {
|
|
|
1362
1308
|
return true;
|
|
1363
1309
|
}
|
|
1364
1310
|
}
|
|
1365
|
-
exports.ODContextMenuResponderInstance = ODContextMenuResponderInstance;
|
|
1366
1311
|
/**## ODContextMenuResponder `class`
|
|
1367
1312
|
* This is an Open Discord context menu responder.
|
|
1368
1313
|
*
|
|
1369
1314
|
* This class manages all workers which are executed when the related context menu is triggered.
|
|
1370
1315
|
*/
|
|
1371
|
-
class ODContextMenuResponder extends ODResponderImplementation {
|
|
1316
|
+
export class ODContextMenuResponder extends ODResponderImplementation {
|
|
1372
1317
|
/**Respond to this button */
|
|
1373
|
-
async respond(instance,
|
|
1318
|
+
async respond(instance, origin, params) {
|
|
1374
1319
|
//wait for workers to finish
|
|
1375
|
-
await this.workers.executeWorkers(instance,
|
|
1320
|
+
await this.workers.executeWorkers(instance, origin, params);
|
|
1376
1321
|
}
|
|
1377
1322
|
}
|
|
1378
|
-
exports.ODContextMenuResponder = ODContextMenuResponder;
|
|
1379
1323
|
/**## ODAutocompleteResponderManager `class`
|
|
1380
1324
|
* This is an Open Discord autocomplete responder manager.
|
|
1381
1325
|
*
|
|
@@ -1389,7 +1333,7 @@ exports.ODContextMenuResponder = ODContextMenuResponder;
|
|
|
1389
1333
|
* - know where the request came from!
|
|
1390
1334
|
* - And so much more!
|
|
1391
1335
|
*/
|
|
1392
|
-
class ODAutocompleteResponderManager extends
|
|
1336
|
+
export class ODAutocompleteResponderManager extends ODManager {
|
|
1393
1337
|
/**An alias to the Open Discord client manager. */
|
|
1394
1338
|
#client;
|
|
1395
1339
|
/**The callback executed when the default workers take too much time to reply. */
|
|
@@ -1425,13 +1369,12 @@ class ODAutocompleteResponderManager extends base_1.ODManager {
|
|
|
1425
1369
|
return super.exists(id);
|
|
1426
1370
|
}
|
|
1427
1371
|
}
|
|
1428
|
-
exports.ODAutocompleteResponderManager = ODAutocompleteResponderManager;
|
|
1429
1372
|
/**## ODAutocompleteResponderInstance `class`
|
|
1430
1373
|
* This is an Open Discord autocomplete responder instance.
|
|
1431
1374
|
*
|
|
1432
1375
|
* An instance is an active autocomplete interaction. You can reply to the autocomplete using `reply()`.
|
|
1433
1376
|
*/
|
|
1434
|
-
class ODAutocompleteResponderInstance {
|
|
1377
|
+
export class ODAutocompleteResponderInstance {
|
|
1435
1378
|
/**The interaction which is the source of this instance. */
|
|
1436
1379
|
interaction;
|
|
1437
1380
|
/**Did a worker already respond to this instance/interaction? */
|
|
@@ -1448,7 +1391,7 @@ class ODAutocompleteResponderInstance {
|
|
|
1448
1391
|
target;
|
|
1449
1392
|
constructor(interaction, errorCallback, timeoutMs) {
|
|
1450
1393
|
if (!interaction.channel)
|
|
1451
|
-
throw new
|
|
1394
|
+
throw new ODSystemError("ODAutocompleteResponderInstance: Unable to find interaction channel!");
|
|
1452
1395
|
this.interaction = interaction;
|
|
1453
1396
|
this.user = interaction.user;
|
|
1454
1397
|
this.member = (interaction.member instanceof discord.GuildMember) ? interaction.member : null;
|
|
@@ -1457,7 +1400,7 @@ class ODAutocompleteResponderInstance {
|
|
|
1457
1400
|
this.target = interaction.options.getFocused(true);
|
|
1458
1401
|
setTimeout(async () => {
|
|
1459
1402
|
if (!this.didRespond) {
|
|
1460
|
-
process.emit("uncaughtException", new
|
|
1403
|
+
process.emit("uncaughtException", new ODSystemError("Autocomplete responder instance failed to respond widthin 2.5sec!"));
|
|
1461
1404
|
}
|
|
1462
1405
|
}, timeoutMs ?? 2500);
|
|
1463
1406
|
}
|
|
@@ -1496,13 +1439,12 @@ class ODAutocompleteResponderInstance {
|
|
|
1496
1439
|
return await this.autocomplete(filteredChoices);
|
|
1497
1440
|
}
|
|
1498
1441
|
}
|
|
1499
|
-
exports.ODAutocompleteResponderInstance = ODAutocompleteResponderInstance;
|
|
1500
1442
|
/**## ODAutocompleteResponder `class`
|
|
1501
1443
|
* This is an Open Discord autocomplete responder.
|
|
1502
1444
|
*
|
|
1503
1445
|
* This class manages all workers which are executed when the related autocomplete is triggered.
|
|
1504
1446
|
*/
|
|
1505
|
-
class ODAutocompleteResponder extends ODResponderImplementation {
|
|
1447
|
+
export class ODAutocompleteResponder extends ODResponderImplementation {
|
|
1506
1448
|
/**The slash command of the autocomplete should match the following regex. */
|
|
1507
1449
|
cmdMatch;
|
|
1508
1450
|
constructor(id, cmdMatch, match, callback, priority, callbackId) {
|
|
@@ -1510,9 +1452,8 @@ class ODAutocompleteResponder extends ODResponderImplementation {
|
|
|
1510
1452
|
this.cmdMatch = cmdMatch;
|
|
1511
1453
|
}
|
|
1512
1454
|
/**Respond to this autocomplete interaction. */
|
|
1513
|
-
async respond(instance,
|
|
1455
|
+
async respond(instance, origin, params) {
|
|
1514
1456
|
//wait for workers to finish
|
|
1515
|
-
await this.workers.executeWorkers(instance,
|
|
1457
|
+
await this.workers.executeWorkers(instance, origin, params);
|
|
1516
1458
|
}
|
|
1517
1459
|
}
|
|
1518
|
-
exports.ODAutocompleteResponder = ODAutocompleteResponder;
|