#TypeError ModalBuilder is not a constructor

17 messages · Page 1 of 1 (latest)

violet forum
#

Same error in v13 with Modal(), it says Modal is not a constructor, but i already imported it with discord js

#

const modal = new Modal()
.setCustomId('myModal')
.setTitle('My Modal');

wind tartan
violet forum
#

"discord.js": "^13.1.0",

#

thats what my packege says

#

ill update real quick maybe then it will work

wind tartan
#

Modals are not in that version. You're just using an outdated version

wind tartan
violet forum
#

any other sythax on that version

wind tartan
#

For what?

violet forum
#

like any code i need to edit to make it work on the newer version

steady topaz
#

I have error while try to show modal , the code

const { MessageActionRow,MessageSelectMenu,MessageEmbed,MessageButton,ActionRowBuilder, ModalBuilder, TextInputBuilder, TextInputStyle} = require('discord.js');

module.exports = {
    name: "report",
    description: "Report info",
    run: async (client, interaction, args) => { 
        const modal = new ModalBuilder()
            .setCustomId('submodal')
            .setTitle('Report to us');
        const ReportModal = new TextInputBuilder()
            .setCustomId('repMod')
            .setLabel("What do you wanna report to us")
            .setStyle(TextInputStyle.Short);

        const InfoModal = new TextInputBuilder()
            .setCustomId('infoMod')
            .setLabel("Please give us more information")
            .setStyle(TextInputStyle.Paragraph);

        const firstActionRow = new ActionRowBuilder().addComponents([ReportModal]);
        const secondActionRow = new ActionRowBuilder().addComponents([InfoModal]);

        modal.addComponents([firstActionRow, secondActionRow]);

        await interaction.showModal(modal);
    }
}

And get error about TypeError: ModalBuilder is not a constructor

zenith monolith
#

You're using v14 code, but (according to your thread tag) you're running it on v13.9

steady topaz
#

Oh I use the v13.9 and get the code from doc, So i need to update to v14 right?

zenith monolith
#

You might as well since you already started updating some code

#

The updating guide is in the #djs-help-v14 channel topic

steady topaz
#

Thanks