Discord v14.8.0 Modal Submit not working.

Node version:
v18.12.1


Current dependencies are as follows:

"dependencies": {
        "captcha-canvas": "^3.2.1",
        "discord.js": "^14.8.0",
        "dotenv": "^16.0.3"
      }


Slash command that creates an embed with a button to display a modal. The modal submit has the bot not responding at all.

const { CaptchaGenerator } = require('captcha-canvas');
const { ActionRowBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder,  AttachmentBuilder, ModalBuilder, TextInputBuilder} = require('discord.js');
const array = [];

module.exports = {
  name: 'verify',
  description: 'Verify that you are not a bot',
  devOnly: true,
  testOnly: true,

  callback: async (client, interaction) =>{
    const captcha = new CaptchaGenerator()
            .setDimension(150, 600)
            .setCaptcha({size: 60, characters: 10})
            .setDecoy({ opacity: 1, size: 40 })
            .setTrace()

    const buffer = captcha.generateSync();

    const verifyAttachment = new AttachmentBuilder(buffer, { name: 'captcha.png'});

    
    const embed = new EmbedBuilder()
      .setTitle('Keyed Chaos Captcha')
      .setDescription('Please complete the captcha!')
      .setImage('attachment://captcha.png')

    console.log(`Example captcha text:${captcha.text}\n`);
    
    const target = interaction.user.id;

    let checkmk = new ButtonBuilder()
          .setCustomId('answer')
          .setLabel('Answer Captcha')
          .setStyle(ButtonStyle.Success);

    const row = new ActionRowBuilder()
          .addComponents(checkmk);
  
    
    
    response = await interaction.reply({
      embeds:[embed], 
      files: [verifyAttachment], 
      components: [row], 
      ephemeral: true});
      
    const filter = (interaction) => interaction.customId === 'answer';
    response.awaitMessageComponent({filter, time: 15_000})
    .then(interaction => {
      console.log(`${interaction.customId} was clicked!`)
      const modal = new ModalBuilder()
      .setCustomId('verification')
      .setTitle('Keyed Chaos Verification')
      .addComponents([
        new ActionRowBuilder().addComponents(
          new TextInputBuilder()
          .setCustomId('verification-answer')
          .setLabel('Answer')
          .setStyle(2)
          .setMaxLength(10)
          .setRequired(true),
        ),
      ]);
      interaction.showModal(modal);
      
     client.on(Event.InteractionCreate, async interaction =>{
      if(!interaction.isModalSubmit()) return;

      if(interaction.customId === 'verification'){
        const modalAnswer = interaction.fields.getTextInputValue('verification-answer');
        await interaction.ModalSubmitInteraction(console.log(`Answer: ${modalAnswer}\n`))
      }


    })
    .catch(console.error);

    },
  }
}
Was this page helpful?