ajzak
DIAdiscord.js - Imagine an app
•Created by ajzak on 4/8/2024 in #djs-questions
problem with modal
hello i have problem. when two people fill out the modal at the same time, it bugs out and throws an error in the console.
```async execute(interaction) {
if(interaction.customId === 'aplikujmod'){
const modal = new ModalBuilder()
.setCustomId('rekrumod'+interaction.user.id)
.setTitle('Formularz na Moderatora');
const imie = new TextInputBuilder()
.setCustomId('imie-'+interaction.user.id+'')
.setPlaceholder('Imię i nazwisko')
.setLabel("Imię i nazwisko")
.setRequired(true)
.setStyle(TextInputStyle.Short);
const doswiadczenie = new TextInputBuilder()
.setCustomId('doswiadczenie-'+interaction.user.id)
.setPlaceholder('Tak/Nie, jak tak to jakie?')
.setLabel("Czy masz doświadczenie w moderowaniu?")
.setRequired(true)
.setStyle(TextInputStyle.Short);
const imieRow = new ActionRowBuilder().addComponents(imie);
const doswiadczenieRow = new ActionRowBuilder().addComponents(doswiadczenie);
modal.addComponents(imieRow, doswiadczenieRow);
const filter = (interaction) => interaction.customId === 'rekrumod'+interaction.user.id;
interaction.showModal(modal);
interaction
.awaitModalSubmit({ filter, time: 1000_000})
.then(async (modalInteraction) => {
const imieText = modalInteraction.fields.getTextInputValue('imie-'+interaction.user.id+'');
const doswiadczenieText = modalInteraction.fields.getTextInputValue('doswiadczenie-'+interaction.user.id);
const embed = new EmbedBuilder()
.setTitle("Rekrutacja na Moderatora")
.setDescription('Aplikacja użytkownika: <@' + interaction.user.id + '>')
.addFields(fields but i delete it because too many characters
)
.setThumbnail("https://imgur.com/FCbVUO5.png")
.setFooter({
text: "E-Sport Szczytno",
iconURL: "https://imgur.com/
16 replies