bot.on('interactionCreate', async interaction => { if (!interaction.isCommand()) return if(interaction.isModalSubmit()) { if(interaction.customId === 'loa') { const name = interaction.fields.getTextInputValue('nameInput'); const reason = interaction.fields.getTextInputValue('reasonInput'); const embed = new EmbedMe() .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) interaction.reply({ content: 'Leave of absence request submitted.', ephemeral: true }) 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) })