Class ButtonMenu.Builder

Enclosing class:
ButtonMenu

public static class ButtonMenu.Builder extends Menu.Builder<ButtonMenu.Builder,ButtonMenu>
Author:
John Grosh
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • build

      public ButtonMenu build()
      Builds the ButtonMenu with this Builder.
      Specified by:
      build in class Menu.Builder<ButtonMenu.Builder,ButtonMenu>
      Returns:
      The OrderedMenu built from this Builder.
      Throws:
      IllegalArgumentException - If one of the following is violated:
      • No EventWaiter was set.
      • No choices were set.
      • No action Consumer was set.
      • Neither text nor description were set.
    • setColor

      public ButtonMenu.Builder setColor(Color color)
      Sets the Color of the MessageEmbed.
      Parameters:
      color - The Color of the MessageEmbed
      Returns:
      This builder
    • setText

      public ButtonMenu.Builder setText(String text)
      Sets the text of the Message to be displayed when the ButtonMenu is built.

      This is displayed directly above the embed.

      Parameters:
      text - The Message content to be displayed above the embed when the ButtonMenu is built
      Returns:
      This builder
    • setDescription

      public ButtonMenu.Builder setDescription(String description)
      Sets the description to be placed in an MessageEmbed.
      If this is null, no MessageEmbed will be displayed
      Parameters:
      description - The content of the MessageEmbed's description
      Returns:
      This builder
    • setAction

      public ButtonMenu.Builder setAction(Consumer<net.dv8tion.jda.api.entities.emoji.Emoji> action)
      Sets the Consumer action to perform upon selecting a button.
      Parameters:
      action - The Consumer action to perform upon selecting a button
      Returns:
      This builder
    • setFinalAction

      public ButtonMenu.Builder setFinalAction(Consumer<net.dv8tion.jda.api.entities.Message> finalAction)
      Sets the Consumer to perform if the ButtonMenu is done, either via cancellation, a timeout, or a selection being made.

      This accepts the message used to display the menu when called.

      Parameters:
      finalAction - The Runnable action to perform if the ButtonMenu is done
      Returns:
      This builder
    • addChoice

      public ButtonMenu.Builder addChoice(String emoji)
      Adds a single String unicode emoji as a button choice.

      Any non-unicode Emote should be added using ButtonMenu.Builder#addChoice(Emote).

      Parameters:
      emoji - The String unicode emoji to add
      Returns:
      This builder
    • addChoice

      public ButtonMenu.Builder addChoice(net.dv8tion.jda.api.entities.emoji.Emoji emote)
      Adds a single custom Emote as button choices.

      Any regular unicode emojis should be added using ButtonMenu.Builder#addChoice(String).

      Parameters:
      emote - The Emote object to add
      Returns:
      This builder
    • addChoices

      public ButtonMenu.Builder addChoices(String... emojis)
      Adds String unicode emojis as button choices.

      Any non-unicode Emotes should be added using ButtonMenu.Builder#addChoices(Emote...).

      Parameters:
      emojis - The String unicode emojis to add
      Returns:
      This builder
    • addChoices

      public ButtonMenu.Builder addChoices(net.dv8tion.jda.api.entities.emoji.Emoji... emotes)
      Adds custom Emotes as button choices.

      Any regular unicode emojis should be added using ButtonMenu.Builder#addChoices(String...).

      Parameters:
      emotes - The Emote objects to add
      Returns:
      This builder
    • setChoices

      public ButtonMenu.Builder setChoices(String... emojis)
      Sets the String unicode emojis as button choices.

      Any non-unicode Emotes should be set using ButtonMenu.Builder#setChoices(Emote...).

      Parameters:
      emojis - The String unicode emojis to set
      Returns:
      This builder
    • setChoices

      public ButtonMenu.Builder setChoices(net.dv8tion.jda.api.entities.emoji.Emoji... emotes)
      Sets the Emotes as button choices.

      Any regular unicode emojis should be set using ButtonMenu.Builder#setChoices(String...).

      Parameters:
      emotes - The Emote objects to set
      Returns:
      This builder