Modal not opening

is there something wrong with my code? whenever i try to run the command it tells me "The application did not respond" here is the bot code:
6 Replies
d.js toolkit
d.js toolkit4mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - 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 staff
Byby
Byby4mo ago
const { ActionRowBuilder, ModalBuilder, TextInputBuilder, TextInputStyle, SlashCommandBuilder} = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('setup')
.setDescription('Sends the Embed'),

run: async ({ interaction }) => {
const modal = new ModalBuilder({
customId: `mymodal-${interaction.user.id}`,
title: 'creating the embed'
});

const embedtitle = new TextInputBuilder({
customId: 'embedtitle',
label: 'embed title',
style: TextInputStyle.Short,
});

const embeddescription = new TextInputBuilder({
customId: 'embeddescription',
label: 'embed description',
style: TextInputStyle.Paragraph,
});

const embedcolor = new TextInputBuilder({
customId: 'embedcolor',
label: 'embed color',
style: TextInputStyle.Short,
});

const embedverifybuttontext = new TextInputBuilder({
customId: 'embedverifybuttontext',
label: 'embed verify button text',
style: TextInputStyle.Short,
});

const embedhelpbuttontext = new TextInputBuilder({
customId: 'embedhelpbuttontext',
label: 'embed help button text',
style: TextInputStyle.Short,
});

const firstActionRow = new ActionRowBuilder().addComponents(embedtitle);
const secondActionRow = new ActionRowBuilder().addComponents(embeddescription);
const thirdActionRow = new ActionRowBuilder().addComponents(embedcolor);
const { ActionRowBuilder, ModalBuilder, TextInputBuilder, TextInputStyle, SlashCommandBuilder} = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('setup')
.setDescription('Sends the Embed'),

run: async ({ interaction }) => {
const modal = new ModalBuilder({
customId: `mymodal-${interaction.user.id}`,
title: 'creating the embed'
});

const embedtitle = new TextInputBuilder({
customId: 'embedtitle',
label: 'embed title',
style: TextInputStyle.Short,
});

const embeddescription = new TextInputBuilder({
customId: 'embeddescription',
label: 'embed description',
style: TextInputStyle.Paragraph,
});

const embedcolor = new TextInputBuilder({
customId: 'embedcolor',
label: 'embed color',
style: TextInputStyle.Short,
});

const embedverifybuttontext = new TextInputBuilder({
customId: 'embedverifybuttontext',
label: 'embed verify button text',
style: TextInputStyle.Short,
});

const embedhelpbuttontext = new TextInputBuilder({
customId: 'embedhelpbuttontext',
label: 'embed help button text',
style: TextInputStyle.Short,
});

const firstActionRow = new ActionRowBuilder().addComponents(embedtitle);
const secondActionRow = new ActionRowBuilder().addComponents(embeddescription);
const thirdActionRow = new ActionRowBuilder().addComponents(embedcolor);
const fourthActionRow = new ActionRowBuilder().addComponents(embedverifybuttontext);
const fifthActionRow = new ActionRowBuilder().addComponents(embedhelpbuttontext);

modal.addComponents(firstActionRow, secondActionRow, thirdActionRow, fourthActionRow, fifthActionRow);

await interaction.showModal(modal);
},
}
const fourthActionRow = new ActionRowBuilder().addComponents(embedverifybuttontext);
const fifthActionRow = new ActionRowBuilder().addComponents(embedhelpbuttontext);

modal.addComponents(firstActionRow, secondActionRow, thirdActionRow, fourthActionRow, fifthActionRow);

await interaction.showModal(modal);
},
}
d.js docs
d.js docs4mo ago
Tag suggestion for @Byby: 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
Byby
Byby4mo ago
i dont think i did it right
await interaction.showModal(modal);
console.log
await interaction.showModal(modal);
console.log
. I dont know js that good, as im following a tutorial. I only know the basics
chewie 🌈
chewie 🌈4mo ago
You don't seem to know the basics if you don't know how to place console.log's throughout your code. Please brush up on your fundamentals before continuing with discord.js #resources #rules 3
Byby
Byby4mo ago
thanks ig:FeelsBadMan: