Button Automatically Pressing
Hello! Im currently working on a bot using oauth2. Im in the middle of rewriting how i handle refreshing access tokens if they are invalid but ive stumbled on an issue. As you can see in the video attached i run my /dashboard command and then click Verify Tokens button that works fine but once the verification is complete (i have an invalid access token in my database on purpose for debuging) im given the option if i want to try refreshing the invalid tokens both button should currently just respond with a placeholder text but for some reason when the message is sent the Yes button pushes it self and says interaction failed.
Here is the code for the command: https://pastecode.io/s/om3zdqnv (Some functions are not being used as like i said im in the middle of rewriting it)
Huge thanks to anyone who even takes a look at this
13 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 OPmp4 video*
I think its a visual issue with the client owing to you editing the reply but not actually responding to the button interaction
reply.edit
on line 229 should really be interaction.update
:method: ButtonInteraction#update()
Updates the original message of the component on which the interaction was received on.
Not only in line 229. Everywhere where the interaction should be acknowledged
yeah, sorry I zero'd in on the reason it was happening in the video but yeah all instances of
reply.edit
should be fixedReplaced it everywhere though now i get an error about it
In the scope of
handleValidation
function interaction is your slash command interaction. Pass the button interaction to the functionby that you mean change
reply
to interaction
here?wait
huh
i kinda get it
but how do i pass the button interaction?
The only interaction for your
handleValidation
function is from execute parameter which is the slash command interaction. You need to pass the button interaction from the collector to your function argumentsSo if i understand do this?
so i did that and new error progress!
talks about line 202
i changed line 202 to and it works as it should now is there anything i should worry about with this aproach or should i just let it be?