oopscord.js 0.0.29 → 0.0.30
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/README.md +1 -1
- package/bun.lock +264 -264
- package/dist/index.js +1 -17
- package/dist/structures/Constants.js +2 -5
- package/dist/structures/DiscordApp.d.ts.map +1 -1
- package/dist/structures/DiscordApp.js +84 -77
- package/dist/structures/Plugin.js +1 -5
- package/dist/structures/components/BaseButton.js +11 -15
- package/dist/structures/components/BaseModal.js +28 -35
- package/dist/structures/components/BaseSelectMenu.js +13 -17
- package/dist/structures/components/Listener.d.ts +18 -0
- package/dist/structures/components/Listener.d.ts.map +1 -0
- package/dist/structures/components/Listener.js +17 -0
- package/dist/structures/components/index.d.ts +1 -0
- package/dist/structures/components/index.d.ts.map +1 -1
- package/dist/structures/components/index.js +4 -19
- package/dist/structures/decorators/CommandDecorator.d.ts +1 -1
- package/dist/structures/decorators/CommandDecorator.d.ts.map +1 -1
- package/dist/structures/decorators/CommandDecorator.js +127 -158
- package/dist/structures/decorators/Constants.d.ts +5 -3
- package/dist/structures/decorators/Constants.d.ts.map +1 -1
- package/dist/structures/decorators/Constants.js +32 -33
- package/dist/structures/decorators/DiscordModuleDecorator.d.ts +4 -17
- package/dist/structures/decorators/DiscordModuleDecorator.d.ts.map +1 -1
- package/dist/structures/decorators/DiscordModuleDecorator.js +9 -34
- package/dist/structures/decorators/EventDecorator.d.ts +44 -0
- package/dist/structures/decorators/EventDecorator.d.ts.map +1 -0
- package/dist/structures/decorators/EventDecorator.js +44 -0
- package/dist/structures/decorators/InteractionHandlerDecorator.js +5 -9
- package/dist/structures/decorators/MessageComponentDecorator.d.ts +1 -1
- package/dist/structures/decorators/MessageComponentDecorator.d.ts.map +1 -1
- package/dist/structures/decorators/MessageComponentDecorator.js +68 -86
- package/dist/structures/decorators/index.d.ts +1 -0
- package/dist/structures/decorators/index.d.ts.map +1 -1
- package/dist/structures/decorators/index.js +6 -21
- package/dist/structures/index.js +6 -22
- package/dist/utils/Util.js +3 -7
- package/package.json +38 -38
- package/tsdown.config.json +3 -0
package/dist/index.js
CHANGED
|
@@ -1,17 +1 @@
|
|
|
1
|
-
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./structures"), exports);
|
|
1
|
+
export * from "./structures";
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InteractionType = void 0;
|
|
4
1
|
/** The interaction type enum. */
|
|
5
|
-
var InteractionType;
|
|
2
|
+
export var InteractionType;
|
|
6
3
|
(function (InteractionType) {
|
|
7
4
|
InteractionType[InteractionType["CHAT_INPUT_COMMAND"] = 0] = "CHAT_INPUT_COMMAND";
|
|
8
5
|
InteractionType[InteractionType["CONTEXT_MENU_COMMAND"] = 1] = "CONTEXT_MENU_COMMAND";
|
|
9
6
|
InteractionType[InteractionType["BUTTON"] = 2] = "BUTTON";
|
|
10
7
|
InteractionType[InteractionType["SELECT_MENU"] = 3] = "SELECT_MENU";
|
|
11
8
|
InteractionType[InteractionType["MODAL_SUBMIT"] = 4] = "MODAL_SUBMIT";
|
|
12
|
-
})(InteractionType || (
|
|
9
|
+
})(InteractionType || (InteractionType = {}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DiscordApp.d.ts","sourceRoot":"","sources":["../../src/structures/DiscordApp.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4E,MAAM,EAA4L,MAAM,YAAY,CAAC;AAMxS,OAAO,EAA4E,MAAM,EAAE,MAAM,GAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"DiscordApp.d.ts","sourceRoot":"","sources":["../../src/structures/DiscordApp.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4E,MAAM,EAA4L,MAAM,YAAY,CAAC;AAMxS,OAAO,EAA4E,MAAM,EAAE,MAAM,GAAG,CAAC;AAIrG,yKAAyK;AACzK,MAAM,WAAW,MAAM;IACnB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CACrB;AAOD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,iBAAiB;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;gBAEH,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAK1C,aAAa;IACb,QAAQ;CAGX;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,qBAAa,UAAU;;;IAuBnB;;;OAGG;IACG,KAAK;IA2aX;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,iBAAiB,EAAE,OAAO,GAAE,iBAAsB;CAWzF"}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const Constants_1 = require("./decorators/Constants");
|
|
7
|
-
const Constants_2 = require("./Constants");
|
|
8
|
-
const Util_1 = require("../utils/Util");
|
|
1
|
+
import { Client, Collection, ContextMenuCommandBuilder, REST, SlashCommandBuilder } from "discord.js";
|
|
2
|
+
import { Routes } from "discord-api-types/v10";
|
|
3
|
+
import { COMMAND_DESCRIPTION_KEY, COMMAND_NAME_KEY, COMMAND_PRIVATE_KEY, DICSORD_MODULE_OPTIONS_KEY, INTERNAL_EVENTS_KEY, INTERACTION_TYPE_KEY, COMMAND_OPTIONS_KEY, COMMAND_PRIVATE_GUILD_KEY, INTERACTION_RUN_METHOD_KEY, OPTIONS_PARAMETER_INDEX_KEY, INTERACTION_PARAMETER_INDEX_KEY, COMMAND_SUBCOMMAND_GROUPS_KEY, COMMAND_SUBCOMMANDS_KEY, MODULE_TYPE_KEY, ModuleType, COMMAND_MODULE_COMMANDS_KEY, MESSAGE_COMPONENT_MODULE_COMPONENTS_KEY, BUTTON_OPTIONS_KEY, SELECT_MENU_OPTIONS_KEY, MODAL_OPTIONS_KEY, MODAL_TEXT_INPUT_VALUE_INDEX_KEY, CONTEXT_MENU_TYPE_KEY, INTERACTION_INTEGRATION_TYPES_KEY, MODAL_SELECT_MENU_VALUE_INDEX_KEY, MODAL_FILE_UPLOAD_VALUE_INDEX_KEY, MODAL_COMPONENTS_KEY, EVENT_MODULE_LISTENERS_KEY } from "./decorators/Constants";
|
|
4
|
+
import { InteractionType } from "./Constants";
|
|
5
|
+
import { Util } from "../utils/Util";
|
|
9
6
|
const defaultDiscordAppOptions = {
|
|
10
7
|
logger: console,
|
|
11
8
|
plugins: []
|
|
@@ -33,7 +30,7 @@ const defaultDiscordAppOptions = {
|
|
|
33
30
|
*
|
|
34
31
|
* @see {@link DiscordApp.create}
|
|
35
32
|
*/
|
|
36
|
-
class BaseDiscordModule {
|
|
33
|
+
export class BaseDiscordModule {
|
|
37
34
|
client;
|
|
38
35
|
logger;
|
|
39
36
|
constructor(client, logger) {
|
|
@@ -44,7 +41,6 @@ class BaseDiscordModule {
|
|
|
44
41
|
_onReady() {
|
|
45
42
|
}
|
|
46
43
|
}
|
|
47
|
-
exports.BaseDiscordModule = BaseDiscordModule;
|
|
48
44
|
let a1 = false;
|
|
49
45
|
/**
|
|
50
46
|
* Main application class for managing Discord bot functionality.
|
|
@@ -73,7 +69,7 @@ let a1 = false;
|
|
|
73
69
|
*
|
|
74
70
|
* @public
|
|
75
71
|
*/
|
|
76
|
-
class DiscordApp {
|
|
72
|
+
export class DiscordApp {
|
|
77
73
|
#rest;
|
|
78
74
|
#client;
|
|
79
75
|
#moduleFunction;
|
|
@@ -90,40 +86,40 @@ class DiscordApp {
|
|
|
90
86
|
throw new ReferenceError("Please use DiscordApp.create()");
|
|
91
87
|
a1 = false;
|
|
92
88
|
this.#loadStartTimestamp = Date.now();
|
|
93
|
-
this.#rest = new
|
|
89
|
+
this.#rest = new REST({ version: "10" });
|
|
94
90
|
}
|
|
95
91
|
/**
|
|
96
92
|
* Logs in to Discord and deploys the commands. This method must be called after creating the application with `DiscordApp.create()`.
|
|
97
93
|
* @see {@link DiscordApp.create}
|
|
98
94
|
*/
|
|
99
95
|
async login() {
|
|
100
|
-
const commands = this.#commands.filter(i => Reflect.getMetadata(
|
|
101
|
-
const privateCommands = commands.filter(c => Reflect.getMetadata(
|
|
102
|
-
const globalCommands = commands.filter(c => !Reflect.getMetadata(
|
|
96
|
+
const commands = this.#commands.filter(i => Reflect.getMetadata(INTERACTION_TYPE_KEY, i) == InteractionType.CHAT_INPUT_COMMAND || Reflect.getMetadata(INTERACTION_TYPE_KEY, i) == InteractionType.CONTEXT_MENU_COMMAND);
|
|
97
|
+
const privateCommands = commands.filter(c => Reflect.getMetadata(COMMAND_PRIVATE_KEY, c));
|
|
98
|
+
const globalCommands = commands.filter(c => !Reflect.getMetadata(COMMAND_PRIVATE_KEY, c));
|
|
103
99
|
this.#module.logger.info(`Found ${commands.length} command(s) in total, ${globalCommands.length} global command(s) and ${privateCommands.length} private command(s). (${(Date.now() - this.#loadStartTimestamp)}ms)`);
|
|
104
100
|
this.#module.logger.info("Mapping global commands...");
|
|
105
101
|
// Prepare global commands
|
|
106
102
|
const apiGlobalCommands = globalCommands.map(c => {
|
|
107
|
-
const type = Reflect.getMetadata(
|
|
108
|
-
const integrationTypes = Reflect.getMetadata(
|
|
109
|
-
if (type ==
|
|
110
|
-
return this.#mapSlashCommand(Reflect.getMetadata(
|
|
103
|
+
const type = Reflect.getMetadata(INTERACTION_TYPE_KEY, c);
|
|
104
|
+
const integrationTypes = Reflect.getMetadata(INTERACTION_INTEGRATION_TYPES_KEY, c);
|
|
105
|
+
if (type == InteractionType.CHAT_INPUT_COMMAND)
|
|
106
|
+
return this.#mapSlashCommand(Reflect.getMetadata(COMMAND_NAME_KEY, c), Reflect.getMetadata(COMMAND_DESCRIPTION_KEY, c), Reflect.getMetadata(COMMAND_OPTIONS_KEY, c), integrationTypes);
|
|
111
107
|
else
|
|
112
|
-
return this.#mapContextMenuCommand(Reflect.getMetadata(
|
|
108
|
+
return this.#mapContextMenuCommand(Reflect.getMetadata(COMMAND_NAME_KEY, c), Reflect.getMetadata(CONTEXT_MENU_TYPE_KEY, c), integrationTypes);
|
|
113
109
|
});
|
|
114
110
|
this.#module.logger.info(`└─ Mapped ${apiGlobalCommands.length} global command(s). (${(Date.now() - this.#loadStartTimestamp)}ms)`);
|
|
115
111
|
this.#module.logger.info("Mapping private commands...");
|
|
116
112
|
// Prepare private commands
|
|
117
113
|
const apiPrivateCommands = {};
|
|
118
114
|
privateCommands.forEach(c => {
|
|
119
|
-
const guildId = Reflect.getMetadata(
|
|
120
|
-
const type = Reflect.getMetadata(
|
|
121
|
-
const integrationTypes = Reflect.getMetadata(
|
|
115
|
+
const guildId = Reflect.getMetadata(COMMAND_PRIVATE_GUILD_KEY, c);
|
|
116
|
+
const type = Reflect.getMetadata(INTERACTION_TYPE_KEY, c);
|
|
117
|
+
const integrationTypes = Reflect.getMetadata(INTERACTION_INTEGRATION_TYPES_KEY, c);
|
|
122
118
|
let data;
|
|
123
|
-
if (type ==
|
|
124
|
-
data = this.#mapSlashCommand(Reflect.getMetadata(
|
|
119
|
+
if (type == InteractionType.CHAT_INPUT_COMMAND)
|
|
120
|
+
data = this.#mapSlashCommand(Reflect.getMetadata(COMMAND_NAME_KEY, c), Reflect.getMetadata(COMMAND_DESCRIPTION_KEY, c), Reflect.getMetadata(COMMAND_OPTIONS_KEY, c), integrationTypes);
|
|
125
121
|
else
|
|
126
|
-
data = this.#mapContextMenuCommand(Reflect.getMetadata(
|
|
122
|
+
data = this.#mapContextMenuCommand(Reflect.getMetadata(COMMAND_NAME_KEY, c), Reflect.getMetadata(CONTEXT_MENU_TYPE_KEY, c), integrationTypes);
|
|
127
123
|
if (!Array.isArray(apiPrivateCommands[guildId]))
|
|
128
124
|
apiPrivateCommands[guildId] = [];
|
|
129
125
|
apiPrivateCommands[guildId].push(data);
|
|
@@ -137,15 +133,15 @@ class DiscordApp {
|
|
|
137
133
|
try {
|
|
138
134
|
this.#module.logger.info("Deploying commands...");
|
|
139
135
|
if (this.#moduleOptions.test.enable) {
|
|
140
|
-
await this.#rest.put(
|
|
136
|
+
await this.#rest.put(Routes.applicationGuildCommands(this.#client.user.id, this.#moduleOptions.test.guild), { body: apiGlobalCommands });
|
|
141
137
|
this.#module.logger.info(`├─ Successfully registered global commands, in test guild ${this.#moduleOptions.test.guild}. (${(Date.now() - this.#loadStartTimestamp)}ms)`);
|
|
142
138
|
}
|
|
143
139
|
else {
|
|
144
|
-
await this.#rest.put(
|
|
140
|
+
await this.#rest.put(Routes.applicationCommands(this.#client.user.id), { body: apiGlobalCommands });
|
|
145
141
|
this.#module.logger.info(`├─ Successfully registered global commands. (${(Date.now() - this.#loadStartTimestamp)}ms)`);
|
|
146
142
|
}
|
|
147
143
|
for (const guildId in apiPrivateCommands) {
|
|
148
|
-
await this.#rest.put(
|
|
144
|
+
await this.#rest.put(Routes.applicationGuildCommands(this.#client.user.id, guildId), { body: apiPrivateCommands[guildId] });
|
|
149
145
|
this.#module.logger.info(`├─ Successfully registered private commands in ${guildId}. (${(Date.now() - this.#loadStartTimestamp)}ms)`);
|
|
150
146
|
}
|
|
151
147
|
this.#module.logger.info("└─ Successfully deployed all commands.");
|
|
@@ -163,17 +159,17 @@ class DiscordApp {
|
|
|
163
159
|
* @internal
|
|
164
160
|
*/
|
|
165
161
|
#chatInputCommandHandler(itr) {
|
|
166
|
-
const commands = this.#commands.filter(i => Reflect.getMetadata(
|
|
162
|
+
const commands = this.#commands.filter(i => Reflect.getMetadata(INTERACTION_TYPE_KEY, i) == InteractionType.CHAT_INPUT_COMMAND);
|
|
167
163
|
const commandName = itr.commandName;
|
|
168
|
-
const command = commands.find(c => Reflect.getMetadata(
|
|
164
|
+
const command = commands.find(c => Reflect.getMetadata(COMMAND_NAME_KEY, c) == commandName);
|
|
169
165
|
if (!command)
|
|
170
166
|
return;
|
|
171
167
|
if (itr.options.getSubcommandGroup(false)) {
|
|
172
|
-
let handler = Reflect.getMetadata(
|
|
168
|
+
let handler = Reflect.getMetadata(COMMAND_SUBCOMMAND_GROUPS_KEY, command)[itr.options.getSubcommandGroup(true)]?.find(c => Reflect.getMetadata(COMMAND_NAME_KEY, c) == itr.options.getSubcommand(true));
|
|
173
169
|
if (!handler)
|
|
174
170
|
return;
|
|
175
|
-
let runMethod = Reflect.getMetadata(
|
|
176
|
-
let preArgs = [Reflect.getMetadata(
|
|
171
|
+
let runMethod = Reflect.getMetadata(INTERACTION_RUN_METHOD_KEY, handler);
|
|
172
|
+
let preArgs = [Reflect.getMetadata(INTERACTION_PARAMETER_INDEX_KEY, handler), ...(Reflect.getMetadata(OPTIONS_PARAMETER_INDEX_KEY, handler) || [])];
|
|
177
173
|
let args = Array(preArgs.length).fill(null);
|
|
178
174
|
if (runMethod == undefined)
|
|
179
175
|
throw new TypeError("Failed to get the run method. Did you add the @Run decorator?");
|
|
@@ -187,11 +183,11 @@ class DiscordApp {
|
|
|
187
183
|
cmd[runMethod]();
|
|
188
184
|
}
|
|
189
185
|
else if (itr.options.getSubcommand(false)) {
|
|
190
|
-
let handler = Reflect.getMetadata(
|
|
186
|
+
let handler = Reflect.getMetadata(COMMAND_SUBCOMMANDS_KEY, command).find(c => Reflect.getMetadata(COMMAND_NAME_KEY, c) == itr.options.getSubcommand(true));
|
|
191
187
|
if (!handler)
|
|
192
188
|
return;
|
|
193
|
-
let runMethod = Reflect.getMetadata(
|
|
194
|
-
let preArgs = [Reflect.getMetadata(
|
|
189
|
+
let runMethod = Reflect.getMetadata(INTERACTION_RUN_METHOD_KEY, handler);
|
|
190
|
+
let preArgs = [Reflect.getMetadata(INTERACTION_PARAMETER_INDEX_KEY, handler), ...(Reflect.getMetadata(OPTIONS_PARAMETER_INDEX_KEY, handler) || [])];
|
|
195
191
|
let args = Array(preArgs.length).fill(null);
|
|
196
192
|
if (runMethod == undefined)
|
|
197
193
|
throw new TypeError("Failed to get the run method. Did you add the @Run decorator?");
|
|
@@ -205,8 +201,8 @@ class DiscordApp {
|
|
|
205
201
|
cmd[runMethod]();
|
|
206
202
|
}
|
|
207
203
|
else {
|
|
208
|
-
let runMethod = Reflect.getMetadata(
|
|
209
|
-
let preArgs = [Reflect.getMetadata(
|
|
204
|
+
let runMethod = Reflect.getMetadata(INTERACTION_RUN_METHOD_KEY, command);
|
|
205
|
+
let preArgs = [Reflect.getMetadata(INTERACTION_PARAMETER_INDEX_KEY, command), ...(Reflect.getMetadata(OPTIONS_PARAMETER_INDEX_KEY, command) || [])];
|
|
210
206
|
let args = Array(preArgs.length).fill(null);
|
|
211
207
|
if (runMethod == undefined)
|
|
212
208
|
throw new TypeError("Failed to get the run method. Did you add the @Run decorator?");
|
|
@@ -227,12 +223,12 @@ class DiscordApp {
|
|
|
227
223
|
* @internal
|
|
228
224
|
*/
|
|
229
225
|
#contextMenuCommandHandler(itr) {
|
|
230
|
-
const commands = this.#commands.filter(i => Reflect.getMetadata(
|
|
226
|
+
const commands = this.#commands.filter(i => Reflect.getMetadata(INTERACTION_TYPE_KEY, i) == InteractionType.CONTEXT_MENU_COMMAND);
|
|
231
227
|
const commandName = itr.commandName;
|
|
232
|
-
const command = commands.find(c => Reflect.getMetadata(
|
|
228
|
+
const command = commands.find(c => Reflect.getMetadata(COMMAND_NAME_KEY, c) == commandName && Reflect.getMetadata(COMMAND_OPTIONS_KEY, c).type == itr.commandType);
|
|
233
229
|
if (!command)
|
|
234
230
|
return;
|
|
235
|
-
let runMethod = Reflect.getMetadata(
|
|
231
|
+
let runMethod = Reflect.getMetadata(INTERACTION_RUN_METHOD_KEY, command);
|
|
236
232
|
if (runMethod == undefined)
|
|
237
233
|
throw new TypeError("Failed to get the run method. Did you add the @Run decorator?");
|
|
238
234
|
let cmd = new command(itr);
|
|
@@ -245,10 +241,10 @@ class DiscordApp {
|
|
|
245
241
|
* @internal
|
|
246
242
|
*/
|
|
247
243
|
#buttonHandler(itr) {
|
|
248
|
-
const button = this.#buttons.find(b => Reflect.getMetadata(
|
|
244
|
+
const button = this.#buttons.find(b => Reflect.getMetadata(BUTTON_OPTIONS_KEY, b).customId == itr.customId);
|
|
249
245
|
if (!button)
|
|
250
246
|
return;
|
|
251
|
-
let runMethod = Reflect.getMetadata(
|
|
247
|
+
let runMethod = Reflect.getMetadata(INTERACTION_RUN_METHOD_KEY, button);
|
|
252
248
|
if (runMethod == undefined)
|
|
253
249
|
throw new TypeError("Failed to get the run method. Did you add the @Run decorator?");
|
|
254
250
|
let cmd = new button(itr);
|
|
@@ -261,10 +257,10 @@ class DiscordApp {
|
|
|
261
257
|
* @internal
|
|
262
258
|
*/
|
|
263
259
|
#selectMenuHandler(itr) {
|
|
264
|
-
const selectMenu = this.#selectMenus.find(b => Reflect.getMetadata(
|
|
260
|
+
const selectMenu = this.#selectMenus.find(b => Reflect.getMetadata(SELECT_MENU_OPTIONS_KEY, b).customId == itr.customId);
|
|
265
261
|
if (!selectMenu)
|
|
266
262
|
return;
|
|
267
|
-
let runMethod = Reflect.getMetadata(
|
|
263
|
+
let runMethod = Reflect.getMetadata(INTERACTION_RUN_METHOD_KEY, selectMenu);
|
|
268
264
|
if (runMethod == undefined)
|
|
269
265
|
throw new TypeError("Failed to get the run method. Did you add the @Run decorator?");
|
|
270
266
|
let cmd = new selectMenu(itr);
|
|
@@ -277,12 +273,12 @@ class DiscordApp {
|
|
|
277
273
|
* @internal
|
|
278
274
|
*/
|
|
279
275
|
#modalHandler(itr) {
|
|
280
|
-
const modal = this.#modals.find(b => Reflect.getMetadata(
|
|
276
|
+
const modal = this.#modals.find(b => Reflect.getMetadata(MODAL_OPTIONS_KEY, b).customId == itr.customId);
|
|
281
277
|
if (!modal)
|
|
282
278
|
return;
|
|
283
|
-
const modalComponents = Reflect.getMetadata(
|
|
284
|
-
let runMethod = Reflect.getMetadata(
|
|
285
|
-
let preArgs = [Reflect.getMetadata(
|
|
279
|
+
const modalComponents = Reflect.getMetadata(MODAL_COMPONENTS_KEY, modal);
|
|
280
|
+
let runMethod = Reflect.getMetadata(INTERACTION_RUN_METHOD_KEY, modal);
|
|
281
|
+
let preArgs = [Reflect.getMetadata(INTERACTION_PARAMETER_INDEX_KEY, modal), ...(Reflect.getMetadata(MODAL_TEXT_INPUT_VALUE_INDEX_KEY, modal) || []), ...(Reflect.getMetadata(MODAL_SELECT_MENU_VALUE_INDEX_KEY, modal) || []), ...(Reflect.getMetadata(MODAL_FILE_UPLOAD_VALUE_INDEX_KEY, modal) || [])];
|
|
286
282
|
let args = Array(preArgs.length).fill(null);
|
|
287
283
|
preArgs.forEach(arg => {
|
|
288
284
|
if (typeof arg == "number") {
|
|
@@ -307,7 +303,7 @@ class DiscordApp {
|
|
|
307
303
|
if (!getMethod)
|
|
308
304
|
throw new TypeError(`Failed to get the select menu values for custom ID ${fieldIndex.customId}. Failed to gather necessary metadata.`);
|
|
309
305
|
const result = getMethod.bind(itr.fields)(fieldIndex.customId);
|
|
310
|
-
if (result instanceof
|
|
306
|
+
if (result instanceof Collection)
|
|
311
307
|
args[arg.index] = result.toJSON();
|
|
312
308
|
else
|
|
313
309
|
args[arg.index] = result;
|
|
@@ -327,10 +323,11 @@ class DiscordApp {
|
|
|
327
323
|
}
|
|
328
324
|
}
|
|
329
325
|
});
|
|
330
|
-
if (runMethod == undefined)
|
|
331
|
-
throw new TypeError("Failed to get the run method. Did you add the @Run decorator?");
|
|
326
|
+
// if (runMethod == undefined) throw new TypeError("Failed to get the run method. Did you add the @Run decorator?");
|
|
332
327
|
let cmd = new modal(...args);
|
|
333
|
-
|
|
328
|
+
if (runMethod) {
|
|
329
|
+
cmd[runMethod]();
|
|
330
|
+
}
|
|
334
331
|
}
|
|
335
332
|
/**
|
|
336
333
|
* Automatically handles incoming interactions by determining their type (chat input command, context menu command, button interaction, select menu interaction, or modal submit) and routing them to the appropriate handler method. This method is called internally whenever an interaction is created.
|
|
@@ -361,52 +358,63 @@ class DiscordApp {
|
|
|
361
358
|
* @internal
|
|
362
359
|
*/
|
|
363
360
|
#init() {
|
|
364
|
-
const options = Reflect.getMetadata(
|
|
365
|
-
const internalEvents = Reflect.getMetadata(
|
|
361
|
+
const options = Reflect.getMetadata(DICSORD_MODULE_OPTIONS_KEY, this.#moduleFunction);
|
|
362
|
+
const internalEvents = Reflect.getMetadata(INTERNAL_EVENTS_KEY, this.#moduleFunction);
|
|
366
363
|
// const externalEvents = Reflect.getMetadata(DISCORD_MODULE_EXTERNAL_EVENTS_KEY, this.#moduleFunction) as ExternalModuleEvents[];
|
|
367
|
-
this.#client = new
|
|
364
|
+
this.#client = new Client(options);
|
|
368
365
|
this.#module = new this.#moduleFunction(this.#client, this.#appOptions.logger);
|
|
369
366
|
this.#moduleOptions = options;
|
|
367
|
+
this.#commands = [];
|
|
368
|
+
this.#buttons = [];
|
|
369
|
+
this.#selectMenus = [];
|
|
370
|
+
this.#modals = [];
|
|
370
371
|
const module = this.#module;
|
|
371
372
|
internalEvents.forEach(e => {
|
|
372
373
|
this.#client.on(e.eventName, (...args) => module[e.methodName](...args));
|
|
373
374
|
});
|
|
374
375
|
this.#client.on("interactionCreate", (itr) => this.#autoHandler(itr));
|
|
375
376
|
this.#moduleOptions.imports.forEach(module => {
|
|
376
|
-
const moduleType = Reflect.getMetadata(
|
|
377
|
+
const moduleType = Reflect.getMetadata(MODULE_TYPE_KEY, module);
|
|
377
378
|
switch (moduleType) {
|
|
378
|
-
case
|
|
379
|
-
|
|
380
|
-
this.#commands = [];
|
|
381
|
-
this.#commands.push(...Reflect.getMetadata(Constants_1.COMMAND_MODULE_COMMANDS_KEY, module));
|
|
379
|
+
case ModuleType.COMMAND:
|
|
380
|
+
this.#commands.push(...Reflect.getMetadata(COMMAND_MODULE_COMMANDS_KEY, module));
|
|
382
381
|
break;
|
|
383
|
-
case
|
|
384
|
-
const components = Reflect.getMetadata(
|
|
385
|
-
const buttons = components.filter(c => Reflect.getMetadata(
|
|
386
|
-
const selectMenus = components.filter(c => Reflect.getMetadata(
|
|
387
|
-
const modals = components.filter(c => Reflect.getMetadata(
|
|
388
|
-
if (!this.#buttons)
|
|
389
|
-
this.#buttons = [];
|
|
382
|
+
case ModuleType.MESSAGE_COMPONENT:
|
|
383
|
+
const components = Reflect.getMetadata(MESSAGE_COMPONENT_MODULE_COMPONENTS_KEY, module);
|
|
384
|
+
const buttons = components.filter(c => Reflect.getMetadata(INTERACTION_TYPE_KEY, c) == InteractionType.BUTTON);
|
|
385
|
+
const selectMenus = components.filter(c => Reflect.getMetadata(INTERACTION_TYPE_KEY, c) == InteractionType.SELECT_MENU);
|
|
386
|
+
const modals = components.filter(c => Reflect.getMetadata(INTERACTION_TYPE_KEY, c) == InteractionType.MODAL_SUBMIT);
|
|
390
387
|
this.#buttons.push(...buttons);
|
|
391
|
-
if (!this.#selectMenus)
|
|
392
|
-
this.#selectMenus = [];
|
|
393
388
|
this.#selectMenus.push(...selectMenus);
|
|
394
|
-
if (!this.#modals)
|
|
395
|
-
this.#modals = [];
|
|
396
389
|
this.#modals.push(...modals);
|
|
397
390
|
break;
|
|
391
|
+
case ModuleType.EVENT:
|
|
392
|
+
const moduleEvents = (Reflect.getMetadata(INTERNAL_EVENTS_KEY, module) ?? []);
|
|
393
|
+
moduleEvents.forEach(e => {
|
|
394
|
+
const moduleInstance = new module(this.#client, this.#appOptions.logger);
|
|
395
|
+
this.#client.on(e.eventName, (...args) => moduleInstance[e.methodName](...args));
|
|
396
|
+
});
|
|
397
|
+
const listeners = (Reflect.getMetadata(EVENT_MODULE_LISTENERS_KEY, module) ?? []);
|
|
398
|
+
listeners.forEach(listener => {
|
|
399
|
+
const listenerInstance = new listener(this.#client, this.#appOptions.logger);
|
|
400
|
+
const listenerEvents = (Reflect.getMetadata(INTERNAL_EVENTS_KEY, listener) ?? []);
|
|
401
|
+
listenerEvents.forEach(e => {
|
|
402
|
+
this.#client.on(e.eventName, (...args) => listenerInstance[e.methodName](...args));
|
|
403
|
+
});
|
|
404
|
+
});
|
|
398
405
|
}
|
|
406
|
+
;
|
|
399
407
|
});
|
|
400
408
|
}
|
|
401
409
|
#setModule(discordModule) {
|
|
402
410
|
this.#moduleFunction = discordModule;
|
|
403
411
|
}
|
|
404
412
|
#setOptions(options) {
|
|
405
|
-
this.#appOptions =
|
|
413
|
+
this.#appOptions = Util.mergeDefault(defaultDiscordAppOptions, options);
|
|
406
414
|
}
|
|
407
415
|
#mapSlashCommand(name, description, options = [], integrationTypes = []) {
|
|
408
416
|
const requiredOptions = options.filter(o => o.required);
|
|
409
|
-
const data = new
|
|
417
|
+
const data = new SlashCommandBuilder()
|
|
410
418
|
.setName(name)
|
|
411
419
|
.setDescription(description);
|
|
412
420
|
if (integrationTypes.length > 0)
|
|
@@ -416,7 +424,7 @@ class DiscordApp {
|
|
|
416
424
|
return data.toJSON();
|
|
417
425
|
}
|
|
418
426
|
#mapContextMenuCommand(name, type, integrationTypes = []) {
|
|
419
|
-
const data = new
|
|
427
|
+
const data = new ContextMenuCommandBuilder()
|
|
420
428
|
.setName(name)
|
|
421
429
|
.setType(type);
|
|
422
430
|
if (integrationTypes.length > 0)
|
|
@@ -451,4 +459,3 @@ class DiscordApp {
|
|
|
451
459
|
return app;
|
|
452
460
|
}
|
|
453
461
|
}
|
|
454
|
-
exports.DiscordApp = DiscordApp;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const discord_js_1 = require("discord.js");
|
|
5
|
-
const __1 = require("..");
|
|
6
|
-
const Util_1 = require("../../utils/Util");
|
|
1
|
+
import { ButtonBuilder, ButtonStyle } from "discord.js";
|
|
2
|
+
import { BUTTON_OPTIONS_KEY } from "..";
|
|
3
|
+
import { Util } from "../../utils/Util";
|
|
7
4
|
/**
|
|
8
5
|
* The base class for buttons created with the {@link Button} decorator. This class is used to create a button from the options defined in the class, and to override the default options with new options when creating the button.
|
|
9
6
|
*
|
|
@@ -29,21 +26,21 @@ const Util_1 = require("../../utils/Util");
|
|
|
29
26
|
* }
|
|
30
27
|
* ```
|
|
31
28
|
*/
|
|
32
|
-
class BaseButton {
|
|
29
|
+
export class BaseButton {
|
|
33
30
|
static options;
|
|
34
31
|
static button = null;
|
|
35
32
|
/** Returns {@link ButtonBuilder} that was created from the button options. */
|
|
36
33
|
static getButton() {
|
|
37
34
|
if (this.button)
|
|
38
35
|
return this.button;
|
|
39
|
-
const options = Reflect.getMetadata(
|
|
36
|
+
const options = Reflect.getMetadata(BUTTON_OPTIONS_KEY, this);
|
|
40
37
|
if (!options)
|
|
41
38
|
throw new TypeError("Failed to get the button.");
|
|
42
39
|
this.options = options;
|
|
43
40
|
const button = create(options);
|
|
44
41
|
this.button = button;
|
|
45
42
|
// Return a copy of the button to prevent accidental mutations to the original button stored in the class.
|
|
46
|
-
return
|
|
43
|
+
return ButtonBuilder.from(button.toJSON());
|
|
47
44
|
}
|
|
48
45
|
/**
|
|
49
46
|
* Returns a new {@link ButtonBuilder} with the specified options merged with the default options defined in the class.
|
|
@@ -51,23 +48,22 @@ class BaseButton {
|
|
|
51
48
|
* @param options The options to merge with the default options.
|
|
52
49
|
*/
|
|
53
50
|
static override(options) {
|
|
54
|
-
const currentOptions = this.options ?? Reflect.getMetadata(
|
|
51
|
+
const currentOptions = this.options ?? Reflect.getMetadata(BUTTON_OPTIONS_KEY, this);
|
|
55
52
|
if (!currentOptions)
|
|
56
53
|
throw new TypeError("Failed to get the button options.");
|
|
57
|
-
const newOptions =
|
|
54
|
+
const newOptions = Util.mergeDefault(currentOptions, options);
|
|
58
55
|
return create(newOptions);
|
|
59
56
|
}
|
|
60
57
|
}
|
|
61
|
-
exports.BaseButton = BaseButton;
|
|
62
58
|
function create(options) {
|
|
63
|
-
const button = new
|
|
64
|
-
if (options.style ==
|
|
59
|
+
const button = new ButtonBuilder();
|
|
60
|
+
if (options.style == ButtonStyle.Premium) {
|
|
65
61
|
button
|
|
66
62
|
.setStyle(options.style)
|
|
67
63
|
.setSKUId(options.skuId);
|
|
68
64
|
return button;
|
|
69
65
|
}
|
|
70
|
-
if (options.style ==
|
|
66
|
+
if (options.style == ButtonStyle.Link) {
|
|
71
67
|
button
|
|
72
68
|
.setStyle(options.style)
|
|
73
69
|
.setURL(options.url);
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.BaseModal = void 0;
|
|
7
|
-
const discord_js_1 = require("discord.js");
|
|
8
|
-
const __1 = require("..");
|
|
9
|
-
const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
10
|
-
const Util_1 = require("../../utils/Util");
|
|
1
|
+
import { CheckboxBuilder, CheckboxGroupBuilder, LabelBuilder, ModalBuilder, RadioGroupBuilder, StringSelectMenuBuilder, TextDisplayBuilder, TextInputBuilder } from "discord.js";
|
|
2
|
+
import { MODAL_COMPONENTS_KEY, MODAL_OPTIONS_KEY } from "..";
|
|
3
|
+
import crypto from "node:crypto";
|
|
4
|
+
import { Util } from "../../utils/Util";
|
|
11
5
|
/**
|
|
12
6
|
* The base class for modals created with the {@link Modal} decorator. This class is used to create a modal from the options and components defined in the class, and to override the default options and component values with new options and values when creating the modal.
|
|
13
7
|
*
|
|
@@ -37,16 +31,16 @@ const Util_1 = require("../../utils/Util");
|
|
|
37
31
|
* }
|
|
38
32
|
* ```
|
|
39
33
|
*/
|
|
40
|
-
class BaseModal {
|
|
34
|
+
export class BaseModal {
|
|
41
35
|
static modal = null;
|
|
42
36
|
static options;
|
|
43
37
|
static components = [];
|
|
44
38
|
/** Returns a new {@link ModalBuilder} that was created from the modal options and components. */
|
|
45
39
|
static getModal() {
|
|
46
40
|
if (this.modal)
|
|
47
|
-
return
|
|
48
|
-
const options = Reflect.getMetadata(
|
|
49
|
-
const components = Reflect.getMetadata(
|
|
41
|
+
return ModalBuilder.from(this.modal.toJSON());
|
|
42
|
+
const options = Reflect.getMetadata(MODAL_OPTIONS_KEY, this);
|
|
43
|
+
const components = Reflect.getMetadata(MODAL_COMPONENTS_KEY, this) ?? [];
|
|
50
44
|
if (!options || !components)
|
|
51
45
|
throw new TypeError("Failed to get the modal.");
|
|
52
46
|
// Reverse the components because they are added to the modal in reverse order due to the way the decorators work.
|
|
@@ -54,7 +48,7 @@ class BaseModal {
|
|
|
54
48
|
this.options = options;
|
|
55
49
|
this.components = [...reversedComponents];
|
|
56
50
|
this.modal = create(options, reversedComponents.map(c => c.component));
|
|
57
|
-
return
|
|
51
|
+
return ModalBuilder.from(this.modal.toJSON());
|
|
58
52
|
}
|
|
59
53
|
/**
|
|
60
54
|
* Returns a new {@link ModalBuilder} with the specified options and component values merged with the default options and components defined in the class.
|
|
@@ -63,15 +57,15 @@ class BaseModal {
|
|
|
63
57
|
* @param values The component values to merge with the default components. The `customId` property is used to match the values with the correct components, and the `type` property is used to determine which type of component the value is for.
|
|
64
58
|
*/
|
|
65
59
|
static override(options = {}, ...values) {
|
|
66
|
-
const currentOptions = this.options ?? Reflect.getMetadata(
|
|
67
|
-
const currentComponents = this.components.length > 0 ? this.components : Reflect.getMetadata(
|
|
60
|
+
const currentOptions = this.options ?? Reflect.getMetadata(MODAL_OPTIONS_KEY, this);
|
|
61
|
+
const currentComponents = this.components.length > 0 ? this.components : Reflect.getMetadata(MODAL_COMPONENTS_KEY, this)?.reverse();
|
|
68
62
|
if (!currentOptions)
|
|
69
63
|
throw new TypeError("Failed to get the modal options.");
|
|
70
|
-
const newOptions =
|
|
64
|
+
const newOptions = Util.mergeDefault(currentOptions, options);
|
|
71
65
|
const newComponents = currentComponents.map(c => {
|
|
72
66
|
const { customId, component } = c;
|
|
73
|
-
if (component instanceof
|
|
74
|
-
const updatedComponent = new
|
|
67
|
+
if (component instanceof LabelBuilder) {
|
|
68
|
+
const updatedComponent = new LabelBuilder(component.toJSON());
|
|
75
69
|
const matchingLabelValue = values.find(v => v.customId === customId && v.type === 'label');
|
|
76
70
|
if (matchingLabelValue) {
|
|
77
71
|
if (matchingLabelValue.label)
|
|
@@ -79,38 +73,38 @@ class BaseModal {
|
|
|
79
73
|
if (matchingLabelValue.description)
|
|
80
74
|
updatedComponent.setDescription(matchingLabelValue.description);
|
|
81
75
|
}
|
|
82
|
-
if (component.data.component instanceof
|
|
76
|
+
if (component.data.component instanceof TextInputBuilder) {
|
|
83
77
|
const matchingTextInputValue = values.find(v => v.customId === component.data.component.data.custom_id && v.type === 'text_input');
|
|
84
78
|
if (matchingTextInputValue) {
|
|
85
79
|
if ("value" in component.data.component.data) {
|
|
86
|
-
const updatedTextInput =
|
|
80
|
+
const updatedTextInput = TextInputBuilder.from(component.data.component.toJSON());
|
|
87
81
|
updatedTextInput.setValue(matchingTextInputValue.value);
|
|
88
82
|
updatedComponent.setTextInputComponent(updatedTextInput);
|
|
89
83
|
}
|
|
90
84
|
}
|
|
91
85
|
}
|
|
92
|
-
else if (component.data.component instanceof
|
|
86
|
+
else if (component.data.component instanceof StringSelectMenuBuilder) {
|
|
93
87
|
const matchingStringSelectValue = values.find(v => v.customId === component.data.component.data.custom_id && v.type === 'string_select');
|
|
94
88
|
if (matchingStringSelectValue) {
|
|
95
|
-
const updatedComponent =
|
|
89
|
+
const updatedComponent = StringSelectMenuBuilder.from(component.data.component.toJSON());
|
|
96
90
|
updatedComponent.setOptions(matchingStringSelectValue.options);
|
|
97
91
|
component.setStringSelectMenuComponent(updatedComponent);
|
|
98
92
|
}
|
|
99
93
|
}
|
|
100
|
-
else if (component.data.component instanceof
|
|
94
|
+
else if (component.data.component instanceof RadioGroupBuilder) {
|
|
101
95
|
const matchingRadioGroupValue = values.find(v => v.customId === component.data.component.data.custom_id && v.type === 'radio_group');
|
|
102
96
|
if (matchingRadioGroupValue) {
|
|
103
|
-
const updatedComponent = new
|
|
97
|
+
const updatedComponent = new RadioGroupBuilder(component.data.component.toJSON());
|
|
104
98
|
if ("required" in matchingRadioGroupValue)
|
|
105
99
|
updatedComponent.setRequired(matchingRadioGroupValue.required);
|
|
106
100
|
updatedComponent.setOptions(matchingRadioGroupValue.options);
|
|
107
101
|
component.setRadioGroupComponent(updatedComponent);
|
|
108
102
|
}
|
|
109
103
|
}
|
|
110
|
-
else if (component.data.component instanceof
|
|
104
|
+
else if (component.data.component instanceof CheckboxGroupBuilder) {
|
|
111
105
|
const matchingCheckboxGroupValue = values.find(v => v.customId === component.data.component.data.custom_id && v.type === 'checkbox_group');
|
|
112
106
|
if (matchingCheckboxGroupValue) {
|
|
113
|
-
const updatedComponent = new
|
|
107
|
+
const updatedComponent = new CheckboxGroupBuilder(component.data.component.toJSON());
|
|
114
108
|
if (typeof matchingCheckboxGroupValue.minValues == "number")
|
|
115
109
|
updatedComponent.setMinValues(matchingCheckboxGroupValue.minValues);
|
|
116
110
|
if (typeof matchingCheckboxGroupValue.maxValues == "number")
|
|
@@ -121,10 +115,10 @@ class BaseModal {
|
|
|
121
115
|
component.setCheckboxGroupComponent(updatedComponent);
|
|
122
116
|
}
|
|
123
117
|
}
|
|
124
|
-
else if (component.data.component instanceof
|
|
118
|
+
else if (component.data.component instanceof CheckboxBuilder) {
|
|
125
119
|
const matchingCheckboxValue = values.find(v => v.customId === component.data.component.data.custom_id && v.type === 'checkbox');
|
|
126
120
|
if (matchingCheckboxValue) {
|
|
127
|
-
const updatedComponent = new
|
|
121
|
+
const updatedComponent = new CheckboxBuilder(component.data.component.toJSON());
|
|
128
122
|
if ("default" in matchingCheckboxValue)
|
|
129
123
|
updatedComponent.setDefault(matchingCheckboxValue.default);
|
|
130
124
|
component.setCheckboxComponent(updatedComponent);
|
|
@@ -132,8 +126,8 @@ class BaseModal {
|
|
|
132
126
|
}
|
|
133
127
|
return { customId, component: updatedComponent };
|
|
134
128
|
}
|
|
135
|
-
else if (component instanceof
|
|
136
|
-
const updatedComponent = new
|
|
129
|
+
else if (component instanceof TextDisplayBuilder) {
|
|
130
|
+
const updatedComponent = new TextDisplayBuilder(component.toJSON());
|
|
137
131
|
const matchingTextDisplayValue = values.find(v => v.customId === customId && v.type === 'text_display');
|
|
138
132
|
if (matchingTextDisplayValue) {
|
|
139
133
|
updatedComponent.setContent(matchingTextDisplayValue.content);
|
|
@@ -154,7 +148,7 @@ class BaseModal {
|
|
|
154
148
|
return new Promise((r, j) => {
|
|
155
149
|
if (itr.replied || itr.deferred)
|
|
156
150
|
return j("Interaction already replied.");
|
|
157
|
-
const id =
|
|
151
|
+
const id = crypto.createHash("md5")
|
|
158
152
|
.update(Math.floor(Math.random() * (99999999 - 10000000) + 10000000).toString())
|
|
159
153
|
.digest("hex");
|
|
160
154
|
itr.showModal(this.getModal().setCustomId(id));
|
|
@@ -173,9 +167,8 @@ class BaseModal {
|
|
|
173
167
|
});
|
|
174
168
|
}
|
|
175
169
|
}
|
|
176
|
-
exports.BaseModal = BaseModal;
|
|
177
170
|
function create(options, components) {
|
|
178
|
-
const modal = new
|
|
171
|
+
const modal = new ModalBuilder()
|
|
179
172
|
.setTitle(options.title)
|
|
180
173
|
.setCustomId(options.customId);
|
|
181
174
|
modal.components.push(...components);
|