Class SelectMenu.Option

java.lang.Object
discord4j.core.object.component.SelectMenu.Option
Enclosing class:
SelectMenu

public static class SelectMenu.Option extends Object
An option displayed in a select menu.
  • Method Details

    • of

      public static SelectMenu.Option of(String label, String value)
      Creates a select menu option.
      Parameters:
      label - The user-facing name of the option
      value - A developer-defined identifier for the option.
      Returns:
      A select menu option with the given data.
    • ofDefault

      public static SelectMenu.Option ofDefault(String label, String value)
      Creates a default select menu option.

      Default options are selected by default.

      Parameters:
      label - The user-facing name of the option
      value - A developer-defined identifier for the option.
      Returns:
      A default select menu option with the given data.
    • getLabel

      public String getLabel()
      Gets the option's label.
      Returns:
      The option's label.
    • getValue

      public String getValue()
      Gets the option's value.
      Returns:
      The option's value.
    • getDescription

      public Optional<String> getDescription()
      Gets the option's description.
      Returns:
      The option's description.
    • getEmoji

      public Optional<ReactionEmoji> getEmoji()
      Gets the option's emoji.
      Returns:
      The option's emoji.
    • isDefault

      public boolean isDefault()
      Gets whether the option is default.
      Returns:
      Whether the option is default.
    • withDescription

      public SelectMenu.Option withDescription(String description)
      Creates a new option with the same data as this one, but with the given description.
      Parameters:
      description - The additional description of the option.
      Returns:
      A new option with the given description.
    • withEmoji

      public SelectMenu.Option withEmoji(ReactionEmoji emoji)
      Creates a new option with the same data as this one, but with the given emoji.
      Parameters:
      emoji - An emoji to display with the option.
      Returns:
      A new option with the given emoji.
    • withDefault

      public SelectMenu.Option withDefault(boolean isDefault)
      Creates a new possibly-default option with the same data as this one.
      Parameters:
      isDefault - Whether the option should be default.
      Returns:
      A new option with the given default state.