Class ButtonBuilder

    • Constructor Detail

      • ButtonBuilder

        public ButtonBuilder​()
    • 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.
      • 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​(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​(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​(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​(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​(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​(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 chaain call methods.
      • setEmoji

        public ButtonBuilder setEmoji​(Emoji emoji)
        Set the button's emoji.
        Parameters:
        emoji - The emoji.
        Returns:
        The current instance in order to chaain 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 chaain call methods.
      • setStyleIgnoreCase

        public ButtonBuilder setStyleIgnoreCase​(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 a Button instance with the given values.
        Returns:
        The created button instance.
      • getDelegate

        public ButtonBuilderDelegate getDelegate​()
        Gets the delegate used by the component builder internally.
        Specified by:
        getDelegate in interface ComponentBuilder
        Returns:
        The delegate used by this component builder internally.