Class ButtonBuilder
- java.lang.Object
-
- org.javacord.api.entity.message.component.ButtonBuilder
-
- All Implemented Interfaces:
ComponentBuilder,LowLevelComponentBuilder
public class ButtonBuilder extends java.lang.Object implements LowLevelComponentBuilder
-
-
Constructor Summary
Constructors Constructor Description ButtonBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Buttonbuild()Creates aButtoninstance with the given values.ButtonBuildercopy(Button button)Copy a button's value into this builder.ButtonBuilderDelegategetDelegate()Gets the delegate used by the component builder internally.ComponentTypegetType()Get the component's type (alwaysComponentType.BUTTON).ActionRowBuilderinActionRow()Add this button to a new action row and return the new action row.ButtonBuildersetCustomId(java.lang.String customId)Set the button's custom ID.ButtonBuildersetDisabled(java.lang.Boolean isDisabled)Set the button to disabled.ButtonBuildersetEmoji(java.lang.String unicode)Set the button's emoji based on a unicode character.ButtonBuildersetEmoji(CustomEmoji emoji)Set the button's emoji to a custom emoji.ButtonBuildersetEmoji(Emoji emoji)Set the button's emoji.ButtonBuildersetLabel(java.lang.String label)Set the button's label.ButtonBuildersetStyle(int styleValue)Set the button's style.ButtonBuildersetStyle(java.lang.String styleName)Set the button's style.ButtonBuildersetStyle(ButtonStyle style)Set the button's style.ButtonBuildersetStyleIgnoreCase(java.lang.String styleName)Set the button's style based on a color name (ignores case sensitivity).ButtonBuildersetUrl(java.lang.String url)Set the button's URL.
-
-
-
Method Detail
-
copy
public ButtonBuilder copy(Button button)
Copy a button's value into this builder.- Parameters:
button- The button to copy.- Returns:
- The builder instance to chain methods.
-
getType
public ComponentType getType()
Get the component's type (alwaysComponentType.BUTTON).- Specified by:
getTypein interfaceComponentBuilder- Returns:
- The component's type.
-
inActionRow
public ActionRowBuilder inActionRow()
Add this button to a new action row and return the new action row. This is useful if you only want one button and quickly wrap it into an ActionRow to be used with a message.- Returns:
- The new ActionRowBuilder with this button added to it.
-
setStyle
public ButtonBuilder setStyle(ButtonStyle style)
Set the button's style.- Parameters:
style- A new button style.- Returns:
- The builder instance to chain methods.
-
setStyle
public ButtonBuilder setStyle(java.lang.String styleName)
Set the button's style.- Parameters:
styleName- The style of the button based on Discord's default names.- Returns:
- The current instance in order to chain call methods.
-
setStyle
public ButtonBuilder setStyle(int styleValue)
Set the button's style.- Parameters:
styleValue- The style of the button based on Discord's style values.- Returns:
- The current instance in order to chain call methods.
-
setLabel
public ButtonBuilder setLabel(java.lang.String label)
Set the button's label.- Parameters:
label- The button's label.- Returns:
- The current instance in order to chain call methods.
-
setCustomId
public ButtonBuilder setCustomId(java.lang.String customId)
Set the button's custom ID.- Parameters:
customId- The button's identifier.- Returns:
- The current instance in order to chain call methods.
-
setUrl
public ButtonBuilder setUrl(java.lang.String url)
Set the button's URL.- Parameters:
url- The button's clickable URL.- Returns:
- The current instance in order to chain call methods.
-
setDisabled
public ButtonBuilder setDisabled(java.lang.Boolean isDisabled)
Set the button to disabled.- Parameters:
isDisabled- Whether the button is disabled or not.- Returns:
- The current instance in order to chain call methods.
-
setEmoji
public ButtonBuilder setEmoji(java.lang.String unicode)
Set the button's emoji based on a unicode character.- Parameters:
unicode- The emoji unicode character.- Returns:
- The current instance in order to chain call methods.
-
setEmoji
public ButtonBuilder setEmoji(Emoji emoji)
Set the button's emoji.- Parameters:
emoji- The emoji.- Returns:
- The current instance in order to chain call methods.
-
setEmoji
public ButtonBuilder setEmoji(CustomEmoji emoji)
Set the button's emoji to a custom emoji.- Parameters:
emoji- The custom emoji.- Returns:
- The current instance in order to chain call methods.
-
setStyleIgnoreCase
public ButtonBuilder setStyleIgnoreCase(java.lang.String styleName)
Set the button's style based on a color name (ignores case sensitivity).- Parameters:
styleName- A color name from Discord's selection.- Returns:
- The current instance in order to chain call methods.
-
build
public Button build()
Creates aButtoninstance with the given values.- Returns:
- The created button instance.
-
getDelegate
public ButtonBuilderDelegate getDelegate()
Gets the delegate used by the component builder internally.- Specified by:
getDelegatein interfaceComponentBuilder- Returns:
- The delegate used by this component builder internally.
-
-