Class Argument<O>

  • Type Parameters:
    O - the type of output
    Direct Known Subclasses:
    InputArgument, SubArgument

    public abstract class Argument<O>
    extends java.lang.Object
    Represents an argument
    • Constructor Detail

      • Argument

        public Argument​(java.lang.String name,
                        java.lang.String description,
                        org.javacord.api.interaction.SlashCommandOptionType type)
        Default constructor
        Parameters:
        name - the name of the command Its length must between 1 and 32 Can contain only: - word characters - numbers - '-' characters
        description - the description of the command Its length must between 1 and 100
        type - the type of the argument
    • Method Detail

      • getName

        public java.lang.String getName()
        Returns:
        the argument's name
      • getDescription

        public java.lang.String getDescription()
        Returns:
        the argument's description
      • getType

        public org.javacord.api.interaction.SlashCommandOptionType getType()
        Returns:
        type of the argument
      • getResultType

        public abstract java.lang.Class<O> getResultType()
        Returns:
        the class of the result's type
      • getCommandOption

        public abstract org.javacord.api.interaction.SlashCommandOption getCommandOption()
        Returns:
        the command option that need for to register the argument
      • setOnMismatch

        @Deprecated
        public void setOnMismatch​(ArgumentMismatchEventListener listener)
        Deprecated.
        Sets the argument mismatch listener
        Parameters:
        listener - the listener
      • getMismatchListener

        @Deprecated
        public java.util.Optional<ArgumentMismatchEventListener> getMismatchListener()
        Deprecated.
        Gets the argument mismatch listener
        Returns:
        Optional.empty() when argument mismatch listener is not specified, otherwise Optional.of(Object) with the listener