public static class SelectionDialog.Builder extends Menu.Builder<SelectionDialog.Builder,SelectionDialog>
Menu.Builder
for
a SelectuibDialog
.Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
SelectionDialog.Builder |
addChoices(java.lang.String... choices)
Adds String choices to be shown as selections.
|
SelectionDialog |
build()
Builds the
SelectionDialog
with this Builder. |
SelectionDialog.Builder |
clearChoices()
Clears the choices to be shown.
|
SelectionDialog.Builder |
setCanceled(java.util.function.Consumer<net.dv8tion.jda.core.entities.Message> cancel)
Sets a
Consumer action to take if the menu is cancelled, either
via the cancel button being used, or if the SelectionDialog times out. |
SelectionDialog.Builder |
setChoices(java.lang.String... choices)
Sets the String choices to be shown as selections.
|
SelectionDialog.Builder |
setColor(java.awt.Color color)
Sets the
Color of the MessageEmbed . |
SelectionDialog.Builder |
setColor(java.util.function.Function<java.lang.Integer,java.awt.Color> color)
Sets the
Color of the MessageEmbed ,
relative to the current selection number as determined by the provided
Function . |
SelectionDialog.Builder |
setDefaultEnds(java.lang.String left,
java.lang.String right)
Sets the text to use on either side of all unselected items.
|
SelectionDialog.Builder |
setSelectedEnds(java.lang.String left,
java.lang.String right)
Sets the text to use on either end of the selected item.
|
SelectionDialog.Builder |
setSelectionConsumer(java.util.function.BiConsumer<net.dv8tion.jda.core.entities.Message,java.lang.Integer> selection)
Sets a
BiConsumer action to perform once a selection is made. |
SelectionDialog.Builder |
setText(java.util.function.Function<java.lang.Integer,java.lang.String> text)
Sets the text of the
Message to be displayed
relative to the current selection number as determined by the provided
Function . |
SelectionDialog.Builder |
setText(java.lang.String text)
Sets the text of the
Message to be displayed
when the SelectionDialog is built. |
SelectionDialog.Builder |
useLooping(boolean loop)
Sets if moving up when at the top selection jumps to the bottom, and visa-versa.
|
addRoles, addUsers, setEventWaiter, setRoles, setTimeout, setUsers
public SelectionDialog build()
SelectionDialog
with this Builder.build
in class Menu.Builder<SelectionDialog.Builder,SelectionDialog>
java.lang.IllegalArgumentException
- If one of the following is violated:
EventWaiter
was set.Consumer
was set.public SelectionDialog.Builder setColor(java.awt.Color color)
Color
of the MessageEmbed
.color
- The Color of the MessageEmbedpublic SelectionDialog.Builder setColor(java.util.function.Function<java.lang.Integer,java.awt.Color> color)
Color
of the MessageEmbed
,
relative to the current selection number as determined by the provided
Function
.
color
- A Function that uses current selection number to get a Color for the MessageEmbedpublic SelectionDialog.Builder setText(java.lang.String text)
Message
to be displayed
when the SelectionDialog
is built.
This is displayed directly above the embed.
text
- The Message content to be displayed above the embed when the SelectionDialog is builtpublic SelectionDialog.Builder setText(java.util.function.Function<java.lang.Integer,java.lang.String> text)
Message
to be displayed
relative to the current selection number as determined by the provided
Function
.
text
- A Function that uses current selection number to get a text for the Messagepublic SelectionDialog.Builder setSelectedEnds(java.lang.String left, java.lang.String right)
left
- The left selection endright
- The right selection endpublic SelectionDialog.Builder setDefaultEnds(java.lang.String left, java.lang.String right)
left
- The left non-selection endright
- The right non-selection endpublic SelectionDialog.Builder useLooping(boolean loop)
loop
- true
if pressing up while at the top selection should loop
to the bottom, false
if it should notpublic SelectionDialog.Builder setSelectionConsumer(java.util.function.BiConsumer<net.dv8tion.jda.core.entities.Message,java.lang.Integer> selection)
BiConsumer
action to perform once a selection is made.
Message
provided is the one used to display
the menu and the Integer
is that of the selection made by the user,
and selections are in order of addition, 1 being the first String choice.selection
- A Consumer for the selection. This is one-based indexing.public SelectionDialog.Builder setCanceled(java.util.function.Consumer<net.dv8tion.jda.core.entities.Message> cancel)
Consumer
action to take if the menu is cancelled, either
via the cancel button being used, or if the SelectionDialog times out.cancel
- The action to take when the SelectionDialog is cancelledpublic SelectionDialog.Builder clearChoices()
public SelectionDialog.Builder setChoices(java.lang.String... choices)
choices
- The String choices to showpublic SelectionDialog.Builder addChoices(java.lang.String... choices)
choices
- The String choices to add