What's the best way to set a button to disabled?

I have the button via interaction.component I noticed there isn't a set disabled method or anything of the sorts
6 Replies
d.js toolkit
d.js toolkit•3y 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!
Archie
ArchieOP•3y ago
14.13.0 discord 16.16.0 node
d.js docs
d.js docs•3y ago
method (static) ActionRowBuilder.from() Creates a new action row builder from JSON data
Archie
ArchieOP•3y ago
Thanks, i'll take a look into that By "if you don't have the original components still around" do you mean within the scope in code or still being active on the screen? Got you, i'll look into making a new ActionRowBuilder and go from there, thankyou so something like
const newRow = ActionRowBuilder.from(interaction.message.components[0])
const newRow = ActionRowBuilder.from(interaction.message.components[0])
then loop through newRow to check for the customID to match a value and then set to disabled? Will this keep the customIDs in place or will I need to search by something else in the loop
Archie
ArchieOP•3y ago
I'm using
if (component.customId === 'enablecheckin') {
component.setDisabled(true);
}
if (component.customId === 'enablecheckin') {
component.setDisabled(true);
}
but it isn't firing. The button is in the array
Archie
ArchieOP•3y ago
ahh thankyou

Did you find this page helpful?