Broken modals

sometimes my modals are broken idk why sometimes some text inputs doesn't show up
11 Replies
fenish
fenish14mo ago
public async createTask(interaction: Subcommand.ChatInputCommandInteraction) {
const modal = new ModalBuilder()
.setCustomId("CreateTaskModal")
.setTitle("Create Task");

const embedColorInput = new TextInputBuilder()
.setCustomId("embedColor")
.setLabel("Set the color of the embed")
.setPlaceholder("#C4F94B")
.setStyle(TextInputStyle.Short)
.setValue("#C4F94B")
.setRequired(true);

const embedThumbnailInput = new TextInputBuilder()
.setCustomId("embedThumbnail")
.setLabel("Thumbnail of the embed")
.setPlaceholder("https://i.imgur.com/IlweEFM.gif")
.setStyle(TextInputStyle.Short)
.setRequired(false);

const pointInput = new TextInputBuilder()
.setCustomId("taskPoint")
.setLabel("Set the point value of the task")
.setPlaceholder("10")
.setValue("10")
.setStyle(TextInputStyle.Short)
.setRequired(true);

const taskDescriptionInput = new TextInputBuilder()
.setCustomId("taskDescription")
.setLabel("Set the description of the task")
.setPlaceholder("Here is your description")
.setStyle(TextInputStyle.Paragraph)
.setRequired(true);

const rows = [
new ActionRowBuilder<ModalActionRowComponentBuilder>().addComponents(
taskDescriptionInput
),
new ActionRowBuilder<ModalActionRowComponentBuilder>().addComponents(
embedThumbnailInput
),
new ActionRowBuilder<ModalActionRowComponentBuilder>().addComponents(
pointInput
),
new ActionRowBuilder<ModalActionRowComponentBuilder>().addComponents(
embedColorInput
),
];

modal.addComponents(rows);
await interaction.showModal(modal);
public async createTask(interaction: Subcommand.ChatInputCommandInteraction) {
const modal = new ModalBuilder()
.setCustomId("CreateTaskModal")
.setTitle("Create Task");

const embedColorInput = new TextInputBuilder()
.setCustomId("embedColor")
.setLabel("Set the color of the embed")
.setPlaceholder("#C4F94B")
.setStyle(TextInputStyle.Short)
.setValue("#C4F94B")
.setRequired(true);

const embedThumbnailInput = new TextInputBuilder()
.setCustomId("embedThumbnail")
.setLabel("Thumbnail of the embed")
.setPlaceholder("https://i.imgur.com/IlweEFM.gif")
.setStyle(TextInputStyle.Short)
.setRequired(false);

const pointInput = new TextInputBuilder()
.setCustomId("taskPoint")
.setLabel("Set the point value of the task")
.setPlaceholder("10")
.setValue("10")
.setStyle(TextInputStyle.Short)
.setRequired(true);

const taskDescriptionInput = new TextInputBuilder()
.setCustomId("taskDescription")
.setLabel("Set the description of the task")
.setPlaceholder("Here is your description")
.setStyle(TextInputStyle.Paragraph)
.setRequired(true);

const rows = [
new ActionRowBuilder<ModalActionRowComponentBuilder>().addComponents(
taskDescriptionInput
),
new ActionRowBuilder<ModalActionRowComponentBuilder>().addComponents(
embedThumbnailInput
),
new ActionRowBuilder<ModalActionRowComponentBuilder>().addComponents(
pointInput
),
new ActionRowBuilder<ModalActionRowComponentBuilder>().addComponents(
embedColorInput
),
];

modal.addComponents(rows);
await interaction.showModal(modal);
Favna
Favna14mo ago
Code looks... Fine.. I think.
fenish
fenish14mo ago
i deleted app command from gui then recreated btw is this good code for writing modals
Favna
Favna14mo ago
At a glance, yes For @Dragonite 's eval (me only, don't bother trying to use it) I have this: https://github.com/favware/dragonite/blob/main/src/commands/Admin/eval.ts
fenish
fenish14mo ago
@Favna for example
fenish
fenish14mo ago
sometimes it becomes like this but there is nothing in my code like this
fenish
fenish14mo ago
sometimes this
fenish
fenish14mo ago
as you can see there is no point
fenish
fenish14mo ago
fenish
fenish14mo ago
should i defer or something else when i reply interaction because when i submit im not replying command im sending global text
Favna
Favna14mo ago
No ides Try asking in the djs server I guess They might know better This is after all not strictly sapphire related