User click on a button to open a modal, everything is fine if the user just submit. However, if the user close the modal, and open it again later on to submit, now awaitModalSubmit is trigger twice.
this is what I have to get the modal submit
const submitted = await i.awaitModalSubmit({ time: 1000 * 60 * 10 });
if (submitted) {
await submitted.deferReply();
// post data to external api
}
This cause two errors, the interaction will already be acknowledges after the first time, and data is posted to external api multiple times (based on how many times user has open and close the modal).
How could I avoid this? Thanks!