await buttonInteraction.showModal(modal);
// Collect a modal submit interaction
const filter = (inter: ModalSubmitInteraction): boolean => inter.message!.id === buttonInteraction.message.id;
let modalSubmit: ModalSubmitInteraction;
try {
modalSubmit = await buttonInteraction.awaitModalSubmit({ filter, time: 30_000 });
}
catch (error) {
await buttonInteraction.followUp({ content :'You did not reply in time!', ephemeral : true });
return;
}
In this case when you:
- click on button (modal shows up)
- cancel modal
- click on button again (modal shows up)
- fill modal and submit
Handled error:
DiscordAPIError[10062]: Unknown interaction
0|index | at handleErrors (/Users/ayeman/Documents/GitHub/currency-bot/node_modules/@discordjs/rest/dist/index.js:687:13)
0|index | at processTicksAndRejections (node:internal/process/task_queues:96:5)
0|index | at async BurstHandler.runRequest (/Users/ayeman/Documents/GitHub/currency-bot/node_modules/@discordjs/rest/dist/index.js:786:23)
0|index | at async _REST.request (/Users/ayeman/Documents/GitHub/currency-bot/node_modules/@discordjs/rest/dist/index.js:1218:22)
unhandled error:
0|index | /Users/ayeman/Documents/GitHub/currency-bot/node_modules/@discordjs/rest/dist/index.js:687
0|index | throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData);
0|index | ^
0|index | DiscordAPIError[10008]: Unknown Message