#problems submitting modals

1 messages · Page 1 of 1 (latest)

naive spindle
#
const { ModalBuilder, TextInputBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, PermissionsBitField, TextInputStyle } = require("discord.js");
const Fighter = require(`../../schemas/users`);
const mongoose = require('mongoose');

module.exports = {
    data: {
        name: 'randomOne'
    },
    async execute(interaction, client) {
    
        const modal = new ModalBuilder()
            .setCustomId("registerOne")
            .setTitle("Register Yourself");
    
        const textInput = new TextInputBuilder()
            .setCustomId("in-game-name")
            .setLabel("In-Game Name")
            .setPlaceholder("Enter your in-game name")
            .setRequired(true)
            .setStyle(TextInputStyle.Short);
    
        const one = new ActionRowBuilder().addComponents(textInput);
    
        modal.addComponents(one, two, three);
    
        await interaction.showModal(modal);
    
        interaction.client.on("modalResponse", async (modalInteraction) => {
            if (modalInteraction.customId === "registerOne") {
                const inGameName = modalInteraction.fields.getTextInputValue("in-game-name");
            
                await interaction.followUp({
                    content: `Your In-Game Name: ${inGameName}`,
                    ephemeral: true
                });
            }
        });
    },
};

when i fill my details in the modal, it says something went wrong...

drowsy arrowBOT
olive cosmos
#

Or use interaction.awaitModalSubmit(), which does the event listening for you.

drowsy arrowBOT
naive spindle
#

ok i will try

olive cosmos