InteractionResponse#awaitMessageComponent is not working with modal

https://gist.github.com/danthonywalker/c369f391b8524388866ac9a74f4e9e44 So the flow goes like this 1) showQuestionModal is called, which displays the modal and handles submission logic 2) let response = modalInteraction.reply is called, which contains buttons 3) response.awaitMessageComponent never calls into the filter After a bit of debugging I have found that in the collect function of InteractionCollector the following condition always fails:
this.messageInteractionId &&
interaction.message?.interaction?.id &&
interaction.message.interaction.id !== this.messageInteractionId
this.messageInteractionId &&
interaction.message?.interaction?.id &&
interaction.message.interaction.id !== this.messageInteractionId
let response = modalInteraction.reply returns a different interaction ID, than the one interaction.message?.interaction?.id is returning. Particularly, interaction.message?.interaction?.id is returning the interaction ID of my original slash command and not the modal interaction ID.
5 Replies
d.js toolkit
d.js toolkit16mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - 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!
d.js docs
d.js docs16mo ago
method ChatInputCommandInteraction#awaitModalSubmit() Collects a single modal submit interaction that passes the filter. The Promise will reject if the time expires.
Dannie
DannieOP16mo ago
My issue isn't the modal submit.. I can read from the modal submit just fine, it's after the submission and I reply to it with a message containing buttons that I cannot use awaitMessageComponents on it Yeah I was just about to try that It was doing it for both ephemeral or not If the InteractionResponse came from a reply on a ModalSubmitInteraction then interaction.message?.interaction?.id in the collector will point to the original interaction that triggered the modal. In my case that is a slash command Noted Seems fetchReply will be the safer bet for modals in this case, thanks, I'll try it Okay, that works, thank you. One question though, on a ModalSubmitInteraction, how can I respond to the modal without creating a whole new message? My first instinct is just to deferReply and delete it immediately and just edit the original message, but that seems really jank update doesn't exist on a ModalSubmitInteraction type
Dannie
DannieOP16mo ago
ah, thank you, again
Want results from more Discord servers?
Add your server