Package com.jagrosh.jdautilities.menu
Class ButtonMenu.Builder
java.lang.Object
com.jagrosh.jdautilities.menu.Menu.Builder<ButtonMenu.Builder,ButtonMenu>
com.jagrosh.jdautilities.menu.ButtonMenu.Builder
- Enclosing class:
ButtonMenu
The
Menu.Builder
for
a ButtonMenu
.- Author:
- John Grosh
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdds a single String unicode emoji as a button choice.addChoice
(net.dv8tion.jda.api.entities.emoji.Emoji emote) Adds a single customEmote
as button choices.addChoices
(String... emojis) Adds String unicode emojis as button choices.addChoices
(net.dv8tion.jda.api.entities.emoji.Emoji... emotes) Adds customEmote
s as button choices.build()
Builds theButtonMenu
with this Builder.Sets theConsumer
action to perform upon selecting a button.setChoices
(String... emojis) Sets the String unicode emojis as button choices.setChoices
(net.dv8tion.jda.api.entities.emoji.Emoji... emotes) Sets theEmote
s as button choices.Sets theColor
of theMessageEmbed
.setDescription
(String description) Sets the description to be placed in anMessageEmbed
.setFinalAction
(Consumer<net.dv8tion.jda.api.entities.Message> finalAction) Sets theConsumer
to perform if theButtonMenu
is done, either via cancellation, a timeout, or a selection being made.Sets the text of theMessage
to be displayed when theButtonMenu
is built.Methods inherited from class com.jagrosh.jdautilities.menu.Menu.Builder
addRoles, addUsers, setEventWaiter, setRoles, setTimeout, setUsers
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
build
Builds theButtonMenu
with this Builder.- Specified by:
build
in classMenu.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.
- No
-
setColor
Sets theColor
of theMessageEmbed
.- Parameters:
color
- The Color of the MessageEmbed- Returns:
- This builder
-
setText
Sets the text of theMessage
to be displayed when theButtonMenu
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
Sets the description to be placed in anMessageEmbed
.
If this isnull
, no MessageEmbed will be displayed- Parameters:
description
- The content of the MessageEmbed's description- Returns:
- This builder
-
setAction
Sets theConsumer
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 theConsumer
to perform if theButtonMenu
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
Adds a single String unicode emoji as a button choice.Any non-unicode
Emote
should be added usingButtonMenu.Builder#addChoice(Emote)
.- Parameters:
emoji
- The String unicode emoji to add- Returns:
- This builder
-
addChoice
Adds a single customEmote
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
Adds String unicode emojis as button choices.Any non-unicode
Emote
s should be added usingButtonMenu.Builder#addChoices(Emote...)
.- Parameters:
emojis
- The String unicode emojis to add- Returns:
- This builder
-
addChoices
Adds customEmote
s 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
Sets the String unicode emojis as button choices.Any non-unicode
Emote
s should be set usingButtonMenu.Builder#setChoices(Emote...)
.- Parameters:
emojis
- The String unicode emojis to set- Returns:
- This builder
-
setChoices
Sets theEmote
s 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
-