How do i disable all buttons on action row #2543
-
I have two buttons and I want when he clicks on one to disable both buttons so that he can no longer click, but when I click on the first one it disables only the first and when I click on the second button it disables both buttons as I would like it to be. How do I disable both buttons no matter which button the person clicked? I'm using JDA:5.0.0-beta.12 @Override
public void onButtonInteraction(ButtonInteractionEvent event) {
...
event.editComponents(ActionRow.of(
Button.of(ButtonStyle.SUCCESS, "authenticator_accepted", "Accept").asDisabled(),
Button.of(ButtonStyle.DANGER, "authenticator_its_not_me", "It's Not Me!").asDisabled()
)).queue();
} |
Beta Was this translation helpful? Give feedback.
Answered by
gabrizete
Oct 11, 2023
Replies: 2 comments 1 reply
-
This code should work: @Override
public void onButtonInteraction(ButtonInteractionEvent event) {
...
event.editComponents(event.getMessage().getActionRows().stream().map(ActionRow::asDisabled).toArray(ActionRow[]::new)).queue();
} |
Beta Was this translation helpful? Give feedback.
1 reply
-
Closed in #2547 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I already did an issue and saw that I was making a mistake in my code. Thank you for your help
#2547