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 docs2y 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
monbrey2y ago
You need to respond to the modal interaction for it to submit successfully
d.js docs
d.js docs2y ago
guide Interactions: Receiving modal submissions read more
larkx
larkx2y ago
So you can't use collectors?
monbrey
monbrey2y ago
You can, if you collect and respond to it
larkx
larkx2y ago
So you have to use an event to respond to it, and then the collector will collect
monbrey
monbrey2y 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
larkx2y ago
Cool, thank you. That also saves a lot of space compared to a messageComponentCollector
monbrey
monbrey2y ago
Modals also arent message components so that wouldnt have worked
larkx
larkx2y ago
How would you parse data from the submission variable?
monbrey
monbrey2y ago
submission.options.getTextInputValue("custom id here")
larkx
larkx2y ago
Thank you I'm getting
Cannot read properties of undefined (reading 'getTextInputValue')
Cannot read properties of undefined (reading 'getTextInputValue')
monbrey
monbrey2y ago
oh my bad fields, not options
larkx
larkx2y 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 docs2y ago
Documentation suggestion for @larkx:method ModalSubmitInteraction#update() Updates the original message of the component on which the interaction was received on.