Repeating interaction

Is there a way to use the 'interaction.update' multiple times? So i can make like one button after another :peepoThink: Struggling to do so.
19 Replies
d.js toolkit
d.js toolkit7mo 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!
sraech
sraechOP7mo ago
version is 14.11.0 apparently :PauseFish: wait what :catHUH: it just works the await was missing all the time, and that's why it failed probably EDIT: It does work for some parts, but not for others
sraech
sraechOP7mo ago
:peepoThink:
No description
duck
duck7mo ago
Show your code!
sraech
sraechOP7mo ago
:duckOhNo: it's really just a big mess
sraech
sraechOP7mo ago
No description
sraech
sraechOP7mo ago
basically, i change the state on every button press and then it updates the message and buttons
sraech
sraechOP7mo ago
here the part, where the reply.edit is, where i would rather have an update :peepoThink:
No description
duck
duck7mo ago
well your error would come from responding to an interaction multiple times, not where you call <Message>.edit() based on your previous question, my hunch was that you were attempting to use interaction.update() on the same interaction multiple times rather than responding to each interaction, but that doesn't seem to be the case assuming you aren't responding the the interactions in any util functions like nextInputState or something, this code on its own isn't attempting to respond to an interaction multiple times but if for example this collector was created on the channel rather than on a message, it could be handling interactions you didn't intend for it to handle
sraech
sraechOP7mo ago
the reply.edit() would normally be the interaction.update, which did throw the error
duck
duck7mo ago
yes, that would be an issue, I was just being verbose in checking off boxes for this issue
sraech
sraechOP7mo ago
i understand the error, but do not understand that i was able to use interaction.update multiple times here
duck
duck7mo ago
well with the logic of the code, only one interaction.update() is being called per interaction because of your switch case and breaks
sraech
sraechOP7mo ago
:duckOhNo: now i understand i'm always getting a new interaction
duck
duck7mo ago
yes
sraech
sraechOP7mo ago
thank you very much, that clears up alot i dont know how i could miss that :Lol: have a nice day :peepoSitLove: :SCagreed: i was updating the interaction while also answering with a modal, this probably gave the 'is already updated'
duck
duck7mo ago
that'd definitely do it you can use editReply after showing a modal, but update and showModal can both only be used as the initial response
sraech
sraechOP7mo ago
good stuff, thank you very much again :borpaPrayge: follow up question after the modal, i continue with buttons :peepoThink: currently i have a deferUpdate on the modal and a edit.Reply so that I can more interactions from the same reply does that make sense to do it like that
duck
duck7mo ago
you can setup user input however you like update can also edit in more components, but if you need to defer, you can defer
Want results from more Discord servers?
Add your server