Package discord4j.core.object.component
Class Button
- java.lang.Object
-
- discord4j.core.object.component.MessageComponent
-
- discord4j.core.object.component.ActionComponent
-
- discord4j.core.object.component.Button
-
public class Button extends ActionComponent
A message button.- See Also:
- Buttons
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classButton.StyleA button's style is what determines its color and whether it has a custom id or a url.-
Nested classes/interfaces inherited from class discord4j.core.object.component.MessageComponent
MessageComponent.Type
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Buttondanger(String customId, ReactionEmoji emoji)Creates adangerbutton.static Buttondanger(String customId, ReactionEmoji emoji, String label)Creates adangerbutton.static Buttondanger(String customId, String label)Creates adangerbutton.Buttondisabled()Creates a new button with the same data as this one, but disabled.Buttondisabled(boolean value)Creates a new button with the same data as this one, but depending on the value param it may be disabled or not.Optional<String>getCustomId()Gets the button's custom id.Optional<ReactionEmoji>getEmoji()Gets the button's emoji.Optional<String>getLabel()Gets button's label.Button.StylegetStyle()Gets the button's style.Optional<String>getUrl()Gets the button's url.booleanisDisabled()Gets whether button is disabled.static Buttonlink(String url, ReactionEmoji emoji)Creates alinkbutton.static Buttonlink(String url, ReactionEmoji emoji, String label)Creates alinkbutton.static Buttonlink(String url, String label)Creates alinkbutton.static Buttonprimary(String customId, ReactionEmoji emoji)Creates aprimarybutton.static Buttonprimary(String customId, ReactionEmoji emoji, String label)Creates aprimarybutton.static Buttonprimary(String customId, String label)Creates aprimarybutton.static Buttonsecondary(String customId, ReactionEmoji emoji)Creates asecondarybutton.static Buttonsecondary(String customId, ReactionEmoji emoji, String label)Creates asecondarybutton.static Buttonsecondary(String customId, String label)Creates asecondarybutton.static Buttonsuccess(String customId, ReactionEmoji emoji)Creates asuccessbutton.static Buttonsuccess(String customId, ReactionEmoji emoji, String label)Creates asuccessbutton.static Buttonsuccess(String customId, String label)Creates asuccessbutton.-
Methods inherited from class discord4j.core.object.component.MessageComponent
fromData, getData, getType
-
-
-
-
Method Detail
-
primary
public static Button primary(String customId, String label)
Creates aprimarybutton.- Parameters:
customId- A developer-defined identifier for the button.label- The text that appears on the button.- Returns:
- A button with the given data.
-
primary
public static Button primary(String customId, ReactionEmoji emoji)
Creates aprimarybutton.- Parameters:
customId- A developer-defined identifier for the button.emoji- The emoji that appears on the button.- Returns:
- A button with the given data.
-
primary
public static Button primary(String customId, ReactionEmoji emoji, String label)
Creates aprimarybutton.- Parameters:
customId- A developer-defined identifier for the button.emoji- The emoji that appears on the button.label- The text that appears on the button.- Returns:
- A button with the given data.
-
secondary
public static Button secondary(String customId, String label)
Creates asecondarybutton.- Parameters:
customId- A developer-defined identifier for the button.label- The text that appears on the button.- Returns:
- A button with the given data.
-
secondary
public static Button secondary(String customId, ReactionEmoji emoji)
Creates asecondarybutton.- Parameters:
customId- A developer-defined identifier for the button.emoji- The emoji that appears on the button.- Returns:
- A button with the given data.
-
secondary
public static Button secondary(String customId, ReactionEmoji emoji, String label)
Creates asecondarybutton.- Parameters:
customId- A developer-defined identifier for the button.emoji- The emoji that appears on the button.label- The text that appears on the button.- Returns:
- A button with the given data.
-
success
public static Button success(String customId, String label)
Creates asuccessbutton.- Parameters:
customId- A developer-defined identifier for the button.label- The text that appears on the button.- Returns:
- A button with the given data.
-
success
public static Button success(String customId, ReactionEmoji emoji)
Creates asuccessbutton.- Parameters:
customId- A developer-defined identifier for the button.emoji- The emoji that appears on the button.- Returns:
- A button with the given data.
-
success
public static Button success(String customId, ReactionEmoji emoji, String label)
Creates asuccessbutton.- Parameters:
customId- A developer-defined identifier for the button.emoji- The emoji that appears on the button.label- The text that appears on the button.- Returns:
- A button with the given data.
-
danger
public static Button danger(String customId, String label)
Creates adangerbutton.- Parameters:
customId- A developer-defined identifier for the button.label- The text that appears on the button.- Returns:
- A button with the given data.
-
danger
public static Button danger(String customId, ReactionEmoji emoji)
Creates adangerbutton.- Parameters:
customId- A developer-defined identifier for the button.emoji- The emoji that appears on the button.- Returns:
- A button with the given data.
-
danger
public static Button danger(String customId, ReactionEmoji emoji, String label)
Creates adangerbutton.- Parameters:
customId- A developer-defined identifier for the button.emoji- The emoji that appears on the button.label- The text that appears on the button.- Returns:
- A button with the given data.
-
link
public static Button link(String url, String label)
Creates alinkbutton.- Parameters:
url- The url to navigate to when clicked.label- The text that appears on the button.- Returns:
- A button with the given data.
-
link
public static Button link(String url, ReactionEmoji emoji)
Creates alinkbutton.- Parameters:
url- The url to navigate to when clicked.emoji- The emoji that appears on the button.- Returns:
- A button with the given data.
-
link
public static Button link(String url, ReactionEmoji emoji, String label)
Creates alinkbutton.- Parameters:
url- The url to navigate to when clicked.emoji- The emoji that appears on the button.label- The text that appears on the button.- Returns:
- A button with the given data.
-
getStyle
public Button.Style getStyle()
Gets the button's style.- Returns:
- The button's style.
-
getEmoji
public Optional<ReactionEmoji> getEmoji()
Gets the button's emoji.- Returns:
- The button's emoji.
-
getCustomId
public Optional<String> getCustomId()
Gets the button's custom id.- Returns:
- The button's custom id.
-
isDisabled
public boolean isDisabled()
Gets whether button is disabled.- Returns:
- Whether the button is disabled.
-
disabled
public Button disabled()
Creates a new button with the same data as this one, but disabled.- Returns:
- A new disabled button with the same data as this one.
-
disabled
public Button disabled(boolean value)
Creates a new button with the same data as this one, but depending on the value param it may be disabled or not.- Parameters:
value- True if the button should be disabled otherwise False.- Returns:
- A new possibly disabled button with the same data as this one.
-
-