From b5d5ca1fe68999aacbddf8e7eb3d1e5184fd8dd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Tue, 31 Aug 2021 10:47:39 +0300 Subject: [PATCH] Updated interactionCreate event --- src/client/events/interactionCreate.js | 34 +++++++++++++++++++------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/src/client/events/interactionCreate.js b/src/client/events/interactionCreate.js index 628935b..094f910 100644 --- a/src/client/events/interactionCreate.js +++ b/src/client/events/interactionCreate.js @@ -3,19 +3,35 @@ import Discord from "discord.js"; module.exports = { name: 'interactionCreate', async execute(client, interaction) { - if (!interaction.isCommand()) return; + /*if (!interaction.isCommand()) return;*/ - const commandName = interaction.commandName; - const command = client.commands.get(commandName); - if (!command) return; const permissions = interaction.channel.permissionsFor(interaction.client.user); if (!permissions.has('EMBED_LINKS')) return interaction.send(client.messages.noPermsEmbed); - try { - command.execute(interaction, client, Discord, command); - } catch (error) { - interaction.reply(client.messages.runningCommandFailed); - console.error(error); + if(interaction.isCommand()){ + const commandName = interaction.commandName; + const command = client.commands.get(commandName); + if (!command) return; + + try { + command.execute(interaction, client, Discord, command); + } catch (error) { + interaction.reply(client.messages.runningCommandFailed); + console.error(error); + } + } else if (interaction.isSelectMenu()){ + + } else if (interaction.isButton()){ + const commandName = interaction.customId; + const command = client.commands.get(commandName); + if (!command) return; + + try { + command.execute(interaction, client, Discord, command); + } catch (error) { + interaction.reply(client.messages.runningCommandFailed); + console.error(error); + } } } }