Class Button


public class Button extends ActionComponent
A message button.
See Also:
  • Method Details

    • primary

      public static Button primary(String customId, String label)
      Creates a primary button.
      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 a primary button.
      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 a primary button.
      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 a secondary button.
      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 a secondary button.
      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 a secondary button.
      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 a success button.
      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 a success button.
      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 a success button.
      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 a danger button.
      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 a danger button.
      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 a danger button.
      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 a link button.
      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 a link button.
      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 a link button.
      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.
    • getLabel

      public Optional<String> getLabel()
      Gets button's label.
      Returns:
      The button's label.
    • 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.
    • getUrl

      public Optional<String> getUrl()
      Gets the button's url.
      Returns:
      The button's url.
    • 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.