11 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!And I was wondering, how could I make it so that it disables the button attached to a message?
If you need the handler, lmk!
Handler:
to what message? the message from the clicked button?
Basically haha... before clicking a button, there is an embed
I was to disable the button sent to the channel on that embed so the button can't be used more at once
because it does invovle pinging
use #update() instead of #reply()
Responding to interactions:
-
#reply
immediately respond with a message
- #update
immediately update the original message (buttons, select menus)
- #showModal
immediately show a modal (cannot be deferred)
- #deferReply/Update
respond later (up to 15 minutes)
- #followUp
post an additional message
The initial response has to happen within 3s of receiving the interaction!components: [] deletes every row though
if you want to disable the button you'd need to send the same row, but with the button being disabled
So basically setup another Actionrow but instead have it disabled this time?
yeah, you can either build the same action row (ideally you'd have some function for that so you don't repeat code, you could also pass the disabled state you want to that function), or build the row from the message's data:
:property: ButtonInteraction#message
[email protected]
The message to which the component was attached
:property: Message#components [email protected]
An array of action rows in the message. This property requires the GatewayIntentBits.MessageContent privileged intent in a guild for messages that do not mention the client.
Structures from the API cannot be edited directly. To do so, you can create a new structure (a builder) using the .from()
method
Thank you, it works!
I forgot some of the most simplest things I swear lol