Interface SlashCommandOptionChoice


  • public interface SlashCommandOptionChoice
    A choice for a slash command option.
    • Method Detail

      • getName

        java.lang.String getName()
        Gets the name of this choice.
        Returns:
        The name of the choice.
      • getNameLocalizations

        java.util.Map<DiscordLocale,​java.lang.String> getNameLocalizations()
        Gets the name localizations for this choice.
        Returns:
        The name localizations for this choice.
      • getStringValue

        java.util.Optional<java.lang.String> getStringValue()
        Gets the string value of this choice.

        If this option is an integer choice, the optional will be empty.

        Returns:
        The string value of this choice.
      • getLongValue

        java.util.Optional<java.lang.Long> getLongValue()
        Gets the long value of this choice.

        If this option is a string choice, the optional will be empty.

        Returns:
        The long value of this choice.
      • getValueAsString

        default java.lang.String getValueAsString()
        Gets the value of this choice as a string.

        If the value is an integer, its string representation will be returned.

        Returns:
        The value of the choice as a string.
      • create

        static SlashCommandOptionChoice create​(java.lang.String name,
                                               java.lang.String value)
        Create a new option choice builder to be used with a command option builder.
        Parameters:
        name - The name of the choice.
        value - The value of the choice.
        Returns:
        The new choice builder.
      • create

        static SlashCommandOptionChoice create​(java.lang.String name,
                                               long value)
        Create a new option choice builder to be used with a command option builder.
        Parameters:
        name - The name of the choice.
        value - The value of the choice. Can be any long between -2^53 and 2^53.
        Returns:
        The new choice builder.