#Collectors crashing bot

7 messages · Page 1 of 1 (latest)

vagrant zodiac
#
 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:

  1. click on button (modal shows up)
  2. cancel modal
  3. click on button again (modal shows up)
  4. 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
left fiberBOT
#
  • What's your exact discord.js npm list discord.js and node node -v version?
  • Not a discord.js issue? Check out #1081585952654360687.
  • Consider reading #how-to-get-help to improve your question!
  • Explain what exactly your issue is.
  • Post the full error stack trace, not just the top part!
  • Show your code!
  • Issue solved? Press the button!
  • Marked as resolved by staff
vagrant zodiac
#

The filter for the collector is set to the message id, so when someone uses it twice, both collectors fire. Is there any solution possible?

chrome torrent
#

Filter on the modals custom id, and make it unique each time the modal opens

chrome torrent
#

Easiest way to do that is just to include the button interaction id in the modal custom id

vagrant zodiac
#

I see, wow, thank you, trying now.