From 74d2dabd9789187a1c624b156b2a549eb776c840 Mon Sep 17 00:00:00 2001 From: MastiderMast <65887954+MastiderMast@users.noreply.github.com> Date: Sun, 4 Jun 2023 22:42:34 +0200 Subject: [PATCH] Improved Code --- README.md | 17 +-- src/events/interactionCreate.js | 129 +++--------------- src/events/messageCreate.js | 2 +- src/handlers/application.js | 23 ++++ src/handlers/buttons.js | 29 ---- src/handlers/channelSelectMenus.js | 29 ---- src/handlers/contextMenus.js | 29 ---- src/handlers/events.js | 2 +- src/handlers/handler.js | 39 ++++++ src/handlers/mentionableSelectMenus.js | 29 ---- src/handlers/messageCommands.js | 40 ------ src/handlers/modals.js | 29 ---- src/handlers/register.js | 20 --- src/handlers/roleSelectMenus.js | 29 ---- src/handlers/selectMenus.js | 29 ---- src/handlers/slashCommands.js | 29 ---- src/handlers/stringSelectMenus.js | 29 ---- src/handlers/userSelectMenus.js | 29 ---- src/index.js | 45 +----- .../test.js => button.js} | 4 +- src/interactions/channelSelectMenu.js | 8 ++ src/interactions/mentionableSelectMenu.js | 8 ++ .../test.js => messageCommand.js} | 6 +- src/interactions/messageContextMenu.js | 14 ++ .../{buttons/test.js => modal.js} | 2 + .../test.js => roleSelectMenu.js} | 2 + src/interactions/roleSelectMenus/test.js | 6 - src/interactions/selectMenus/test.js | 6 - src/interactions/slashCommands/eval.js | 6 +- src/interactions/slashCommands/helloWorld.js | 10 +- src/interactions/slashCommands/ping.js | 6 +- src/interactions/slashCommands/reload.js | 36 ++--- src/interactions/stringSelectMenu.js | 8 ++ src/interactions/stringSelectMenus/test.js | 6 - .../test.js => userContextMenus.js} | 4 + .../{modals/text.js => userSelectMenu.js} | 2 + src/interactions/userSelectMenus/test.js | 6 - 37 files changed, 178 insertions(+), 569 deletions(-) create mode 100644 src/handlers/application.js delete mode 100644 src/handlers/buttons.js delete mode 100644 src/handlers/channelSelectMenus.js delete mode 100644 src/handlers/contextMenus.js create mode 100644 src/handlers/handler.js delete mode 100644 src/handlers/mentionableSelectMenus.js delete mode 100644 src/handlers/messageCommands.js delete mode 100644 src/handlers/modals.js delete mode 100644 src/handlers/register.js delete mode 100644 src/handlers/roleSelectMenus.js delete mode 100644 src/handlers/selectMenus.js delete mode 100644 src/handlers/slashCommands.js delete mode 100644 src/handlers/stringSelectMenus.js delete mode 100644 src/handlers/userSelectMenus.js rename src/interactions/{mentionableSelectMenus/test.js => button.js} (65%) create mode 100644 src/interactions/channelSelectMenu.js create mode 100644 src/interactions/mentionableSelectMenu.js rename src/interactions/{messageCommands/test.js => messageCommand.js} (67%) create mode 100644 src/interactions/messageContextMenu.js rename src/interactions/{buttons/test.js => modal.js} (76%) rename src/interactions/{channelSelectMenus/test.js => roleSelectMenu.js} (71%) delete mode 100644 src/interactions/roleSelectMenus/test.js delete mode 100644 src/interactions/selectMenus/test.js create mode 100644 src/interactions/stringSelectMenu.js delete mode 100644 src/interactions/stringSelectMenus/test.js rename src/interactions/{contextMenus/test.js => userContextMenus.js} (74%) rename src/interactions/{modals/text.js => userSelectMenu.js} (71%) delete mode 100644 src/interactions/userSelectMenus/test.js diff --git a/README.md b/README.md index 97771f2..38968ed 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ # Discord.js-Advanced-Command-Handler - Simple and easy to use Slash Command Handler for Discord.js v14. ## Prerequisites @@ -13,20 +12,8 @@ Simple and easy to use Slash Command Handler for Discord.js v14. 5. Enjoy! ## Categories -Category folders are optional, but you cant have a subfolder in a category. -``` -├───interactions -│ ├───slashCommands -│ │ ├───example.js -│ │ └───category -│ │ └───example.js -│ ├───selectMenus -... -``` - -## Select Menus -In order to use select menus you can either put them all in ``/interactions/selectMenus`` or divided by their category in their according folder. -Example: A user select menu would be in ``/interactions/userSelectMenus/example.js`` +You can create as many subfolders as you want, and each of these folders can have an unlimited number of nested subfolders. +You only need to specify the interaction like the already existing ones in the ``/interactions`` folder. ## Contributing Just make a pull request and I will review it. diff --git a/src/events/interactionCreate.js b/src/events/interactionCreate.js index 6317b44..3da72c3 100644 --- a/src/events/interactionCreate.js +++ b/src/events/interactionCreate.js @@ -3,116 +3,29 @@ export default { async execute(client, interaction) { try { - if (interaction.isUserContextMenuCommand() === true) { - const contextMenu = client.contextMenus.get(interaction.commandName); - if (!contextMenu) return; - try { - contextMenu.execute(client, interaction); - } catch (error) { - interaction.reply({ content: 'There was an error while executing this context menu!', ephemeral: true }); - console.log(error); - } + const interactionType = (() => { + if (interaction.isContextMenuCommand()) return 'contextMenu'; + if (interaction.isMessageContextMenuCommand()) return 'messageContextMenu'; + if (interaction.isUserContextMenuCommand()) return 'userContextMenu'; + if (interaction.isCommand()) return 'slashCommand'; + if (interaction.isModalSubmit()) return 'modal'; + if (interaction.isButton()) return 'button'; + if (interaction.isStringSelectMenu()) return 'stringSelectMenu'; + if (interaction.isChannelSelectMenu()) return 'channelSelectMenu'; + if (interaction.isMentionableSelectMenu()) return 'mentionableSelectMenu'; + if (interaction.isRoleSelectMenu()) return 'roleSelectMenu'; + if (interaction.isUserSelectMenu()) return 'userSelectMenu'; + })(); + + let action = client.interaction.get(`${interactionType}-${interaction.customId || interaction.commandName}`); + if (!action) return; + try { + action.execute(client, interaction); + } catch (error) { + interaction.reply({ content: 'There was an error while executing this context menu!', ephemeral: true }); + console.log(error); } - if (interaction.isCommand()) { - const command = client.slashCommands.get(interaction.commandName); - if (!command) return; - try { - command.execute(client, interaction); - } catch (error) { - interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true }); - console.log(error); - } - } - - if (interaction.isModalSubmit()) { - const modal = client.modals.get(interaction.customId); - if (!modal) return; - try { - modal.execute(client, interaction); - } catch (error) { - interaction.reply({ content: 'There was an error while executing this modal!', ephemeral: true }); - console.log(error); - } - } - - if (interaction.isButton()) { - const button = client.buttons.get(interaction.customId); - if (!button) return; - try { - button.execute(client, interaction); - } catch (error) { - interaction.reply({ content: 'There was an error while executing this button!', ephemeral: true }); - console.log(error); - } - } - - if (interaction.isAnySelectMenu()) { - const selectMenu = client.selectMenus.get(interaction.customId); - if (!selectMenu) return; - try { - selectMenu.execute(client, interaction); - } catch (error) { - interaction.reply({ content: 'There was an error while executing this select menu!', ephemeral: true }); - console.log(error); - } - } - - if (interaction.isStringSelectMenu()) { - const stringSelectMenu = client.stringSelectMenus.get(interaction.customId); - if (!stringSelectMenu) return; - try { - stringSelectMenu.execute(client, interaction); - } catch (error) { - interaction.reply({ content: 'There was an error while executing this select menu!', ephemeral: true }); - console.log(error); - } - } - - if (interaction.isChannelSelectMenu()) { - const channelSelectMenu = client.channelSelectMenus.get(interaction.customId); - if (!channelSelectMenu) return; - try { - channelSelectMenu.execute(client, interaction); - } catch (error) { - interaction.reply({ content: 'There was an error while executing this select menu!', ephemeral: true }); - console.log(error); - } - } - - if (interaction.isMentionableSelectMenu()) { - const mentionableSelectMenu = client.mentionableSelectMenus.get(interaction.customId); - if (!mentionableSelectMenu) return; - try { - mentionableSelectMenu.execute(client, interaction); - } catch (error) { - interaction.reply({ content: 'There was an error while executing this select menu!', ephemeral: true }); - console.log(error); - } - } - - if (interaction.isRoleSelectMenu()) { - const roleSelectMenu = client.roleSelectMenus.get(interaction.customId); - if (!roleSelectMenu) return; - try { - roleSelectMenu.execute(client, interaction); - } catch (error) { - interaction.reply({ content: 'There was an error while executing this select menu!', ephemeral: true }); - console.log(error); - } - } - - if (interaction.isUserSelectMenu()) { - const userSelectMenu = client.userSelectMenus.get(interaction.customId); - if (!userSelectMenu) return; - try { - userSelectMenu.execute(client, interaction); - } catch (error) { - interaction.reply({ content: 'There was an error while executing this select menu!', ephemeral: true }); - console.log(error); - } - } - } catch (error) { return console.log(error); } diff --git a/src/events/messageCreate.js b/src/events/messageCreate.js index 5a0f56c..0ad2aa8 100644 --- a/src/events/messageCreate.js +++ b/src/events/messageCreate.js @@ -8,7 +8,7 @@ export default { if (message.content.startsWith(config.bot.prefix)) { const args = message.content.slice(config.bot.prefix.length).trim().split(/ +/); - const command = client.messageCommands.get(args[0]) || client.messageCommands.find(cmd => cmd.aliases && cmd.aliases.includes(args[0])); + const command = client.interaction.get(`messageCommand-${args[0]}`); if (!command) return; try { command.execute(client, message, args); diff --git a/src/handlers/application.js b/src/handlers/application.js new file mode 100644 index 0000000..84a3e32 --- /dev/null +++ b/src/handlers/application.js @@ -0,0 +1,23 @@ +import config from '../data/config.js'; +import chalk from 'chalk'; +import { REST, Routes } from 'discord.js'; +const rest = new REST({ version: '10' }).setToken(config.bot.token); + +async function registerApplicationCommands(client) { + try { + let commands = new Map(); + for (const [key, value] of client.interaction) { + if (key.startsWith('slashCommand-') || key.startsWith('contextMenu-')) commands.set(key, value); + } + + await rest.put( + Routes.applicationCommands(client.user.id), + { body: [...commands.values()].map(command => command.data.toJSON()) }, + ); + console.log(chalk.greenBright('[APPLICATION] Successfully registered application commands.')); + } catch (err) { + console.error(err); + } +} + +export default registerApplicationCommands; \ No newline at end of file diff --git a/src/handlers/buttons.js b/src/handlers/buttons.js deleted file mode 100644 index 4de38be..0000000 --- a/src/handlers/buttons.js +++ /dev/null @@ -1,29 +0,0 @@ -import { readdirSync } from 'fs'; -import chalk from 'chalk'; - -async function loadButtons(client) { - client.buttons.clear(); - let files = 0; - const buttonFiles = readdirSync('./src/interactions/buttons').filter(file => file.endsWith('.js')); - if (!buttonFiles) return; - for (let i = 0; i < buttonFiles.length; i++) { - const button = await import(`../interactions/buttons/${buttonFiles[i]}?${Date.now()}`); - await client.buttons.set(button.default.id, button.default); - console.log(chalk.greenBright(`[BUTTON] Loaded ${(chalk.yellow(buttonFiles[i]))} with button ${(chalk.yellow(button.default.id))}`)); - files++; - } - const buttonFolders = readdirSync('./src/interactions/buttons', { withFileTypes: true }).filter(file => file.isDirectory()); - if (!buttonFolders) return; - for (let i = 0; i < buttonFolders.length; i++) { - const buttonFiles = readdirSync(`./src/interactions/buttons/${buttonFolders[i].name}`).filter(file => file.endsWith('.js')); - for (let j = 0; j < buttonFiles.length; j++) { - const button = await import(`../interactions/buttons/${buttonFolders[i].name}/${buttonFiles[j]}`); - await client.buttons.set(button.default.id, button.default); - console.log(chalk.greenBright(`[BUTTON] Loaded ${(chalk.yellow(buttonFiles[j]))} with button ${(chalk.yellow(button.default.id))}`)); - files++; - } - } - return files; -} - -export default { loadButtons }; \ No newline at end of file diff --git a/src/handlers/channelSelectMenus.js b/src/handlers/channelSelectMenus.js deleted file mode 100644 index c1f1c82..0000000 --- a/src/handlers/channelSelectMenus.js +++ /dev/null @@ -1,29 +0,0 @@ -import { readdirSync } from 'fs'; -import chalk from 'chalk'; - -async function loadChannelSelectMenus(client) { - client.channelSelectMenus.clear(); - let files = 0; - const channelSelectMenuFiles = readdirSync('./src/interactions/channelSelectMenus').filter(file => file.endsWith('.js')); - if (!client.channelSelectMenus) return; - for (let i = 0; i < channelSelectMenuFiles.length; i++) { - const channelSelectMenu = await import(`../interactions/channelSelectMenus/${channelSelectMenuFiles[i]}?${Date.now()}`); - await client.channelSelectMenus.set(channelSelectMenu.default.id, channelSelectMenu.default); - console.log(chalk.greenBright(`[CHANNELSELECTMENU] Loaded ${(chalk.yellow(channelSelectMenuFiles[i]))} with channelSelectMenu ${(chalk.yellow(channelSelectMenu.default.id))}`)); - files++; - } - const channelSelectMenuFolders = readdirSync('./src/interactions/channelSelectMenus', { withFileTypes: true }).filter(file => file.isDirectory()); - if (!channelSelectMenuFolders) return; - for (let i = 0; i < channelSelectMenuFolders.length; i++) { - const channelSelectMenuFiles = readdirSync(`./src/interactions/channelSelectMenus/${channelSelectMenuFolders[i].name}`).filter(file => file.endsWith('.js')); - for (let j = 0; j < channelSelectMenuFiles.length; j++) { - const channelSelectMenu = await import(`../interactions/channelSelectMenus/${channelSelectMenuFolders[i].name}/${channelSelectMenuFiles[j]}?${Date.now()}`); - await client.channelSelectMenus.set(channelSelectMenu.default.id, channelSelectMenu.default); - console.log(chalk.greenBright(`[CHANNELSELECTMENU] Loaded ${(chalk.yellow(channelSelectMenuFiles[j]))} with channelSelectMenu ${(chalk.yellow(channelSelectMenu.default.id))}`)); - files++; - } - } - return files; -} - -export default { loadChannelSelectMenus }; \ No newline at end of file diff --git a/src/handlers/contextMenus.js b/src/handlers/contextMenus.js deleted file mode 100644 index c1ae10f..0000000 --- a/src/handlers/contextMenus.js +++ /dev/null @@ -1,29 +0,0 @@ -import { readdirSync } from 'fs'; -import chalk from 'chalk'; - -async function loadContextMenus(client) { - client.contextMenus.clear(); - let files = 0; - const contextMenus = readdirSync('./src/interactions/contextMenus').filter(file => file.endsWith('.js')); - if (!contextMenus) return; - for (let i = 0; i < contextMenus.length; i++) { - const menus = await import(`../interactions/contextMenus/${contextMenus[i]}?${Date.now()}`); - client.contextMenus.set(menus.default.data.toJSON().name, menus.default); - console.log(chalk.greenBright(`[CONTEXTMENU] Loaded ${chalk.yellow(contextMenus[i])} with command ${chalk.yellow(menus.default.data.toJSON().name)}`)); - files++; - } - const contextMenuFolders = readdirSync('./src/interactions/contextMenus', { withFileTypes: true }).filter(file => file.isDirectory()); - if (!contextMenuFolders) return; - for (let i = 0; i < contextMenuFolders.length; i++) { - const contextMenus = readdirSync(`./src/interactions/contextMenus/${contextMenuFolders[i].name}`).filter(file => file.endsWith('.js')); - for (let j = 0; j < contextMenus.length; j++) { - const menus = await import(`../interactions/contextMenus/${contextMenuFolders[i].name}/${contextMenus[j]}`); - client.contextMenus.set(menus.default.data.toJSON().name, menus.default); - console.log(chalk.greenBright(`[CONTEXTMENU] Loaded ${chalk.yellow(contextMenus[j])} with command ${chalk.yellow(menus.default.data.toJSON().name)}`)); - files++; - } - } - return files; -} - -export default { loadContextMenus }; \ No newline at end of file diff --git a/src/handlers/events.js b/src/handlers/events.js index df6a933..51f37c6 100644 --- a/src/handlers/events.js +++ b/src/handlers/events.js @@ -11,4 +11,4 @@ async function loadEvents(client) { } } -export default { loadEvents }; \ No newline at end of file +export default loadEvents; \ No newline at end of file diff --git a/src/handlers/handler.js b/src/handlers/handler.js new file mode 100644 index 0000000..f38e437 --- /dev/null +++ b/src/handlers/handler.js @@ -0,0 +1,39 @@ +import fs from 'fs'; +import chalk from 'chalk'; + +async function loadInteractions(folderPath, client) { + try { + let files = fs.readdirSync(folderPath); + + for (let i = 0; i < files.length; i++) { + let file = files[i]; + let filePath = folderPath + '/' + file; + let stats = fs.statSync(filePath); + + if (stats.isDirectory()) { + await loadInteractions(filePath, client); + } else { + let interactionPath = '.' + filePath; + let interaction = await import(`../${interactionPath}?${Date.now()}`); + + if (interaction.default.disabled === true) return; + if (interaction.default.type === 'messageCommand') { + client.interaction.set(`messageCommand-${interaction.default.id}`, interaction.default); + console.log(chalk.greenBright(`[${interaction.default.type.toUpperCase()}] Successfully Loaded ${(chalk.yellow(file))} ${(chalk.yellow(interaction.default.id))}`)); + if (interaction.default.aliases) { + for (let i = 0; i < interaction.default.aliases.length; i++) { + client.interaction.set(`messageCommand-${interaction.default.aliases[i]}`, interaction.default); + } + } + } else { + client.interaction.set(`${interaction.default.type}-${interaction.default.id}`, interaction.default); + console.log(chalk.greenBright(`[${interaction.default.type.toUpperCase()}] Successfully Loaded ${(chalk.yellow(file))} ${(chalk.yellow(interaction.default.id))}`)); + } + } + } + } catch (err) { + console.error(err); + } +} + +export default loadInteractions; \ No newline at end of file diff --git a/src/handlers/mentionableSelectMenus.js b/src/handlers/mentionableSelectMenus.js deleted file mode 100644 index cb60a11..0000000 --- a/src/handlers/mentionableSelectMenus.js +++ /dev/null @@ -1,29 +0,0 @@ -import { readdirSync } from 'fs'; -import chalk from 'chalk'; - -async function loadMentionableSelectMenus(client) { - client.mentionableSelectMenus.clear(); - let files = 0; - const mentionableSelectMenuFiles = readdirSync('./src/interactions/mentionableSelectMenus').filter(file => file.endsWith('.js')); - if (!client.mentionableSelectMenus) return; - for (let i = 0; i < mentionableSelectMenuFiles.length; i++) { - const mentionableSelectMenu = await import(`../interactions/mentionableSelectMenus/${mentionableSelectMenuFiles[i]}?${Date.now()}`); - await client.mentionableSelectMenus.set(mentionableSelectMenu.default.id, mentionableSelectMenu.default); - console.log(chalk.greenBright(`[MENTIONABLESELECTMENU] Loaded ${(chalk.yellow(mentionableSelectMenuFiles[i]))} with mentionableSelectMenu ${(chalk.yellow(mentionableSelectMenu.default.id))}`)); - files++; - } - const mentionableSelectMenuFolders = readdirSync('./src/interactions/mentionableSelectMenus', { withFileTypes: true }).filter(file => file.isDirectory()); - if (!mentionableSelectMenuFolders) return; - for (let i = 0; i < mentionableSelectMenuFolders.length; i++) { - const mentionableSelectMenuFiles = readdirSync(`./src/interactions/mentionableSelectMenus/${mentionableSelectMenuFolders[i].name}`).filter(file => file.endsWith('.js')); - for (let j = 0; j < mentionableSelectMenuFiles.length; j++) { - const mentionableSelectMenu = await import(`../interactions/mentionableSelectMenus/${mentionableSelectMenuFolders[i].name}/${mentionableSelectMenuFiles[j]}?${Date.now()}`); - await client.mentionableSelectMenus.set(mentionableSelectMenu.default.id, mentionableSelectMenu.default); - console.log(chalk.greenBright(`[MENTIONABLESELECTMENU] Loaded ${(chalk.yellow(mentionableSelectMenuFiles[j]))} with mentionableSelectMenu ${(chalk.yellow(mentionableSelectMenu.default.id))}`)); - files++; - } - } - return files; -} - -export default { loadMentionableSelectMenus }; \ No newline at end of file diff --git a/src/handlers/messageCommands.js b/src/handlers/messageCommands.js deleted file mode 100644 index e7da647..0000000 --- a/src/handlers/messageCommands.js +++ /dev/null @@ -1,40 +0,0 @@ -import chalk from 'chalk'; -import { readdirSync } from 'fs'; - -async function loadMessageCommands(client) { - client.messageCommands.clear(); - client.messageCommandsAliases.clear(); - let files = 0; - const commandFiles = readdirSync('./src/interactions/messageCommands').filter(file => file.endsWith('.js')); - if (!commandFiles) return; - for (let i = 0; i < commandFiles.length; i++) { - const command = await import(`../interactions/messageCommands/${commandFiles[i]}?${Date.now()}`); - if (command.default.aliases) { - command.default.aliases.forEach(alias => { - client.messageCommandsAliases.set(alias, command.default); - }); - } - client.messageCommands.set(command.default.name, command.default); - console.log(chalk.greenBright(`[COMMAND] Loaded ${(chalk.yellow(commandFiles[i]))} with command ${(chalk.yellow(command.default.name))}`)); - files++; - } - const commandFolders = readdirSync('./src/interactions/messageCommands', { withFileTypes: true }).filter(file => file.isDirectory()); - if (!commandFolders) return; - for (let i = 0; i < commandFolders.length; i++) { - const commandFiles = readdirSync(`./src/interactions/messageCommands/${commandFolders[i].name}`).filter(file => file.endsWith('.js')); - for (let j = 0; j < commandFiles.length; j++) { - const command = await import(`../interactions/messageCommands/${commandFolders[i].name}/${commandFiles[j]}?${Date.now()}`); - if (command.default.aliases) { - command.default.aliases.forEach(alias => { - client.messageCommandsAliases.set(alias, command.default); - }); - } - client.messageCommands.set(command.default.name, command.default); - console.log(chalk.greenBright(`[COMMAND] Loaded ${(chalk.yellow(commandFiles[j]))} with command ${(chalk.yellow(command.default.name))}`)); - files++; - } - } - return files; -} - -export default { loadMessageCommands }; \ No newline at end of file diff --git a/src/handlers/modals.js b/src/handlers/modals.js deleted file mode 100644 index 10552f3..0000000 --- a/src/handlers/modals.js +++ /dev/null @@ -1,29 +0,0 @@ -import { readdirSync } from 'fs'; -import chalk from 'chalk'; - -async function loadModals(client) { - client.modals.clear(); - let files = 0; - const modalFiles = readdirSync('./src/interactions/modals').filter(file => file.endsWith('.js')); - if (!modalFiles) return; - for (let i = 0; i < modalFiles.length; i++) { - const modal = await import(`../interactions/modals/${modalFiles[i]}?${Date.now()}`); - await client.modals.set(modal.default.id, modal.default); - console.log(chalk.greenBright(`[MODAL] Loaded ${(chalk.yellow(modalFiles[i]))} with modal ${(chalk.yellow(modal.default.id))}`)); - files++; - } - const modalFolders = readdirSync('./src/interactions/modals', { withFileTypes: true }).filter(file => file.isDirectory()); - if (!modalFolders) return; - for (let i = 0; i < modalFolders.length; i++) { - const modalFiles = readdirSync(`./src/interactions/modals/${modalFolders[i].name}`).filter(file => file.endsWith('.js')); - for (let j = 0; j < modalFiles.length; j++) { - const modal = await import(`../interactions/modals/${modalFolders[i].name}/${modalFiles[j]}?${Date.now()}`); - await client.modals.set(modal.default.id, modal.default); - console.log(chalk.greenBright(`[MODAL] Loaded ${(chalk.yellow(modalFiles[j]))} with modal ${(chalk.yellow(modal.default.id))}`)); - files++; - } - } - return files; -} - -export default { loadModals }; \ No newline at end of file diff --git a/src/handlers/register.js b/src/handlers/register.js deleted file mode 100644 index 31ea1d7..0000000 --- a/src/handlers/register.js +++ /dev/null @@ -1,20 +0,0 @@ -import config from '../data/config.js'; -import { REST, Routes } from 'discord.js'; -const rest = new REST({ version: '10' }).setToken(config.bot.token); - -async function load(client) { - const commands = new Map(); - for (const [key, value] of client.slashCommands) { - commands.set(key, value); - } - for (const [key, value] of client.contextMenus) { - commands.set(key, value); - } - - await rest.put( - Routes.applicationCommands(client.user.id), - { body: [...commands.values()].map(command => command.data.toJSON()) }, - ); -} - -export default { load }; \ No newline at end of file diff --git a/src/handlers/roleSelectMenus.js b/src/handlers/roleSelectMenus.js deleted file mode 100644 index 8a60c4a..0000000 --- a/src/handlers/roleSelectMenus.js +++ /dev/null @@ -1,29 +0,0 @@ -import { readdirSync } from 'fs'; -import chalk from 'chalk'; - -async function loadRoleSelectMenus(client) { - client.roleSelectMenus.clear(); - let files = 0; - const roleSelectMenuFiles = readdirSync('./src/interactions/roleSelectMenus').filter(file => file.endsWith('.js')); - if (!client.roleSelectMenus) return; - for (let i = 0; i < roleSelectMenuFiles.length; i++) { - const roleSelectMenu = await import(`../interactions/roleSelectMenus/${roleSelectMenuFiles[i]}?${Date.now()}`); - await client.roleSelectMenus.set(roleSelectMenu.default.id, roleSelectMenu.default); - console.log(chalk.greenBright(`[ROLESELECTMENU] Loaded ${(chalk.yellow(roleSelectMenuFiles[i]))} with roleSelectMenu ${(chalk.yellow(roleSelectMenu.default.id))}`)); - files++; - } - const roleSelectMenuFolders = readdirSync('./src/interactions/roleSelectMenus', { withFileTypes: true }).filter(file => file.isDirectory()); - if (!roleSelectMenuFolders) return; - for (let i = 0; i < roleSelectMenuFolders.length; i++) { - const roleSelectMenuFiles = readdirSync(`./src/interactions/roleSelectMenus/${roleSelectMenuFolders[i].name}`).filter(file => file.endsWith('.js')); - for (let j = 0; j < roleSelectMenuFiles.length; j++) { - const roleSelectMenu = await import(`../interactions/roleSelectMenus/${roleSelectMenuFolders[i].name}/${roleSelectMenuFiles[j]}?${Date.now()}`); - await client.roleSelectMenus.set(roleSelectMenu.default.id, roleSelectMenu.default); - console.log(chalk.greenBright(`[ROLESELECTMENU] Loaded ${(chalk.yellow(roleSelectMenuFiles[j]))} with roleSelectMenu ${(chalk.yellow(roleSelectMenu.default.id))}`)); - files++; - } - } - return files; -} - -export default { loadRoleSelectMenus }; \ No newline at end of file diff --git a/src/handlers/selectMenus.js b/src/handlers/selectMenus.js deleted file mode 100644 index fe659f5..0000000 --- a/src/handlers/selectMenus.js +++ /dev/null @@ -1,29 +0,0 @@ -import { readdirSync } from 'fs'; -import chalk from 'chalk'; - -async function loadSelectMenus(client) { - client.selectMenus.clear(); - let files = 0; - const selectMenuFiles = readdirSync('./src/interactions/selectMenus').filter(file => file.endsWith('.js')); - if (!client.selectMenus) return; - for (let i = 0; i < selectMenuFiles.length; i++) { - const selectMenu = await import(`../interactions/selectMenus/${selectMenuFiles[i]}?${Date.now()}`); - await client.selectMenus.set(selectMenu.default.id, selectMenu.default); - console.log(chalk.greenBright(`[SELECTMENU] Loaded ${(chalk.yellow(selectMenuFiles[i]))} with selectMenu ${(chalk.yellow(selectMenu.default.id))}`)); - files++; - } - const selectMenuFolders = readdirSync('./src/interactions/selectMenus', { withFileTypes: true }).filter(file => file.isDirectory()); - if (!selectMenuFolders) return; - for (let i = 0; i < selectMenuFolders.length; i++) { - const selectMenuFiles = readdirSync(`./src/interactions/selectMenus/${selectMenuFolders[i].name}`).filter(file => file.endsWith('.js')); - for (let j = 0; j < selectMenuFiles.length; j++) { - const selectMenu = await import(`../interactions/selectMenus/${selectMenuFolders[i].name}/${selectMenuFiles[j]}?${Date.now()}`); - await client.selectMenus.set(selectMenu.default.id, selectMenu.default); - console.log(chalk.greenBright(`[SELECTMENU] Loaded ${(chalk.yellow(selectMenuFiles[j]))} with selectMenu ${(chalk.yellow(selectMenu.default.id))}`)); - files++; - } - } - return files; -} - -export default { loadSelectMenus }; \ No newline at end of file diff --git a/src/handlers/slashCommands.js b/src/handlers/slashCommands.js deleted file mode 100644 index 95def8d..0000000 --- a/src/handlers/slashCommands.js +++ /dev/null @@ -1,29 +0,0 @@ -import { readdirSync } from 'fs'; -import chalk from 'chalk'; - -async function loadSlashCommands(client) { - client.slashCommands.clear(); - let files = 0; - const slashCommands = readdirSync('./src/interactions/slashCommands').filter(file => file.endsWith('.js')); - if (!slashCommands) return; - for (let i = 0; i < slashCommands.length; i++) { - const commands = await import(`../interactions/slashCommands/${slashCommands[i]}?${Date.now()}`); - client.slashCommands.set(commands.default.data.toJSON().name, commands.default); - console.log(chalk.greenBright(`[SLASHCOMMAND] Loaded ${chalk.yellow(slashCommands[i])} with command ${chalk.yellow(commands.default.data.toJSON().name)}`)); - files++; - } - const slashCommandFolders = readdirSync('./src/interactions/slashCommands', { withFileTypes: true }).filter(file => file.isDirectory()); - if (!slashCommandFolders) return; - for (let i = 0; i < slashCommandFolders.length; i++) { - const slashCommands = readdirSync(`./src/interactions/slashCommands/${slashCommandFolders[i].name}`).filter(file => file.endsWith('.js')); - for (let j = 0; j < slashCommands.length; j++) { - const commands = await import(`../interactions/slashCommands/${slashCommandFolders[i].name}/${slashCommands[j]}`); - client.slashCommands.set(commands.default.data.toJSON().name, commands.default); - console.log(chalk.greenBright(`[SLASHCOMMAND] Loaded ${chalk.yellow(slashCommands[j])} with command ${chalk.yellow(commands.default.data.toJSON().name)}`)); - files++; - } - } - return files; -} - -export default { loadSlashCommands }; \ No newline at end of file diff --git a/src/handlers/stringSelectMenus.js b/src/handlers/stringSelectMenus.js deleted file mode 100644 index aabd642..0000000 --- a/src/handlers/stringSelectMenus.js +++ /dev/null @@ -1,29 +0,0 @@ -import { readdirSync } from 'fs'; -import chalk from 'chalk'; - -async function loadStringSelectMenus(client) { - client.stringSelectMenus.clear(); - let files = 0; - const stringSelectMenuFiles = readdirSync('./src/interactions/stringSelectMenus').filter(file => file.endsWith('.js')); - if (!client.stringSelectMenus) return; - for (let i = 0; i < stringSelectMenuFiles.length; i++) { - const stringSelectMenu = await import(`../interactions/stringSelectMenus/${stringSelectMenuFiles[i]}?${Date.now()}`); - await client.stringSelectMenus.set(stringSelectMenu.default.id, stringSelectMenu.default); - console.log(chalk.greenBright(`[STRINGSELECTMENU] Loaded ${(chalk.yellow(stringSelectMenuFiles[i]))} with stringSelectMenu ${(chalk.yellow(stringSelectMenu.default.id))}`)); - files++; - } - const stringSelectMenuFolders = readdirSync('./src/interactions/stringSelectMenus', { withFileTypes: true }).filter(file => file.isDirectory()); - if (!stringSelectMenuFolders) return; - for (let i = 0; i < stringSelectMenuFolders.length; i++) { - const stringSelectMenuFiles = readdirSync(`./src/interactions/stringSelectMenus/${stringSelectMenuFolders[i].name}`).filter(file => file.endsWith('.js')); - for (let j = 0; j < stringSelectMenuFiles.length; j++) { - const stringSelectMenu = await import(`../interactions/stringSelectMenus/${stringSelectMenuFolders[i].name}/${stringSelectMenuFiles[j]}?${Date.now()}`); - await client.stringSelectMenus.set(stringSelectMenu.default.id, stringSelectMenu.default); - console.log(chalk.greenBright(`[STRINGSELECTMENU] Loaded ${(chalk.yellow(stringSelectMenuFiles[j]))} with stringSelectMenu ${(chalk.yellow(stringSelectMenu.default.id))}`)); - files++; - } - } - return files; -} - -export default { loadStringSelectMenus }; \ No newline at end of file diff --git a/src/handlers/userSelectMenus.js b/src/handlers/userSelectMenus.js deleted file mode 100644 index 6f0cb25..0000000 --- a/src/handlers/userSelectMenus.js +++ /dev/null @@ -1,29 +0,0 @@ -import { readdirSync } from 'fs'; -import chalk from 'chalk'; - -async function loadUserSelectMenus(client) { - client.userSelectMenus.clear(); - let files = 0; - const userSelectMenuFiles = readdirSync('./src/interactions/userSelectMenus').filter(file => file.endsWith('.js')); - if (!client.userSelectMenus) return; - for (let i = 0; i < userSelectMenuFiles.length; i++) { - const userSelectMenu = await import(`../interactions/userSelectMenus/${userSelectMenuFiles[i]}?${Date.now()}`); - await client.userSelectMenus.set(userSelectMenu.default.id, userSelectMenu.default); - console.log(chalk.greenBright(`[USERSELECTMENU] Loaded ${(chalk.yellow(userSelectMenuFiles[i]))} with userSelectMenu ${(chalk.yellow(userSelectMenu.default.id))}`)); - files++; - } - const userSelectMenuFolders = readdirSync('./src/interactions/userSelectMenus', { withFileTypes: true }).filter(file => file.isDirectory()); - if (!userSelectMenuFolders) return; - for (let i = 0; i < userSelectMenuFolders.length; i++) { - const userSelectMenuFiles = readdirSync(`./src/interactions/userSelectMenus/${userSelectMenuFolders[i].name}`).filter(file => file.endsWith('.js')); - for (let j = 0; j < userSelectMenuFiles.length; j++) { - const userSelectMenu = await import(`../interactions/userSelectMenus/${userSelectMenuFolders[i].name}/${userSelectMenuFiles[j]}?${Date.now()}`); - await client.userSelectMenus.set(userSelectMenu.default.id, userSelectMenu.default); - console.log(chalk.greenBright(`[USERSELECTMENU] Loaded ${(chalk.yellow(userSelectMenuFiles[j]))} with userSelectMenu ${(chalk.yellow(userSelectMenu.default.id))}`)); - files++; - } - } - return files; -} - -export default { loadUserSelectMenus }; \ No newline at end of file diff --git a/src/index.js b/src/index.js index edc2375..eda8ba6 100644 --- a/src/index.js +++ b/src/index.js @@ -1,19 +1,9 @@ import Discord from 'discord.js'; import config from './data/config.js'; -import eventHandler from './handlers/events.js'; -import messageCommandHandler from './handlers/messageCommands.js'; -import slashCommandHandler from './handlers/slashCommands.js'; -import modalHandler from './handlers/modals.js'; -import buttonHandler from './handlers/buttons.js'; -import selectMenuHandler from './handlers/selectMenus.js'; -import stringSelectMenuHandler from './handlers/stringSelectMenus.js'; -import channelSelectMenuHandler from './handlers/channelSelectMenus.js'; -import mentionableSelectMenuHandler from './handlers/mentionableSelectMenus.js'; -import roleSelectMenuHandler from './handlers/roleSelectMenus.js'; -import userSelectMenuHandler from './handlers/userSelectMenus.js'; -import contextMenus from './handlers/contextMenus.js'; -import register from './handlers/register.js'; +import loadEvents from './handlers/events.js'; +import loadInteractions from './handlers/handler.js'; +import registerApplicationCommands from './handlers/application.js'; const client = new Discord.Client({ intents: [ @@ -33,32 +23,11 @@ const client = new Discord.Client({ await client.login(config.bot.token); -client.messageCommands = new Discord.Collection(); -client.messageCommandsAliases = new Discord.Collection(); -client.slashCommands = new Discord.Collection(); -client.modals = new Discord.Collection(); -client.buttons = new Discord.Collection(); -client.selectMenus = new Discord.Collection(); -client.stringSelectMenus = new Discord.Collection(); -client.channelSelectMenus = new Discord.Collection(); -client.mentionableSelectMenus = new Discord.Collection(); -client.roleSelectMenus = new Discord.Collection(); -client.userSelectMenus = new Discord.Collection(); -client.contextMenus = new Discord.Collection(); +client.interaction = new Discord.Collection(); -await eventHandler.loadEvents(client); -await messageCommandHandler.loadMessageCommands(client); -await slashCommandHandler.loadSlashCommands(client); -await modalHandler.loadModals(client); -await buttonHandler.loadButtons(client); -await selectMenuHandler.loadSelectMenus(client); -await stringSelectMenuHandler.loadStringSelectMenus(client); -await channelSelectMenuHandler.loadChannelSelectMenus(client); -await mentionableSelectMenuHandler.loadMentionableSelectMenus(client); -await roleSelectMenuHandler.loadRoleSelectMenus(client); -await userSelectMenuHandler.loadUserSelectMenus(client); -await contextMenus.loadContextMenus(client); -await register.load(client); +await loadEvents(client); +await loadInteractions('./src/interactions', client); +await registerApplicationCommands(client); process.on('uncaughtException', function (err) { console.error(err); diff --git a/src/interactions/mentionableSelectMenus/test.js b/src/interactions/button.js similarity index 65% rename from src/interactions/mentionableSelectMenus/test.js rename to src/interactions/button.js index 4b6eb31..62a5f8f 100644 --- a/src/interactions/mentionableSelectMenus/test.js +++ b/src/interactions/button.js @@ -1,5 +1,7 @@ export default { - id: 'test', + id: 'button', + type: 'button', + disabled: false, async execute(client, interaction) { interaction.reply('Hello World!'); } diff --git a/src/interactions/channelSelectMenu.js b/src/interactions/channelSelectMenu.js new file mode 100644 index 0000000..77eaf33 --- /dev/null +++ b/src/interactions/channelSelectMenu.js @@ -0,0 +1,8 @@ +export default { + id: 'channelSelectMenu', + type: 'channelSelectMenu', + disabled: false, + async execute(client, interaction) { + interaction.reply('Hello World!'); + } +}; \ No newline at end of file diff --git a/src/interactions/mentionableSelectMenu.js b/src/interactions/mentionableSelectMenu.js new file mode 100644 index 0000000..15c44aa --- /dev/null +++ b/src/interactions/mentionableSelectMenu.js @@ -0,0 +1,8 @@ +export default { + id: 'mentionableSelectMenu', + type: 'mentionableSelectMenu', + disabled: false, + async execute(client, interaction) { + interaction.reply('Hello World!'); + } +}; \ No newline at end of file diff --git a/src/interactions/messageCommands/test.js b/src/interactions/messageCommand.js similarity index 67% rename from src/interactions/messageCommands/test.js rename to src/interactions/messageCommand.js index b26882c..9093d86 100644 --- a/src/interactions/messageCommands/test.js +++ b/src/interactions/messageCommand.js @@ -1,8 +1,8 @@ export default { - name: 'hello', - description: 'Hello world.', + id: 'hello', + type: 'messageCommand', + disabled: false, aliases: ['hey', 'hi'], - async execute(client, message, args) { message.reply('Hello World!'); } diff --git a/src/interactions/messageContextMenu.js b/src/interactions/messageContextMenu.js new file mode 100644 index 0000000..6d17e80 --- /dev/null +++ b/src/interactions/messageContextMenu.js @@ -0,0 +1,14 @@ +import { ContextMenuCommandBuilder } from '@discordjs/builders'; + +let commandID = 'messageContextMenu'; +export default { + id: commandID, + type: 'contextMenu', + disabled: false, + data: new ContextMenuCommandBuilder() + .setName('test') + .setType(3), + async execute(client, interaction) { + interaction.reply('Hello World!'); + } +}; \ No newline at end of file diff --git a/src/interactions/buttons/test.js b/src/interactions/modal.js similarity index 76% rename from src/interactions/buttons/test.js rename to src/interactions/modal.js index 4b6eb31..5df4f28 100644 --- a/src/interactions/buttons/test.js +++ b/src/interactions/modal.js @@ -1,5 +1,7 @@ export default { id: 'test', + type: 'modal', + disabled: false, async execute(client, interaction) { interaction.reply('Hello World!'); } diff --git a/src/interactions/channelSelectMenus/test.js b/src/interactions/roleSelectMenu.js similarity index 71% rename from src/interactions/channelSelectMenus/test.js rename to src/interactions/roleSelectMenu.js index 4b6eb31..324c5c3 100644 --- a/src/interactions/channelSelectMenus/test.js +++ b/src/interactions/roleSelectMenu.js @@ -1,5 +1,7 @@ export default { id: 'test', + type: 'roleSelectMenu', + disabled: false, async execute(client, interaction) { interaction.reply('Hello World!'); } diff --git a/src/interactions/roleSelectMenus/test.js b/src/interactions/roleSelectMenus/test.js deleted file mode 100644 index 4b6eb31..0000000 --- a/src/interactions/roleSelectMenus/test.js +++ /dev/null @@ -1,6 +0,0 @@ -export default { - id: 'test', - async execute(client, interaction) { - interaction.reply('Hello World!'); - } -}; \ No newline at end of file diff --git a/src/interactions/selectMenus/test.js b/src/interactions/selectMenus/test.js deleted file mode 100644 index 4b6eb31..0000000 --- a/src/interactions/selectMenus/test.js +++ /dev/null @@ -1,6 +0,0 @@ -export default { - id: 'test', - async execute(client, interaction) { - interaction.reply('Hello World!'); - } -}; \ No newline at end of file diff --git a/src/interactions/slashCommands/eval.js b/src/interactions/slashCommands/eval.js index 7821d12..1ef6c24 100644 --- a/src/interactions/slashCommands/eval.js +++ b/src/interactions/slashCommands/eval.js @@ -2,10 +2,14 @@ import { inspect } from 'util'; import { SlashCommandBuilder } from '@discordjs/builders'; import config from '../../data/config.js'; +let commandID = 'eval'; export default { + id: commandID, + type: 'slashCommand', + disabled: false, data: new SlashCommandBuilder() .addStringOption(option => option.setName('input').setDescription('The input to echo back')) - .setName('eval') + .setName(commandID) .setDescription('Evaluate code'), async execute(client, interaction) { try { diff --git a/src/interactions/slashCommands/helloWorld.js b/src/interactions/slashCommands/helloWorld.js index baaa9ab..eb84320 100644 --- a/src/interactions/slashCommands/helloWorld.js +++ b/src/interactions/slashCommands/helloWorld.js @@ -1,8 +1,12 @@ -import { SlashCommandBuilder } from '@discordjs/builders'; +import Discord from 'discord.js'; +let commandID = 'hello'; export default { - data: new SlashCommandBuilder() - .setName('hello') + id: commandID, + type: 'slashCommand', + disabled: false, + data: new Discord.SlashCommandBuilder() + .setName(commandID) .setDescription('Replies with Hello World!'), async execute(client, interaction) { interaction.reply('Hello World!'); diff --git a/src/interactions/slashCommands/ping.js b/src/interactions/slashCommands/ping.js index 6eafc82..9838e7c 100644 --- a/src/interactions/slashCommands/ping.js +++ b/src/interactions/slashCommands/ping.js @@ -1,8 +1,12 @@ import { SlashCommandBuilder } from '@discordjs/builders'; +let commandID = 'ping'; export default { + id: commandID, + type: 'slashCommand', + disabled: false, data: new SlashCommandBuilder() - .setName('ping') + .setName(commandID) .setDescription('Ping!'), async execute(client, interaction) { interaction.reply('Pong!'); diff --git a/src/interactions/slashCommands/reload.js b/src/interactions/slashCommands/reload.js index 227ecf0..81a8a8e 100644 --- a/src/interactions/slashCommands/reload.js +++ b/src/interactions/slashCommands/reload.js @@ -2,40 +2,30 @@ import config from '../../data/config.js'; import { SlashCommandBuilder, EmbedBuilder } from '@discordjs/builders'; import chalk from 'chalk'; -import buttonHandler from '../../handlers/buttons.js'; -import contextMenusHandler from '../../handlers/contextMenus.js'; -import messageCommandsHandler from '../../handlers/messageCommands.js'; -import modalsHandler from '../../handlers/modals.js'; -import selectMenusHandler from '../../handlers/selectMenus.js'; -import slashCommandsHandler from '../../handlers/slashCommands.js'; +import loadEvents from '../../handlers/events.js'; +import loadInteractions from '../../handlers/handler.js'; +import registerApplicationCommands from '../../handlers/application.js'; +let commandID = 'reload'; export default { + id: commandID, + type: 'slashCommand', + disabled: false, data: new SlashCommandBuilder() - .setName('reload') + .setName(commandID) .setDescription('Reloads all commands'), async execute(client, interaction) { if (!interaction.member.id == config.bot.owner) return interaction.reply('You do not have the permission to use this command!'); - console.log(chalk.red('[RELOAD] ') + chalk.yellow('Started reloading everything!')); + console.log(chalk.red('[RELOAD] ') + chalk.yellow('Reloading...')); + + await loadEvents(client); + await loadInteractions('./src/interactions', client); + await registerApplicationCommands(client); - let buttons = await buttonHandler.loadButtons(client); - let contextMenus = await contextMenusHandler.loadContextMenus(client); - let messageCommands = await messageCommandsHandler.loadMessageCommands(client); - let modals = await modalsHandler.loadModals(client); - let selectMenus = await selectMenusHandler.loadSelectMenus(client); - let slashCommands = await slashCommandsHandler.loadSlashCommands(client); let embed = new EmbedBuilder(); embed.setTitle('Successfully reloaded!'); - embed.addFields( - { name: 'Slash Commands', value: `${slashCommands}`, inline: true }, - { name: 'Message Commands', value: `${messageCommands}`, inline: true }, - { name: 'Buttons', value: `${buttons}`, inline: true }, - { name: 'Select Menus', value: `${selectMenus}`, inline: true }, - { name: 'Context Menus', value: `${contextMenus}`, inline: true }, - { name: 'Modals', value: `${modals}`, inline: true }, - ); - await interaction.reply({ embeds: [embed] }); } }; \ No newline at end of file diff --git a/src/interactions/stringSelectMenu.js b/src/interactions/stringSelectMenu.js new file mode 100644 index 0000000..7986ab9 --- /dev/null +++ b/src/interactions/stringSelectMenu.js @@ -0,0 +1,8 @@ +export default { + id: 'stringSelectMenu', + type: 'stringSelectMenu', + disabled: false, + async execute(client, interaction) { + interaction.reply('Hello World!'); + } +}; \ No newline at end of file diff --git a/src/interactions/stringSelectMenus/test.js b/src/interactions/stringSelectMenus/test.js deleted file mode 100644 index 4b6eb31..0000000 --- a/src/interactions/stringSelectMenus/test.js +++ /dev/null @@ -1,6 +0,0 @@ -export default { - id: 'test', - async execute(client, interaction) { - interaction.reply('Hello World!'); - } -}; \ No newline at end of file diff --git a/src/interactions/contextMenus/test.js b/src/interactions/userContextMenus.js similarity index 74% rename from src/interactions/contextMenus/test.js rename to src/interactions/userContextMenus.js index 654263b..4b15f6a 100644 --- a/src/interactions/contextMenus/test.js +++ b/src/interactions/userContextMenus.js @@ -1,6 +1,10 @@ import { ContextMenuCommandBuilder } from '@discordjs/builders'; +let commandID = 'test'; export default { + id: commandID, + type: 'contextMenu', + disabled: false, data: new ContextMenuCommandBuilder() .setName('test') .setType(2), diff --git a/src/interactions/modals/text.js b/src/interactions/userSelectMenu.js similarity index 71% rename from src/interactions/modals/text.js rename to src/interactions/userSelectMenu.js index 4b6eb31..c8f5760 100644 --- a/src/interactions/modals/text.js +++ b/src/interactions/userSelectMenu.js @@ -1,5 +1,7 @@ export default { id: 'test', + type: 'userSelectMenu', + disabled: false, async execute(client, interaction) { interaction.reply('Hello World!'); } diff --git a/src/interactions/userSelectMenus/test.js b/src/interactions/userSelectMenus/test.js deleted file mode 100644 index 4b6eb31..0000000 --- a/src/interactions/userSelectMenus/test.js +++ /dev/null @@ -1,6 +0,0 @@ -export default { - id: 'test', - async execute(client, interaction) { - interaction.reply('Hello World!'); - } -}; \ No newline at end of file