Ā© 2026 Hedgehog Software, LLC
submit
@discordjs/builders: 1.8.2
discord.js: 14.15.3
// modal.js 'use strict'; import { SlashCommandBuilder, ActionRowBuilder, ModalBuilder, TextInputBuilder } from '@discordjs/builders'; import { PermissionFlagsBits, TextInputStyle } from 'discord.js'; export default { data: new SlashCommandBuilder() .setName('modal') .setDescription('test modal') .setDefaultMemberPermissions(PermissionFlagsBits.UseApplicationCommands), /** * @param {import('discord.js').Client} client * @param {import('discord.js').Interaction} interaction */ async execute(client, interaction) { const modal = new ModalBuilder().setCustomId('myModal').setTitle('My Modal'); const favoriteColorInput = new TextInputBuilder() .setCustomId('favoriteColorInput') .setLabel("What's your favorite color?") .setStyle(TextInputStyle.Short); const hobbiesInput = new TextInputBuilder() .setCustomId('hobbiesInput') .setLabel("What's some of your favorite hobbies?") .setStyle(TextInputStyle.Paragraph); const firstActionRow = new ActionRowBuilder().addComponents(favoriteColorInput); const secondActionRow = new ActionRowBuilder().addComponents(hobbiesInput); modal.addComponents(firstActionRow, secondActionRow); await interaction.showModal(modal); }, /** * @param {import('discord.js').Client} client * @param {import('discord.js').Interaction} interaction */ async submit(client, interaction) { console.log('modalSubmit'); }, };