Issue with Modals

I get this error when submitting the modal and nothing comes up in console. I'm using a collector and it just isn't collecting?
15 Replies
d.js docs
d.js docs3y ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
monbrey
monbrey3y ago
You need to respond to the modal interaction for it to submit successfully
d.js docs
d.js docs3y ago
guide Interactions: Receiving modal submissions read more
larkx
larkxOP3y ago
So you can't use collectors?
monbrey
monbrey3y ago
You can, if you collect and respond to it
larkx
larkxOP3y ago
So you have to use an event to respond to it, and then the collector will collect
monbrey
monbrey3y ago
I've got an update to that page pending which will include more info than that uhhhh no, you dont do both
await interaction.showModal(modal)
const submission = await interaction.awaitModalSubmit({ time: 60000 });
submission.reply("Submission received");
await interaction.showModal(modal)
const submission = await interaction.awaitModalSubmit({ time: 60000 });
submission.reply("Submission received");
Something like that works
larkx
larkxOP3y ago
Cool, thank you. That also saves a lot of space compared to a messageComponentCollector
monbrey
monbrey3y ago
Modals also arent message components so that wouldnt have worked
larkx
larkxOP3y ago
How would you parse data from the submission variable?
monbrey
monbrey3y ago
submission.options.getTextInputValue("custom id here")
larkx
larkxOP3y ago
Thank you I'm getting
Cannot read properties of undefined (reading 'getTextInputValue')
Cannot read properties of undefined (reading 'getTextInputValue')
monbrey
monbrey3y ago
oh my bad fields, not options
larkx
larkxOP3y ago
Okay, so i want to then edit the initial reply it sends however it says that the interaction has not been sent or deferred when I try use "submission.editReply"
d.js docs
d.js docs3y ago
Documentation suggestion for @larkx:method ModalSubmitInteraction#update() Updates the original message of the component on which the interaction was received on.
Want results from more Discord servers?
Add your server