js-discord-modularcommand 1.0.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Vicente
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,256 @@
1
+ /**
2
+ * @module ModularCommand
3
+ * @description A module for creating and managing modular commands in a easy way for me.
4
+ * @license MIT
5
+ */
6
+ /**
7
+ * Imports
8
+ */
9
+ import { ApplicationCommandOptionType, MessageComponentInteraction, ChatInputCommandInteraction, ModalSubmitInteraction, SlashCommandBuilder, TextInputBuilder, ButtonBuilder, ModalBuilder, Locale, Message, ButtonStyle, Channel, User, Role, GuildMember, LocalizationMap, APIApplicationCommandOptionChoice, TextInputStyle } from 'discord.js';
10
+ /**
11
+ * Localization Phrases
12
+ */
13
+ /**
14
+ * @description Localization phrases for various commands.
15
+ * @example
16
+ * const example = LOCALE_FORBIDDEN[Locale.EnglishUS];
17
+ * console.log(example); // 'You do not have permission to use this command.'
18
+ */
19
+ declare const LOCALE_FORBIDDEN: Record<Locale, string>;
20
+ /**
21
+ * @description Localization phrases for NSFW commands.
22
+ * @example
23
+ * const example = LOCALE_NSFW[Locale.EnglishUS];
24
+ * console.log(example); // 'This command can only be used in NSFW channels.'
25
+ */
26
+ declare const LOCALE_NSFW: Record<Locale, string>;
27
+ /**
28
+ * @description Localization phrases for delay commands.
29
+ * @example
30
+ * const example = LOCALE_DELAY[Locale.EnglishUS];
31
+ * const secondsPluralRegEx = new RegExp('{plural\\|([^}]+)}', 'g');
32
+ * const seconds = 5;
33
+ * const formattedPhrase = example
34
+ * .replace('{seconds}', seconds.toString())
35
+ * .replace(secondsPluralRegEx, seconds === 1 ? '' : '$1');
36
+ *
37
+ * console.log(formattedPhrase); // 'You must wait 5 seconds before using this command again.'
38
+ */
39
+ declare const LOCALE_DELAY: Record<Locale, string>;
40
+ declare const LOCALE_ERROR: Record<Locale, string>;
41
+ /**
42
+ * Types
43
+ */
44
+ type ArgType = string | number | boolean | User | Channel | Role | GuildMember;
45
+ type ExecuteFunction<T extends ChatInputCommandInteraction | MessageComponentInteraction> = (params: {
46
+ interaction: T;
47
+ args?: Record<string, ArgType>;
48
+ command: ModularCommand;
49
+ locale: Record<string, any>;
50
+ }) => Promise<void>;
51
+ type ButtonExecuteFunction = (params: {
52
+ interaction: MessageComponentInteraction;
53
+ command: ModularCommand;
54
+ locale: Record<string, any>;
55
+ message: Message;
56
+ }) => Promise<void>;
57
+ type ModalExecuteFunction = (params: {
58
+ interaction: ModalSubmitInteraction;
59
+ args: Record<string, string>;
60
+ command: ModularCommand;
61
+ locale: Record<string, any>;
62
+ }) => Promise<void>;
63
+ type PermissionCheckFunction = (interaction: ChatInputCommandInteraction) => boolean;
64
+ /**
65
+ * Interface
66
+ */
67
+ interface ModularCommandOptions {
68
+ name: string;
69
+ description?: string;
70
+ execute?: ExecuteFunction<ChatInputCommandInteraction>;
71
+ componentExecute?: ExecuteFunction<MessageComponentInteraction>;
72
+ modalExecute?: ModalExecuteFunction;
73
+ }
74
+ interface CommandOption {
75
+ name: string;
76
+ type: ApplicationCommandOptionType;
77
+ description: Record<Locale, string> | string;
78
+ required?: boolean;
79
+ choices?: APIApplicationCommandOptionChoice[];
80
+ }
81
+ interface RegisteredCommand {
82
+ data: SlashCommandBuilder;
83
+ execute: (interaction: ChatInputCommandInteraction) => Promise<void>;
84
+ componentExecute?: (interaction: MessageComponentInteraction) => Promise<void>;
85
+ modalExecute?: (interaction: ModalSubmitInteraction) => Promise<void>;
86
+ buttonExecute?: (interaction: MessageComponentInteraction) => Promise<void>;
87
+ cooldown: number;
88
+ }
89
+ /**
90
+ * @class ModularButton
91
+ * @description Represents a modular button that can be registered with Discord.js.
92
+ * It allows for dynamic button creation and execution.
93
+ */
94
+ declare class ModularButton {
95
+ buttonObject: ButtonBuilder;
96
+ customId: string;
97
+ style: ButtonStyle;
98
+ execute: ButtonExecuteFunction;
99
+ /**
100
+ * Creates a new button for the command.
101
+ * @param {string} customId The custom ID for the button.
102
+ * @param {ButtonStyle} style The style of the button.
103
+ */
104
+ constructor(customId: string, style: ButtonStyle);
105
+ /**
106
+ * Sets the execute function for the button.
107
+ * @param {ButtonExecuteFunction} executeFunction The function to execute.
108
+ * @return {ModularButton} The button instance for chaining.
109
+ */
110
+ setExecute(executeFunction: ButtonExecuteFunction): this;
111
+ }
112
+ /**
113
+ * @class ModularModal
114
+ * @description Represents a modular modal that can be registered with Discord.js.
115
+ * It allows for dynamic modal creation and execution.
116
+ */
117
+ declare class ModularModal {
118
+ modalObject: ModalBuilder;
119
+ modalId: string;
120
+ modalInputs: Map<string, TextInputBuilder>;
121
+ command: ModularCommand;
122
+ execute: ModalExecuteFunction;
123
+ /**
124
+ * Creates a new modal for the command.
125
+ * @param {string} modalId The ID for the modal.
126
+ * @param {ModularCommand} command The command that this modal belongs to.
127
+ */
128
+ constructor(modalId: string, command: ModularCommand);
129
+ /**
130
+ * Sets the execute function for the modal.
131
+ * @param {ModalExecuteFunction} executeFunction The function to execute.
132
+ * @returns {ModularModal} The modal instance for chaining.
133
+ */
134
+ setExecute(executeFunction: ModalExecuteFunction): this;
135
+ /**
136
+ * Creates a new text input for the modal.
137
+ * @param {string} id The ID for the text input.
138
+ * @param {TextInputStyle} style The style of the text input.
139
+ * @returns {TextInputBuilder} The created text input instance.
140
+ */
141
+ newTextInput(id: string, style: TextInputStyle): TextInputBuilder;
142
+ /**
143
+ * Builds the modal object.
144
+ * @param {Record<string, any>} locale The localization object for the modal.
145
+ * @return {ModalBuilder} The built modal object.
146
+ */
147
+ build(locale: Record<string, any>): ModalBuilder;
148
+ }
149
+ /**
150
+ * @class ModularCommand
151
+ * @description Represents a modular command that can be registered with Discord.js.
152
+ * It allows for dynamic command creation and execution.
153
+ */
154
+ declare class ModularCommand {
155
+ name: string;
156
+ description: string;
157
+ execute: ExecuteFunction<ChatInputCommandInteraction>;
158
+ componentExecute?: ExecuteFunction<MessageComponentInteraction>;
159
+ modalExecute?: ModalExecuteFunction;
160
+ options: CommandOption[];
161
+ optionsLocalizations: Record<string, Record<Locale, string>>;
162
+ customIdHandlers: Record<string, ExecuteFunction<ChatInputCommandInteraction>>;
163
+ cooldown: number;
164
+ modals: Map<string, ModularModal>;
165
+ buttons: Map<string, ModularButton>;
166
+ buttonsArray: ModularButton[];
167
+ isNSFW: boolean;
168
+ descriptionLocalizations?: LocalizationMap;
169
+ localizationPhrases?: Record<Locale, any>;
170
+ permissionCheck?: PermissionCheckFunction;
171
+ componentId?: string;
172
+ constructor({ name, description, execute, componentExecute, modalExecute }: ModularCommandOptions);
173
+ /**
174
+ * Sets the description of the command.
175
+ * @param {string} description The description.
176
+ * @returns {ModularCommand} The command instance for chaining.
177
+ */
178
+ setDescription(description: string): this;
179
+ /**
180
+ * Sets the description localizations for the command.
181
+ * @param {LocalizationMap} localizations The description localizations.
182
+ * @returns {ModularCommand} The command instance for chaining.
183
+ */
184
+ setLocalizationsDescription(localizations: LocalizationMap): this;
185
+ setLocalizationOptions(localizations: Record<string, Record<Locale, string>>): this;
186
+ /**
187
+ * Sets the localization phrases for the command.
188
+ * @param {Record<Locale, any>} localizationPhrases The localization phrases.
189
+ * @returns {ModularCommand} The command instance for chaining.
190
+ */
191
+ setLocalizationPhrases(localizationPhrases: Record<Locale, any>): this;
192
+ /**
193
+ * Sets the execute function for the command.
194
+ * @param {ExecuteFunction<CommandInteraction>} executeFunction The function to execute.
195
+ * @returns {ModularCommand} The command instance for chaining.
196
+ */
197
+ setExecute(executeFunction: ExecuteFunction<ChatInputCommandInteraction>): this;
198
+ /**
199
+ * Sets the component execute function for the command.
200
+ * @param {string} componentId The base ID for the components.
201
+ * @param {ExecuteFunction<MessageComponentInteraction>} executeFunction The function to execute for component interactions.
202
+ * @returns {ModularCommand} The command instance for chaining.
203
+ */
204
+ setComponentExecute(componentId: string, executeFunction: ExecuteFunction<MessageComponentInteraction>): this;
205
+ /**
206
+ * Creates a new modal for the command.
207
+ * @param {string} modalId The ID for the modal.
208
+ * @returns {ModularModal} The created modal instance.
209
+ */
210
+ newModal(modalId: string): ModularModal;
211
+ /**
212
+ * Creates a new button for the command.
213
+ * @param {string} customId The custom ID for the button.
214
+ * @param {ButtonStyle} style The style of the button.
215
+ * @return {ModularButton} The created button instance.
216
+ */
217
+ newButton(customId: string, style: ButtonStyle): ModularButton;
218
+ /**
219
+ * Set the minimun permissions required to execute the command.
220
+ * @param {PermissionCheckFunction} permissionCheckFunction The function to check permissions.
221
+ * @returns {ModularCommand} The command instance for chaining.
222
+ */
223
+ setPermissionCheck(permissionCheckFunction: PermissionCheckFunction): this;
224
+ /**
225
+ * Sets the cooldown for the command.
226
+ * @param {number} cooldown The cooldown in seconds.
227
+ * @returns {ModularCommand} The command instance for chaining.
228
+ */
229
+ setCooldown(cooldown: number): this;
230
+ /**
231
+ * Gets the component ID for the command.
232
+ * @returns {string | undefined} The component ID.
233
+ */
234
+ getComponentId(): string | undefined;
235
+ /**
236
+ * Adds an option to the command.
237
+ * @param {CommandOption} option The option for the command option.
238
+ * @returns {ModularCommand} The command instance for chaining.
239
+ */
240
+ addOption(option: CommandOption): this;
241
+ /**
242
+ * Adds a custom ID handler for the command.
243
+ * @param {string} customId The custom ID to match.
244
+ * @param {ExecuteFunction<CommandInteraction<CacheType>>} handlerFunction The function to execute when the custom ID matches.
245
+ * @returns {ModularCommand} The command instance for chaining.
246
+ */
247
+ addCustomIDHandler(customId: string, handlerFunction: ExecuteFunction<ChatInputCommandInteraction>): this;
248
+ }
249
+ /**
250
+ * Registers an array of modular commands.
251
+ * @param {ModularCommand[]} commands An array of ModularCommand instances.
252
+ * @returns {RegisteredCommand[]} An array of command data objects ready for Discord.js client.
253
+ */
254
+ declare const RegisterCommand: (commands: ModularCommand[]) => RegisteredCommand[];
255
+ export default ModularCommand;
256
+ export { RegisterCommand, ModularCommand, ModularButton, ModularModal, LOCALE_FORBIDDEN, LOCALE_DELAY, LOCALE_NSFW, LOCALE_ERROR, };
@@ -0,0 +1,602 @@
1
+ "use strict";
2
+ /**
3
+ * @module ModularCommand
4
+ * @description A module for creating and managing modular commands in a easy way for me.
5
+ * @license MIT
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.LOCALE_ERROR = exports.LOCALE_NSFW = exports.LOCALE_DELAY = exports.LOCALE_FORBIDDEN = exports.ModularModal = exports.ModularButton = exports.ModularCommand = exports.RegisterCommand = void 0;
9
+ /**
10
+ * Imports
11
+ */
12
+ const discord_js_1 = require("discord.js");
13
+ /**
14
+ * Localization Phrases
15
+ */
16
+ /**
17
+ * @description Localization phrases for various commands.
18
+ * @example
19
+ * const example = LOCALE_FORBIDDEN[Locale.EnglishUS];
20
+ * console.log(example); // 'You do not have permission to use this command.'
21
+ */
22
+ const LOCALE_FORBIDDEN = {
23
+ [discord_js_1.Locale.SpanishLATAM]: 'No tienes permiso para usar este comando.',
24
+ [discord_js_1.Locale.EnglishUS]: 'You do not have permission to use this command.',
25
+ [discord_js_1.Locale.EnglishGB]: 'I say, it appears you lack the proper authorisation to utilise this command, old bean.',
26
+ [discord_js_1.Locale.SpanishES]: 'Ostias chaval, tio parece que no vais a poder usar este comando madre mia willy, que barbaridad.',
27
+ [discord_js_1.Locale.PortugueseBR]: 'Você não tem permissão para usar este comando.',
28
+ [discord_js_1.Locale.French]: 'Vous n\'avez pas la permission d\'utiliser cette commande.',
29
+ [discord_js_1.Locale.German]: 'Du hast keine Berechtigung, diesen Befehl zu verwenden.',
30
+ [discord_js_1.Locale.Italian]: 'Non hai il permesso di usare questo comando.',
31
+ [discord_js_1.Locale.Russian]: 'У вас нет разрешения на использование этой команды.',
32
+ [discord_js_1.Locale.ChineseCN]: '您没有权限使用此命令。',
33
+ [discord_js_1.Locale.ChineseTW]: '您沒有權限使用此命令。',
34
+ [discord_js_1.Locale.Japanese]: 'このコマンドを使用する権限がありません。',
35
+ [discord_js_1.Locale.Korean]: '이 명령을 사용할 권한이 없습니다.',
36
+ [discord_js_1.Locale.Bulgarian]: 'Нямате разрешение да използвате тази команда.',
37
+ [discord_js_1.Locale.Czech]: 'Nemáte oprávnění k použití tohoto příkazu.',
38
+ [discord_js_1.Locale.Danish]: 'Du har ikke tilladelse til at bruge denne kommando.',
39
+ [discord_js_1.Locale.Dutch]: 'Je hebt geen toestemming om deze opdracht te gebruiken.',
40
+ [discord_js_1.Locale.Finnish]: 'Sinulla ei ole lupaa käyttää tätä komentoa.',
41
+ [discord_js_1.Locale.Hungarian]: 'Nincs jogosultságod ehhez a parancshoz.',
42
+ [discord_js_1.Locale.Norwegian]: 'Du har ikke tillatelse til å bruke denne kommandoen.',
43
+ [discord_js_1.Locale.Polish]: 'Nie masz uprawnień do używania tej komendy.',
44
+ [discord_js_1.Locale.Romanian]: 'Nu ai permisiunea de a folosi acest comandă.',
45
+ [discord_js_1.Locale.Swedish]: 'Du har inte behörighet att använda det här kommandot.',
46
+ [discord_js_1.Locale.Turkish]: 'Bu komutu kullanma izniniz yok.',
47
+ [discord_js_1.Locale.Ukrainian]: 'У вас немає дозволу на використання цієї команди.',
48
+ [discord_js_1.Locale.Hindi]: 'आपको इस कमांड का उपयोग करने की अनुमति नहीं है।',
49
+ [discord_js_1.Locale.Indonesian]: 'Anda tidak memiliki izin untuk menggunakan perintah ini.',
50
+ [discord_js_1.Locale.Greek]: 'Δεν έχετε άδεια να χρησιμοποιήσετε αυτήν την εντολή.',
51
+ [discord_js_1.Locale.Croatian]: 'Nemate dopuštenje za korištenje ove naredbe.',
52
+ [discord_js_1.Locale.Lithuanian]: 'Jūs neturite teisės naudoti šio komandos.',
53
+ [discord_js_1.Locale.Thai]: 'คุณไม่มีสิทธิ์ใช้คำสั่งนี้.',
54
+ [discord_js_1.Locale.Vietnamese]: 'Bạn không có quyền sử dụng lệnh này.'
55
+ };
56
+ exports.LOCALE_FORBIDDEN = LOCALE_FORBIDDEN;
57
+ /**
58
+ * @description Localization phrases for NSFW commands.
59
+ * @example
60
+ * const example = LOCALE_NSFW[Locale.EnglishUS];
61
+ * console.log(example); // 'This command can only be used in NSFW channels.'
62
+ */
63
+ const LOCALE_NSFW = {
64
+ [discord_js_1.Locale.SpanishLATAM]: 'Este comando solo puede ser usado en canales NSFW.',
65
+ [discord_js_1.Locale.EnglishUS]: 'This command can only be used in NSFW channels.',
66
+ [discord_js_1.Locale.EnglishGB]: 'I do declare, this command is exclusively for channels of a... risqué nature. little bit of cheeky fun, eh?',
67
+ [discord_js_1.Locale.SpanishES]: '¡Ostias, chaval! Que este comando es solo para los canales más guarros, ¿vale? No me seas meapilas.',
68
+ [discord_js_1.Locale.PortugueseBR]: 'Este comando só pode ser usado em canais NSFW.',
69
+ [discord_js_1.Locale.French]: 'Cette commande ne peut être utilisée que dans les salons NSFW.',
70
+ [discord_js_1.Locale.German]: 'Dieser Befehl kann nur in NSFW-Kanälen verwendet werden.',
71
+ [discord_js_1.Locale.Italian]: 'Questo comando può essere utilizzato solo nei canali NSFW.',
72
+ [discord_js_1.Locale.Russian]: 'Эту команду можно использовать только в каналах NSFW.',
73
+ [discord_js_1.Locale.ChineseCN]: '此命令只能在NSFW频道中使用。',
74
+ [discord_js_1.Locale.ChineseTW]: '此命令只能在 NSFW 頻道中使用。',
75
+ [discord_js_1.Locale.Japanese]: 'このコマンドはNSFWチャンネルでのみ使用できます。',
76
+ [discord_js_1.Locale.Korean]: '이 명령어는 NSFW 채널에서만 사용할 수 있습니다.',
77
+ [discord_js_1.Locale.Bulgarian]: 'Тази команда може да се използва само в NSFW канали.',
78
+ [discord_js_1.Locale.Czech]: 'Tento příkaz lze použít pouze v kanálech NSFW.',
79
+ [discord_js_1.Locale.Danish]: 'Denne kommando kan kun bruges i NSFW-kanaler.',
80
+ [discord_js_1.Locale.Dutch]: 'Deze opdracht kan alleen worden gebruikt in NSFW-kanalen.',
81
+ [discord_js_1.Locale.Finnish]: 'Tätä komentoa voi käyttää vain NSFW-kanavilla.',
82
+ [discord_js_1.Locale.Hungarian]: 'Ez a parancs csak NSFW csatornákon használható.',
83
+ [discord_js_1.Locale.Norwegian]: 'Denne kommandoen kan bare brukes i NSFW-kanaler.',
84
+ [discord_js_1.Locale.Polish]: 'Ta komenda może być używana tylko na kanałach NSFW.',
85
+ [discord_js_1.Locale.Romanian]: 'Această comandă poate fi utilizată numai în canalele NSFW.',
86
+ [discord_js_1.Locale.Swedish]: 'Det här kommandot kan endast användas i NSFW-kanaler.',
87
+ [discord_js_1.Locale.Turkish]: 'Bu komut yalnızca NSFW kanallarında kullanılabilir.',
88
+ [discord_js_1.Locale.Ukrainian]: 'Цю команду можна використовувати лише в каналах NSFW.',
89
+ [discord_js_1.Locale.Hindi]: 'यह कमांड केवल NSFW चैनलों में ही उपयोग की जा सकती है।',
90
+ [discord_js_1.Locale.Indonesian]: 'Perintah ini hanya dapat digunakan di saluran NSFW.',
91
+ [discord_js_1.Locale.Greek]: 'Αυτή η εντολή μπορεί να χρησιμοποιηθεί μόνο σε κανάλια NSFW.',
92
+ [discord_js_1.Locale.Croatian]: 'Ova se naredba može koristiti samo u NSFW kanalima.',
93
+ [discord_js_1.Locale.Lithuanian]: 'Ši komanda gali būti naudojama tik NSFW kanaluose.',
94
+ [discord_js_1.Locale.Thai]: 'คำสั่งนี้สามารถใช้ได้เฉพาะในช่องทาง NSFW เท่านั้น.',
95
+ [discord_js_1.Locale.Vietnamese]: 'Lệnh này chỉ có thể được sử dụng trong các kênh NSFW.'
96
+ };
97
+ exports.LOCALE_NSFW = LOCALE_NSFW;
98
+ /**
99
+ * @description Localization phrases for delay commands.
100
+ * @example
101
+ * const example = LOCALE_DELAY[Locale.EnglishUS];
102
+ * const secondsPluralRegEx = new RegExp('{plural\\|([^}]+)}', 'g');
103
+ * const seconds = 5;
104
+ * const formattedPhrase = example
105
+ * .replace('{seconds}', seconds.toString())
106
+ * .replace(secondsPluralRegEx, seconds === 1 ? '' : '$1');
107
+ *
108
+ * console.log(formattedPhrase); // 'You must wait 5 seconds before using this command again.'
109
+ */
110
+ const LOCALE_DELAY = {
111
+ [discord_js_1.Locale.SpanishLATAM]: 'Debes esperar {seconds} segundo{plural|s} antes de utilizar este comando denuevo.',
112
+ [discord_js_1.Locale.EnglishUS]: 'You must wait {seconds} second{plural|s} before using this command again.',
113
+ [discord_js_1.Locale.EnglishGB]: 'I do declare, you must wait {seconds} second{plural|s} before using this command again.',
114
+ [discord_js_1.Locale.SpanishES]: '¡Ostias, chaval! Debes esperar {seconds} segundo{plural|s} antes de utilizar este comando denuevo.',
115
+ [discord_js_1.Locale.PortugueseBR]: 'Você deve esperar {seconds} segundo{plural|s} antes de usar este comando novamente.',
116
+ [discord_js_1.Locale.French]: 'Vous devez attendre {seconds} seconde{plural|s} avant d\'utiliser cette commande à nouveau.',
117
+ [discord_js_1.Locale.German]: 'Sie müssen {seconds} Sekunde{plural|n} warten, bevor Sie diesen Befehl erneut verwenden können.',
118
+ [discord_js_1.Locale.Italian]: 'Devi aspettare {seconds} secondo{plural|i} prima di utilizzare di nuovo questo comando.',
119
+ [discord_js_1.Locale.Russian]: 'Вы должны подождать {seconds} секунду{plural|ы} перед повторным использованием этой команды.',
120
+ [discord_js_1.Locale.ChineseCN]: '您必须等待 {seconds} 秒钟{plural|s}才能再次使用此命令。',
121
+ [discord_js_1.Locale.ChineseTW]: '您必須等待 {seconds} 秒鐘{plural|s}才能再次使用此命令。',
122
+ [discord_js_1.Locale.Japanese]: 'このコマンドを再度使用するには、{seconds} 秒待つ必要があります。',
123
+ [discord_js_1.Locale.Korean]: '이 명령어를 다시 사용하려면 {seconds} 초 기다려야 합니다.',
124
+ [discord_js_1.Locale.Bulgarian]: 'Трябва да изчакате {seconds} секунда{plural|и}, преди да използвате тази команда отново.',
125
+ [discord_js_1.Locale.Czech]: 'Musíte počkat {seconds} sekundu{plural|y}, než znovu použijete tento příkaz.',
126
+ [discord_js_1.Locale.Danish]: 'Du skal vente {seconds} sekund{plural|er} før du kan bruge denne kommando igen.',
127
+ [discord_js_1.Locale.Dutch]: 'Je moet {seconds} seconde{plural|n} wachten voordat je dit commando opnieuw kunt gebruiken.',
128
+ [discord_js_1.Locale.Finnish]: 'Sinun on odotettava {seconds} sekuntia ennen kuin voit käyttää tätä komentoa uudelleen.',
129
+ [discord_js_1.Locale.Hungarian]: 'Várnod kell {seconds} másodpercet, mielőtt újra használhatod ezt a parancsot.',
130
+ [discord_js_1.Locale.Norwegian]: 'Du må vente {seconds} sekund{plural|er} før du kan bruke denne kommandoen igjen.',
131
+ [discord_js_1.Locale.Polish]: 'Musisz poczekać {seconds} sekund{plural|y}, zanim ponownie użyjesz tego polecenia.',
132
+ [discord_js_1.Locale.Romanian]: 'Trebuie să aștepți {seconds} secundă{plural|e} înainte de a folosi din nou acest comandă.',
133
+ [discord_js_1.Locale.Swedish]: 'Du måste vänta {seconds} sekund{plural|er} innan du kan använda det här kommandot igen.',
134
+ [discord_js_1.Locale.Turkish]: 'Bu komutu tekrar kullanmadan önce {seconds} saniye beklemelisiniz.',
135
+ [discord_js_1.Locale.Ukrainian]: 'Вам потрібно почекати {seconds} секунду{plural|и}, перш ніж знову використовувати цю команду.',
136
+ [discord_js_1.Locale.Hindi]: 'आपको इस कमांड का उपयोग करने से पहले {seconds} सेकंड{plural|s} इंतजार करना होगा।',
137
+ [discord_js_1.Locale.Indonesian]: 'Anda harus menunggu {seconds} detik{plural|s} sebelum menggunakan perintah ini lagi.',
138
+ [discord_js_1.Locale.Greek]: 'Πρέπει να περιμένετε {seconds} δευτερόλεπτο{plural|α} πριν χρησιμοποιήσετε ξανά αυτήν την εντολή.',
139
+ [discord_js_1.Locale.Croatian]: 'Morate pričekati {seconds} sekundu{plural|e} prije nego što ponovno upotrijebite ovu naredbu.',
140
+ [discord_js_1.Locale.Lithuanian]: 'Prieš vėl naudodamiesi šiuo komandu, turite palaukti {seconds} sekundę{plural|es}.',
141
+ [discord_js_1.Locale.Thai]: 'คุณต้องรอ {seconds} วินาที{plural|s} ก่อนที่จะใช้คำสั่งนี้อีกครั้ง',
142
+ [discord_js_1.Locale.Vietnamese]: 'Bạn phải đợi {seconds} giây{plural|s} trước khi sử dụng lại lệnh này.'
143
+ };
144
+ exports.LOCALE_DELAY = LOCALE_DELAY;
145
+ const LOCALE_ERROR = {
146
+ [discord_js_1.Locale.SpanishLATAM]: 'Ocurrió un error al procesar tu solicitud.',
147
+ [discord_js_1.Locale.EnglishUS]: 'An error occurred while processing your request.',
148
+ [discord_js_1.Locale.EnglishGB]: 'I do declare, an error occurred while processing your request.',
149
+ [discord_js_1.Locale.SpanishES]: 'Pero que me estás contando, willy, ocurrió un error al procesar tu solicitud.',
150
+ [discord_js_1.Locale.PortugueseBR]: 'Ocorreu um erro ao processar sua solicitação.',
151
+ [discord_js_1.Locale.French]: 'Une erreur est survenue lors du traitement de votre demande.',
152
+ [discord_js_1.Locale.German]: 'Bei der Verarbeitung Ihrer Anfrage ist ein Fehler aufgetreten.',
153
+ [discord_js_1.Locale.Italian]: 'Si è verificato un errore durante l\'elaborazione della tua richiesta.',
154
+ [discord_js_1.Locale.Russian]: 'Произошла ошибка при обработке вашего запроса.',
155
+ [discord_js_1.Locale.ChineseCN]: '处理您的请求时发生错误。',
156
+ [discord_js_1.Locale.ChineseTW]: '處理您的請求時發生錯誤。',
157
+ [discord_js_1.Locale.Japanese]: 'リクエストの処理中にエラーが発生しました。',
158
+ [discord_js_1.Locale.Korean]: '요청을 처리하는 동안 오류가 발생했습니다.',
159
+ [discord_js_1.Locale.Bulgarian]: 'При обработката на заявката ви възникна грешка.',
160
+ [discord_js_1.Locale.Czech]: 'Při zpracování vaší žádosti došlo k chybě.',
161
+ [discord_js_1.Locale.Danish]: 'Der opstod en fejl under behandlingen af din anmodning.',
162
+ [discord_js_1.Locale.Dutch]: 'Er is een fout opgetreden bij het verwerken van uw verzoek.',
163
+ [discord_js_1.Locale.Finnish]: 'Pyyntösi käsittelyssä tapahtui virhe.',
164
+ [discord_js_1.Locale.Hungarian]: 'A kérésed feldolgozása során hiba lépett fel.',
165
+ [discord_js_1.Locale.Norwegian]: 'Det oppstod en feil under behandling av forespørselen din.',
166
+ [discord_js_1.Locale.Polish]: 'Wystąpił błąd podczas przetwarzania twojej prośby.',
167
+ [discord_js_1.Locale.Romanian]: 'A apărut o eroare în timpul procesării cererii tale.',
168
+ [discord_js_1.Locale.Swedish]: 'Ett fel inträffade vid behandling av din begäran.',
169
+ [discord_js_1.Locale.Turkish]: 'Talebiniz işlenirken bir hata oluştu.',
170
+ [discord_js_1.Locale.Ukrainian]: 'Під час обробки вашого запиту сталася помилка.',
171
+ [discord_js_1.Locale.Hindi]: 'आपके अनुरोध को संसाधित करते समय एक त्रुटि हुई।',
172
+ [discord_js_1.Locale.Indonesian]: 'Terjadi kesalahan saat memproses permintaan Anda.',
173
+ [discord_js_1.Locale.Greek]: 'Συνέβη σφάλμα κατά την επεξεργασία του αιτήματός σας.',
174
+ [discord_js_1.Locale.Croatian]: 'Došlo je do pogreške prilikom obrade vašeg zahtjeva.',
175
+ [discord_js_1.Locale.Lithuanian]: 'Apdorojant jūsų užklausą įvyko klaida.',
176
+ [discord_js_1.Locale.Thai]: 'เกิดข้อผิดพลาดระหว่างการประมวลผลคำขอของคุณ',
177
+ [discord_js_1.Locale.Vietnamese]: 'Đã xảy ra lỗi trong quá trình xử lý yêu cầu của bạn.'
178
+ };
179
+ exports.LOCALE_ERROR = LOCALE_ERROR;
180
+ /**
181
+ * Variables
182
+ */
183
+ const ALLOWED_OPTION_TYPE = [
184
+ discord_js_1.ApplicationCommandOptionType.String,
185
+ discord_js_1.ApplicationCommandOptionType.Boolean,
186
+ discord_js_1.ApplicationCommandOptionType.Integer,
187
+ discord_js_1.ApplicationCommandOptionType.Number,
188
+ discord_js_1.ApplicationCommandOptionType.User,
189
+ discord_js_1.ApplicationCommandOptionType.Channel,
190
+ ];
191
+ /**
192
+ * @class ModularButton
193
+ * @description Represents a modular button that can be registered with Discord.js.
194
+ * It allows for dynamic button creation and execution.
195
+ */
196
+ class ModularButton {
197
+ /**
198
+ * Creates a new button for the command.
199
+ * @param {string} customId The custom ID for the button.
200
+ * @param {ButtonStyle} style The style of the button.
201
+ */
202
+ constructor(customId, style) {
203
+ this.execute = async () => { };
204
+ this.buttonObject = new discord_js_1.ButtonBuilder();
205
+ this.buttonObject.setCustomId(customId);
206
+ this.buttonObject.setStyle(style);
207
+ this.customId = customId;
208
+ this.style = style;
209
+ }
210
+ /**
211
+ * Sets the execute function for the button.
212
+ * @param {ButtonExecuteFunction} executeFunction The function to execute.
213
+ * @return {ModularButton} The button instance for chaining.
214
+ */
215
+ setExecute(executeFunction) {
216
+ this.execute = executeFunction;
217
+ return this;
218
+ }
219
+ }
220
+ exports.ModularButton = ModularButton;
221
+ /**
222
+ * @class ModularModal
223
+ * @description Represents a modular modal that can be registered with Discord.js.
224
+ * It allows for dynamic modal creation and execution.
225
+ */
226
+ class ModularModal {
227
+ /**
228
+ * Creates a new modal for the command.
229
+ * @param {string} modalId The ID for the modal.
230
+ * @param {ModularCommand} command The command that this modal belongs to.
231
+ */
232
+ constructor(modalId, command) {
233
+ this.execute = async () => { };
234
+ this.modalObject = new discord_js_1.ModalBuilder();
235
+ this.modalObject.setCustomId(modalId);
236
+ this.modalId = modalId;
237
+ this.modalInputs = new Map();
238
+ this.command = command;
239
+ }
240
+ /**
241
+ * Sets the execute function for the modal.
242
+ * @param {ModalExecuteFunction} executeFunction The function to execute.
243
+ * @returns {ModularModal} The modal instance for chaining.
244
+ */
245
+ setExecute(executeFunction) {
246
+ this.execute = executeFunction;
247
+ return this;
248
+ }
249
+ /**
250
+ * Creates a new text input for the modal.
251
+ * @param {string} id The ID for the text input.
252
+ * @param {TextInputStyle} style The style of the text input.
253
+ * @returns {TextInputBuilder} The created text input instance.
254
+ */
255
+ newTextInput(id, style) {
256
+ const textInput = new discord_js_1.TextInputBuilder();
257
+ textInput.setCustomId(id);
258
+ textInput.setStyle(style);
259
+ this.modalInputs.set(id, textInput);
260
+ this.modalObject.addComponents(new discord_js_1.ActionRowBuilder().addComponents(textInput));
261
+ return textInput;
262
+ }
263
+ /**
264
+ * Builds the modal object.
265
+ * @param {Record<string, any>} locale The localization object for the modal.
266
+ * @return {ModalBuilder} The built modal object.
267
+ */
268
+ build(locale) {
269
+ const selfModal = this.modalObject;
270
+ const commandName = this.command.name;
271
+ selfModal.setTitle(locale[`${commandName}.${this.modalId}.title`]);
272
+ this.modalInputs.forEach((input, id) => {
273
+ input.setLabel(locale[`${commandName}.${id}.label`]);
274
+ input.setPlaceholder(locale[`${commandName}.${id}.placeholder`]);
275
+ });
276
+ return selfModal;
277
+ }
278
+ }
279
+ exports.ModularModal = ModularModal;
280
+ /**
281
+ * @class ModularCommand
282
+ * @description Represents a modular command that can be registered with Discord.js.
283
+ * It allows for dynamic command creation and execution.
284
+ */
285
+ class ModularCommand {
286
+ constructor({ name, description, execute, componentExecute, modalExecute }) {
287
+ this.name = name;
288
+ this.description = description || '';
289
+ this.execute = execute || (async () => { });
290
+ this.componentExecute = componentExecute;
291
+ this.modalExecute = modalExecute;
292
+ this.options = [];
293
+ this.optionsLocalizations = {};
294
+ this.customIdHandlers = {};
295
+ this.cooldown = 3;
296
+ this.modals = new Map();
297
+ this.buttons = new Map();
298
+ this.buttonsArray = [];
299
+ this.isNSFW = false;
300
+ }
301
+ /**
302
+ * Sets the description of the command.
303
+ * @param {string} description The description.
304
+ * @returns {ModularCommand} The command instance for chaining.
305
+ */
306
+ setDescription(description) {
307
+ this.description = description;
308
+ return this;
309
+ }
310
+ /**
311
+ * Sets the description localizations for the command.
312
+ * @param {LocalizationMap} localizations The description localizations.
313
+ * @returns {ModularCommand} The command instance for chaining.
314
+ */
315
+ setLocalizationsDescription(localizations) {
316
+ this.description = localizations[discord_js_1.Locale.EnglishUS] || this.description;
317
+ this.descriptionLocalizations = localizations;
318
+ return this;
319
+ }
320
+ setLocalizationOptions(localizations) {
321
+ this.optionsLocalizations = localizations;
322
+ return this;
323
+ }
324
+ /**
325
+ * Sets the localization phrases for the command.
326
+ * @param {Record<Locale, any>} localizationPhrases The localization phrases.
327
+ * @returns {ModularCommand} The command instance for chaining.
328
+ */
329
+ setLocalizationPhrases(localizationPhrases) {
330
+ this.localizationPhrases = localizationPhrases;
331
+ return this;
332
+ }
333
+ /**
334
+ * Sets the execute function for the command.
335
+ * @param {ExecuteFunction<CommandInteraction>} executeFunction The function to execute.
336
+ * @returns {ModularCommand} The command instance for chaining.
337
+ */
338
+ setExecute(executeFunction) {
339
+ this.execute = executeFunction;
340
+ return this;
341
+ }
342
+ /**
343
+ * Sets the component execute function for the command.
344
+ * @param {string} componentId The base ID for the components.
345
+ * @param {ExecuteFunction<MessageComponentInteraction>} executeFunction The function to execute for component interactions.
346
+ * @returns {ModularCommand} The command instance for chaining.
347
+ */
348
+ setComponentExecute(componentId, executeFunction) {
349
+ this.componentId = componentId;
350
+ this.componentExecute = executeFunction;
351
+ return this;
352
+ }
353
+ /**
354
+ * Creates a new modal for the command.
355
+ * @param {string} modalId The ID for the modal.
356
+ * @returns {ModularModal} The created modal instance.
357
+ */
358
+ newModal(modalId) {
359
+ const modal = new ModularModal(modalId, this);
360
+ this.modals.set(modalId, modal);
361
+ return modal;
362
+ }
363
+ /**
364
+ * Creates a new button for the command.
365
+ * @param {string} customId The custom ID for the button.
366
+ * @param {ButtonStyle} style The style of the button.
367
+ * @return {ModularButton} The created button instance.
368
+ */
369
+ newButton(customId, style) {
370
+ const button = new ModularButton(customId, style);
371
+ this.buttons.set(customId, button);
372
+ this.buttonsArray.push(button);
373
+ return button;
374
+ }
375
+ /**
376
+ * Set the minimun permissions required to execute the command.
377
+ * @param {PermissionCheckFunction} permissionCheckFunction The function to check permissions.
378
+ * @returns {ModularCommand} The command instance for chaining.
379
+ */
380
+ setPermissionCheck(permissionCheckFunction) {
381
+ this.permissionCheck = permissionCheckFunction;
382
+ return this;
383
+ }
384
+ /**
385
+ * Sets the cooldown for the command.
386
+ * @param {number} cooldown The cooldown in seconds.
387
+ * @returns {ModularCommand} The command instance for chaining.
388
+ */
389
+ setCooldown(cooldown) {
390
+ this.cooldown = cooldown;
391
+ return this;
392
+ }
393
+ /**
394
+ * Gets the component ID for the command.
395
+ * @returns {string | undefined} The component ID.
396
+ */
397
+ getComponentId() {
398
+ return this.componentId;
399
+ }
400
+ /**
401
+ * Adds an option to the command.
402
+ * @param {CommandOption} option The option for the command option.
403
+ * @returns {ModularCommand} The command instance for chaining.
404
+ */
405
+ addOption(option) {
406
+ if (!ALLOWED_OPTION_TYPE.includes(option.type)) {
407
+ throw new Error(`Invalid option type: ${option.type}. Allowed types are: ${ALLOWED_OPTION_TYPE.join(', ')}`);
408
+ }
409
+ this.options.push(option);
410
+ return this;
411
+ }
412
+ /**
413
+ * Adds a custom ID handler for the command.
414
+ * @param {string} customId The custom ID to match.
415
+ * @param {ExecuteFunction<CommandInteraction<CacheType>>} handlerFunction The function to execute when the custom ID matches.
416
+ * @returns {ModularCommand} The command instance for chaining.
417
+ */
418
+ addCustomIDHandler(customId, handlerFunction) {
419
+ this.customIdHandlers[customId] = handlerFunction;
420
+ return this;
421
+ }
422
+ }
423
+ exports.ModularCommand = ModularCommand;
424
+ /**
425
+ * Registers an array of modular commands.
426
+ * @param {ModularCommand[]} commands An array of ModularCommand instances.
427
+ * @returns {RegisteredCommand[]} An array of command data objects ready for Discord.js client.
428
+ */
429
+ const RegisterCommand = (commands) => {
430
+ return commands.map(command => {
431
+ const commandBuilder = new discord_js_1.SlashCommandBuilder()
432
+ .setName(command.name)
433
+ .setDescription(command.description)
434
+ .setDescriptionLocalizations(command.descriptionLocalizations || null);
435
+ const options = {};
436
+ command.options.forEach(opt => {
437
+ const description = typeof opt.description === 'string' ?
438
+ opt.description :
439
+ (opt.description[discord_js_1.Locale.EnglishUS] || `The description for ${opt.name} in English.`);
440
+ const descriptionsLocalizations = typeof opt.description === 'object' ? opt.description : {};
441
+ if (!description) {
442
+ throw new Error(`Option '${opt.name}' is missing a description.`);
443
+ }
444
+ options[opt.name] = opt.type;
445
+ const optionBuilder = (option) => {
446
+ option.setName(opt.name)
447
+ .setDescription(description)
448
+ .setRequired(opt.required || false)
449
+ .setDescriptionLocalizations(descriptionsLocalizations);
450
+ if (opt.choices && opt.choices.length > 0) {
451
+ option.addChoices(...opt.choices);
452
+ }
453
+ return option;
454
+ };
455
+ switch (opt.type) {
456
+ case discord_js_1.ApplicationCommandOptionType.String:
457
+ commandBuilder.addStringOption(optionBuilder);
458
+ break;
459
+ case discord_js_1.ApplicationCommandOptionType.Boolean:
460
+ commandBuilder.addBooleanOption(optionBuilder);
461
+ break;
462
+ case discord_js_1.ApplicationCommandOptionType.Integer:
463
+ commandBuilder.addIntegerOption(optionBuilder);
464
+ break;
465
+ case discord_js_1.ApplicationCommandOptionType.Number:
466
+ commandBuilder.addNumberOption(optionBuilder);
467
+ break;
468
+ case discord_js_1.ApplicationCommandOptionType.User:
469
+ commandBuilder.addUserOption(optionBuilder);
470
+ break;
471
+ case discord_js_1.ApplicationCommandOptionType.Channel:
472
+ commandBuilder.addChannelOption(optionBuilder);
473
+ break;
474
+ default:
475
+ throw new Error(`Unsupported option type: ${opt.type}`);
476
+ }
477
+ });
478
+ const executeBuilder = async (interaction) => {
479
+ if (command.permissionCheck && !command.permissionCheck(interaction)) {
480
+ await interaction.reply({
481
+ content: LOCALE_FORBIDDEN[interaction.locale] || LOCALE_FORBIDDEN[discord_js_1.Locale.EnglishUS],
482
+ flags: discord_js_1.MessageFlags.Ephemeral,
483
+ });
484
+ return;
485
+ }
486
+ if (command.isNSFW && (!interaction.channel || !('nsfw' in interaction.channel) || !interaction.channel.nsfw)) {
487
+ await interaction.reply({
488
+ content: LOCALE_NSFW[interaction.locale] || LOCALE_NSFW[discord_js_1.Locale.EnglishUS],
489
+ flags: discord_js_1.MessageFlags.Ephemeral,
490
+ });
491
+ return;
492
+ }
493
+ const args = {};
494
+ for (const option of Object.keys(options)) {
495
+ switch (options[option]) {
496
+ case discord_js_1.ApplicationCommandOptionType.String:
497
+ args[option] = interaction.options.getString(option, false);
498
+ break;
499
+ case discord_js_1.ApplicationCommandOptionType.Boolean:
500
+ args[option] = interaction.options.getBoolean(option, false);
501
+ break;
502
+ case discord_js_1.ApplicationCommandOptionType.Integer:
503
+ args[option] = interaction.options.getInteger(option, false);
504
+ break;
505
+ case discord_js_1.ApplicationCommandOptionType.Number:
506
+ args[option] = interaction.options.getNumber(option, false);
507
+ break;
508
+ case discord_js_1.ApplicationCommandOptionType.User:
509
+ args[option] = interaction.options.getUser(option, false);
510
+ break;
511
+ case discord_js_1.ApplicationCommandOptionType.Channel:
512
+ args[option] = interaction.options.getChannel(option, false);
513
+ break;
514
+ default:
515
+ throw new Error(`Unsupported option type: ${options[option]}`);
516
+ }
517
+ }
518
+ const localeTarget = (command.localizationPhrases && command.localizationPhrases[interaction.locale])
519
+ ? interaction.locale
520
+ : discord_js_1.Locale.EnglishUS;
521
+ const localeTable = command.localizationPhrases;
522
+ const customId = interaction.customId;
523
+ if (customId && command.customIdHandlers[customId]) {
524
+ await command.customIdHandlers[customId]({
525
+ interaction,
526
+ args,
527
+ command,
528
+ locale: localeTable ? localeTable[localeTarget] : {},
529
+ });
530
+ }
531
+ else {
532
+ await command.execute({
533
+ interaction,
534
+ args,
535
+ command,
536
+ locale: localeTable ? localeTable[localeTarget] : {},
537
+ });
538
+ }
539
+ };
540
+ const componentExecuteBuilder = async (interaction) => {
541
+ if (!command.componentExecute)
542
+ return;
543
+ if (!interaction.customId.startsWith(command.getComponentId()))
544
+ return;
545
+ const localeTarget = (command.localizationPhrases && command.localizationPhrases[interaction.locale])
546
+ ? interaction.locale
547
+ : discord_js_1.Locale.EnglishUS;
548
+ const localeTable = command.localizationPhrases;
549
+ await command.componentExecute({
550
+ interaction,
551
+ command,
552
+ locale: localeTable ? localeTable[localeTarget] : {},
553
+ });
554
+ };
555
+ const modalExecuteBuilder = async (interaction) => {
556
+ const modalId = interaction.customId;
557
+ const modalObject = command.modals.get(modalId);
558
+ if (!modalObject)
559
+ return;
560
+ const args = {};
561
+ for (const [id] of modalObject.modalInputs.entries()) {
562
+ args[id] = interaction.fields.getTextInputValue(id);
563
+ }
564
+ const localeTarget = (command.localizationPhrases && command.localizationPhrases[interaction.locale])
565
+ ? interaction.locale
566
+ : discord_js_1.Locale.EnglishUS;
567
+ const localeTable = command.localizationPhrases;
568
+ await modalObject.execute({
569
+ interaction,
570
+ args,
571
+ command,
572
+ locale: localeTable ? localeTable[localeTarget] : {},
573
+ });
574
+ };
575
+ const buttonExecuteBuilder = async (interaction) => {
576
+ const buttonId = interaction.customId;
577
+ const buttonObject = command.buttons.get(buttonId);
578
+ if (!buttonObject)
579
+ return;
580
+ const localeTarget = (command.localizationPhrases && command.localizationPhrases[interaction.locale])
581
+ ? interaction.locale
582
+ : discord_js_1.Locale.EnglishUS;
583
+ const localeTable = command.localizationPhrases;
584
+ await buttonObject.execute({
585
+ interaction,
586
+ command,
587
+ locale: localeTable ? localeTable[localeTarget] : {},
588
+ message: interaction.message,
589
+ });
590
+ };
591
+ return {
592
+ data: commandBuilder,
593
+ execute: executeBuilder,
594
+ componentExecute: command.componentExecute ? componentExecuteBuilder : undefined,
595
+ modalExecute: command.modals.size > 0 ? modalExecuteBuilder : undefined,
596
+ buttonExecute: command.buttons.size > 0 ? buttonExecuteBuilder : undefined,
597
+ cooldown: command.cooldown,
598
+ };
599
+ });
600
+ };
601
+ exports.RegisterCommand = RegisterCommand;
602
+ exports.default = ModularCommand;
package/index.js ADDED
File without changes
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "js-discord-modularcommand",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "keywords": [ "discord", "js", "node" ],
6
+ "license": "MIT",
7
+ "author": "SummerTYT",
8
+ "type": "commonjs",
9
+ "types": "./dist/index.d.ts",
10
+ "files": [ "dist/**/*" ],
11
+ "main": "index.js",
12
+ "scripts": {
13
+ "build": "tsc",
14
+ "prepublish": "npm run build"
15
+ },
16
+ "dependencies": {
17
+ "discord.js": "^14.21.0",
18
+ "typescript": "^5.9.2"
19
+ },
20
+ "devDependencies": {
21
+ "@types/node": "^24.2.1"
22
+ }
23
+ }