Class Slideshow.Builder

Enclosing class:
Slideshow

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

    • Builder

      public Builder()
  • Method Details

    • build

      public Slideshow build()
      Builds the Slideshow with this Builder.
      Specified by:
      build in class Menu.Builder<Slideshow.Builder,Slideshow>
      Returns:
      The Paginator built from this Builder.
      Throws:
      IllegalArgumentException - If one of the following is violated:
      • No EventWaiter was set.
      • No items were set to paginate.
    • setColor

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

      public Slideshow.Builder setColor(BiFunction<Integer,Integer,Color> colorBiFunction)
      Sets the Color of the MessageEmbed, relative to the total page number and the current page as determined by the provided BiFunction.
      As the page changes, the BiFunction will re-process the current page number and the total page number, allowing for the color of the embed to change depending on the page number.
      Parameters:
      colorBiFunction - A BiFunction that uses both current and total page numbers to get a Color for the MessageEmbed
      Returns:
      This builder
    • setText

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

      This is displayed directly above the embed.

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

      public Slideshow.Builder setText(BiFunction<Integer,Integer,String> textBiFunction)
      Sets the text of the Message to be displayed relative to the total page number and the current page as determined by the provided BiFunction.
      As the page changes, the BiFunction will re-process the current page number and the total page number, allowing for the displayed text of the Message to change depending on the page number.
      Parameters:
      textBiFunction - The BiFunction that uses both current and total page numbers to get text for the Message
      Returns:
      This builder
    • setDescription

      public Slideshow.Builder setDescription(String description)
      Sets the description of the MessageEmbed in the Message to be displayed when the Slideshow is built.
      Parameters:
      description - The description of the MessageEmbed
      Returns:
      This builder
    • setDescription

      public Slideshow.Builder setDescription(BiFunction<Integer,Integer,String> descriptionBiFunction)
      Sets the description of the MessageEmbed in the Message to be displayed relative to the total page number and the current page as determined by the provided BiFunction.
      As the page changes, the BiFunction will re-process the current page number and the total page number, allowing for the displayed description of the MessageEmbed to change depending on the page number.
      Parameters:
      descriptionBiFunction - The BiFunction that uses both current and total page numbers to get description for the MessageEmbed
      Returns:
      This builder
    • setFinalAction

      public Slideshow.Builder setFinalAction(Consumer<net.dv8tion.jda.api.entities.Message> finalAction)
      Sets the Consumer to perform if the Slideshow times out.
      Parameters:
      finalAction - The Consumer action to perform if the Slideshow times out
      Returns:
      This builder
    • showPageNumbers

      public Slideshow.Builder showPageNumbers(boolean show)
      Sets whether or not the page number will be shown.
      Parameters:
      show - true if the page number should be shown, false if it should not
      Returns:
      This builder
    • waitOnSinglePage

      public Slideshow.Builder waitOnSinglePage(boolean wait)
      Sets whether the Slideshow will instantly timeout, and possibly run a provided Runnable, if only a single slide is available to display.
      Parameters:
      wait - true if the Slideshow will still generate
      Returns:
      This builder
    • addItems

      public Slideshow.Builder addItems(String... items)
      Adds String items to the list of items to paginate.
      Parameters:
      items - The String list of items to add
      Returns:
      This builder
    • setUrls

      public Slideshow.Builder setUrls(String... items)
      Sets the String list of urls to paginate.
      This method clears all previously set items before setting.
      Parameters:
      items - The String list of urls to paginate
      Returns:
      This builder
    • setBulkSkipNumber

      public Slideshow.Builder setBulkSkipNumber(int bulkSkipNumber)
      Sets the Slideshow's bulk-skip function to skip multiple pages using alternate forward and backwards
      Parameters:
      bulkSkipNumber - The number of pages to skip when the bulk-skip reactions are used.
      Returns:
      This builder
    • wrapPageEnds

      public Slideshow.Builder wrapPageEnds(boolean wrapPageEnds)
      Sets the Slideshow to wrap from the last page to the first when traversing right and visa versa from the left.
      Parameters:
      wrapPageEnds - true to enable wrapping.
      Returns:
      This builder
    • allowTextInput

      public Slideshow.Builder allowTextInput(boolean allowTextInput)
      Sets the Slideshow to allow a slide number to be specified by a user via text.

      Note that setting this doesn't mean that left and right text inputs provided via Paginator.Builder.setLeftRightText(String, String) will be invalidated if they were set previously! To invalidate those, provide null for one or both of the parameters of that method.

      Parameters:
      allowTextInput - true if the Slideshow will allow slide-number text input
      Returns:
      This builder
    • setLeftRightText

      public Slideshow.Builder setLeftRightText(String left, String right)
      Sets the Slideshow to traverse left or right when a provided text input is sent in the form of a Message to the GuildChannel the menu is displayed in.

      If one or both these parameters are provided null this resets both of them and they will no longer be available when the Slideshow is built.

      Parameters:
      left - The left text input, causes the Slideshow to traverse one slide left
      right - The right text input, causes the Slideshow to traverse one slide right
      Returns:
      This builder