bot.on('interactionCreate', async interaction => { if (!interaction.isCommand()) return if(interaction.customId === 'loa') { const name = interaction.fields.getTextInputValue('nameInput'); const reason = interaction.fields.getTextInputValue('reasonInput'); await interaction.showModal(modal) const embed = new Discord.MessageEmbed() .setTitle('Leave of Absence') .setDescription('**New Form Submitted**') .addField('Reason', '```' + reason + '```') // .addField('Length', '```' + interaction.values[1] + '```') .setFooter(`Submitted by ${name}`) .setTimestamp() .setColor(config.colors.main) const channel = await bot.channels.fetch('1028291276925325483') channel.send({ embeds: [embed] }) } const command = bot.commands.get(interaction.commandName) if (!command) return try { await command.execute(interaction) } catch (err) { console.error(err) await interaction.reply({ content: 'An error occured while executing this command', ephemeral: true }) } // console.log(interaction) })