#Modal not responding

11 messages · Page 1 of 1 (latest)

flint moon
#

My modals were working all night yesterday, but when I attempted to run the commands today I continuously got "Something went wrong try again later". After thinking it was the command I made a new one to test modal form configuration but no matter which way I make the modal form nothing worked, and I kept getting the error. I am getting no console errors and no rate limit errors.

ebon fiberBOT
#
  • What's your exact discord.js npm list discord.js and node node -v version?
  • Not a discord.js issue? Check out #1081585952654360687.
  • Consider reading #how-to-get-help to improve your question!
  • Explain what exactly your issue is.
  • Post the full error stack trace, not just the top part!
  • Show your code!
  • Issue solved? Press the button!
  • Marked as resolved by OP
minor frigateBOT
#

If you aren't getting any errors, try to place console.log checkpoints throughout your code to find out where execution stops.

  • Once you do, log relevant values and if-conditions
  • More sophisticated debugging methods are breakpoints and runtime inspections: learn more
earnest wolf
#

log if your event fires at all

flint moon
#

I have it set to log when it runs at all and its detecting the command running but its not detecting a submission because everytime I try it returns that error in discord

earnest wolf
#

show your code

flint moon
#
const { SlashCommandBuilder, ModalBuilder, TextInputBuilder, TextInputStyle, ActionRowBuilder} = require('discord.js');
module.exports = {
  data: new SlashCommandBuilder()
    .setName('modaltest')
    .setDescription('Displays a modal and replies with the modal input'),
  async execute(interaction) {
      console.log(`The /modaltest command was used by ${interaction.user.tag}.`);
      const modal = new ModalBuilder()
        .setCustomId('testModal')
        .setTitle('Test Modal');
      const textInput = new TextInputBuilder()
        .setCustomId('textInput')
        .setLabel('Enter some text')
        .setStyle(TextInputStyle.Short)
        .setPlaceholder('Type here...')
        .setRequired(true);
      modal.addComponents(new ActionRowBuilder().addComponents(textInput));
      await interaction.showModal(modal);
  },
  async handleModalSubmit(interaction) {
      console.log(`Modal submitted by ${interaction.user.tag}.`);
      const userInput = interaction.fields.getTextInputValue('textInput');
      await interaction.reply({ content: `You entered: ${userInput}`, ephemeral: true });
  }
};
earnest wolf
#

and where are you calling the second function?

#

you're also better off using collectors

flint moon
#

Ok using collectors fixed this 😭 thanks

#

I havent touched djs since 12 so I am slowly learning