Cannot edit interaction after modal input
Ok so here is my problem, I want to achieve something like so:
Step 1: send interaction with button
Step 2: user clicks button
Step 3: modal shows and user enters stuff
Step 4: after submit edit the original interaction
Problem is, editReply() and updateMessage() doesn't let me do that (replying to the modal works) and discord api returns with a "Unknown Webhook" error:
Is there a way to achieve step 4 as defined?
23 Replies
- 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!
- β
Marked as resolved by OPthere is definitely a way to do what you want, but show your code
what is your approach at the moment
so first i had this for the button
then my approach for step 4
the code fails at editReply or updateMessage (they produce the same outcome)
why are you using api
are you even using discord.js structures?
bro idk it works ig
i just used the example from the docs (@discordjs)
https://discord.js.org/docs/packages/core/main
discord.js
discord.js
discord.js is a powerful Node.js module that allows you to interact with the Discord API very easily. It takes a much more object-oriented approach than most other JS Discord libraries, making your bot's code significantly tidier and easier to comprehend.
ah you are using core
im not sure what you mean
yes
i used the @discordjs mainly cause the code looks better
well i dont really use core so i dont really know how to help
sorry about that
i see
how would you do it normally tho
cause v14 -> core is easily translatable
with an awaitModalSubmition
ah i see
once you receive the modal you proceed to update the message
ah
alright thank you for that
ill see if i can find a solution
but also i think the error suggests that the interaction token expired... which interaction are you trying to update? and how long is it taking?
relatively 2s ish
what i was trying to do was just do 4 api requests to a game server then respond accordingly
normal reply works and it goes out just fine so it rules out token expiration
so in which step of the execution is this failing?
the editReply() which i think is because the interaction object is not the message but the modal interaction
i see my mistake. but then my issue at the core is to update the message that the modal is triggered on, which i'm unable to
sorry so do you mean the code that triggers the modal?
oh wait i also had a mistake with my explanation earlier
updateMessage() does the same thing as reply()
theres only one difference that is discord app says that it replies to the command for updateMessage() and replies to (previous) message for reply()
but yeah none of them do the thing i wanted it to do (which is to update the original message)
yeah thats what i thought as well but here was what happened
so that button triggers the modal then the user enters stuff and updateMessage() created the second message as you can see
so basically i use followUp() instead?
the important stuff is at the end
i see, so what should i do?
no thats where i handled the submission
this is the modal sending part
oh wait that was supposd to be updateMessage i changed that to uh test some stuff
but same thing happens anyway
alright wait a min
Ok im sorry again for my mistake earlier updateMessage does work but in a very weird way so I'm not really sure what is happening
so basically when I use UpdateMessage it does work. Once. afterwards if i do the same thing, it will give me a "Invalid Form Body" error.
i removed all the code thats making requests and just sent the embed with the selector on its own to see if the wait to request stuff is causing issues but the same thing happened.
here, sorry for wait
oh so what i do is i first do a let selectActionRow then i do whatever with it?
but then i cant modify a const....
OH RIGHT
omg i did not realise that
im so sorry
in the end it was some problems with the classes for embeds i was using
as well as that so thank u very much