Class OrderedMenu.Builder

Enclosing class:
OrderedMenu

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

    • Builder

      public Builder()
  • Method Details

    • build

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

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

      public OrderedMenu.Builder useLetters()
      Sets the builder to build an OrderedMenu using letters for ordering and reactions (IE: A, B, C, etc.).
      As a note - by default the builder will use numbers not letters.
      Returns:
      This builder
    • useNumbers

      public OrderedMenu.Builder useNumbers()
      Sets the builder to build an OrderedMenu using numbers for ordering and reactions (IE: 1, 2, 3, etc.).
      Returns:
      This builder
    • allowTextInput

      public OrderedMenu.Builder allowTextInput(boolean allow)
      If true, Users can type the number or letter of the input to make their selection, in addition to the reaction option.
      Parameters:
      allow - true if raw text input is allowed, false if it is not
      Returns:
      This builder
    • useCancelButton

      public OrderedMenu.Builder useCancelButton(boolean use)
      If true, adds a cancel button that performs the timeout action when selected.
      Parameters:
      use - true if the cancel button should be shown, false if it should not
      Returns:
      This builder
    • setText

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

      This is displayed directly above the embed.

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

      public OrderedMenu.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
    • setSelection

      public OrderedMenu.Builder setSelection(BiConsumer<net.dv8tion.jda.api.entities.Message,Integer> selection)
      Sets the BiConsumer action to perform upon selecting a option.
      Parameters:
      selection - The BiConsumer action to perform upon selecting a button
      Returns:
      This builder
    • setCancel

      public OrderedMenu.Builder setCancel(Consumer<net.dv8tion.jda.api.entities.Message> cancel)
      Sets the Consumer to perform if the OrderedMenu is cancelled.
      Parameters:
      cancel - The Consumer action to perform if the ButtonMenu is cancelled
      Returns:
      This builder
    • addChoice

      public OrderedMenu.Builder addChoice(String choice)
      Adds a single String choice.
      Parameters:
      choice - The String choice to add
      Returns:
      This builder
    • addChoices

      public OrderedMenu.Builder addChoices(String... choices)
      Adds the String choices.
      These correspond to the button in order of addition.
      Parameters:
      choices - The String choices to add
      Returns:
      This builder
    • setChoices

      public OrderedMenu.Builder setChoices(String... choices)
      Sets the String choices.
      These correspond to the button in the order they are set.
      Parameters:
      choices - The String choices to set
      Returns:
      This builder
    • clearChoices

      public OrderedMenu.Builder clearChoices()
      Clears all previously set choices.
      Returns:
      This builder