Disabling Buttons on new Components V2
I need some help I am currently work with v2 components mostly containers and I have action rows / buttons which need to be disabled on click but now I always need to remake the full container to do that is there any better way ?
12 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 OPI've posted in another thread, but this is my implementation to disable all buttons in container:
you can encapsulate this in a function like
disableButtons(interaction, container)
if you have more complex responses (such with more than one container), you'll need to update the code, but I think this is a nice start
@Asbronyeah I used this but in a ticket system kind getting complex
let me try
finding buttons/selectmenu
on find
all my buttons are dynamic
and some have near same names
nvm
ig
got it
I see. My implementation only considers buttons inside sections as Accessories. That's the only way that I use them right now
yeah but can be used like that to get Action row
and disabling a particular button
you can also set your ButtonBuilder to a const and rebuild all the container (but now, the button will be disabled)
I think that use .find to find the row and then .find to find the button a little over processing, using two array methods, no?
depending on the complexity of container and size of array
@Qjuh do you mean something like this ?
you use setInterval to set a time limit to user respond to the buttons?
nope there is 10 sec cooldown
down* on claim button
undestood
then I need to disable the claim button when it get clicked again if unclaim it need get enabled
ah I see
what should be the type
š«¤
both works just need it to be disable
let me try
@Qjuh any idea ?
(parameter) c: any
getting into 2nd find
ig
this
oh yea
nvm its not letting me to do
