I have a small problem that I can’t solve with discord JS. In fact, my command will generate an embed with a button, and when I click on this button it opens a form for me. Except that there is a problem when the user opens the form, closes it without entering any data, reopens it and submits data.
Is there any way to resolve this?
const response = await interaction.reply({embeds : [embedMessage], components : [row]})
let collector = response.createMessageComponentCollector({time: 600000});
const myfilter = (i : ModalSubmitInteraction) => i.customId === 'motdleGame' && i.user.id === interaction.user.id;
collector.on('collect', async (i) => {
if(i.member?.user.id !== interaction.member?.user.id) return;
if(i.customId !== "play") return
await i.showModal(modal)
let submitted = await i.awaitModalSubmit({time: 300000, filter : myfilter}).catch(() => {return null});
if(submitted && submitted?.isModalSubmit()){
let inputWord = submitted.fields.getTextInputValue("wordInput").toUpperCase()
await submitted.reply("-------")
game.addToHistory(inputWord)
for(let word of game.getHistoryLetters()) await i.channel?.send(word)
if(inputWord == word){
collector.stop()
}
}
})
I tried to put a uuid in the interaction id to separate them but that didn’t change the problem at all.