Disable button on "end"
Heyo, I hope this is a quick one:
I have a leaderboard with a couple buttons for navigation and toggling some properties for that board. In order to change those properties I need to update the LB after each interaction, so it goes through an
interaction.on('collect', ...
to update meaning the buttons can't be in scope when it reaches the interaction.on('end', ...
block. What options do I have to disable the buttons when the interaction "expires" so users don't try to click the button of an expired message? (Perhaps a built in discordJS feature, or can I get and update the button using its ID?)4 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!Oh! also I was wondering if its possible to prevent the "edited" on an interaction when just disabling the buttons when the interaction expires (looks nicer but not a must have :))
(Lmk if I need to show my code, its a bit over complicated due to some caching behavior so wanted to see if this was an easy question that doesn't really need a reference)
the edited will always appear.
And interaction, or well, what youve named it as, it is not an interaction, it is, or should be, a Message, which you can edit in the end event using jst <Message>.edit for non ephemeral responses, or <Interaction>.deleteReply() for ephemeral responses
Oh right sorry, mixed up the button being an interaction with the actual message :X_etobleh:
As for disabling said buttons, can that be done directly or do I have to explicitly retrieve what was in the message last (e.g. with fetchReply()) then modify the button to have disabled=true