- Type Parameters:
T- The type of argument that is provided.
Specification for a parameter received for a command.
Irrespective of whether the command it is used with is compatible with interactions or not, all values must be compatible with the Discord API specification for command parameters.
- Since:
- 1.0
- Version:
- 1.0
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classParameter.Builder<T extends @NonNull Object>The default builder. -
Field Summary
FieldsModifier and TypeFieldDescriptionPattern for valid parameter descriptions in the Discord API.Pattern for valid parameter names in the Discord API. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends @NonNull Object>
Parameter.Builder<T>builder()Creates a new builder.static <T extends @NonNull Object>
Parameter.Builder<T>Creates a new builder initialized with the properties of the given parameter.The default value for the parameter.@MatchesRegex("(?Us)^.{1,100}+$") StringThe description of the parameter.@MatchesRegex("(?U)^[-_\\p{L}\\p{N}\\p{sc=Deva}\\p{sc=Thai}]{1,32}+$") Stringname()The name of the parameter.ArgumentParser<?,T> parser()The parser to use to process received arguments.default booleanrequired()Whether the parameter must be provided to invoke the command.default voidvalidate()Validates that the properties of this instance are valid.
-
Field Details
-
NAME_REGEX
Pattern for valid parameter names in the Discord API.- See Also:
-
DESCRIPTION_REGEX
Pattern for valid parameter descriptions in the Discord API.- See Also:
-
-
Method Details
-
name
The name of the parameter.- Returns:
- The value.
-
description
The description of the parameter.- Returns:
- The value.
-
required
Whether the parameter must be provided to invoke the command.- Returns:
- The value.
- Implementation Requirements:
- The default is
false.
-
defaultValue
The default value for the parameter.If
null, the parameter has no default and will benullif missing.Note that this property is only meaningful if
required()isfalse.- Returns:
- The value.
- Implementation Requirements:
- The default is
null.
-
parser
The parser to use to process received arguments.- Returns:
- The value.
-
validate
Validates that the properties of this instance are valid.- Throws:
IllegalArgumentException- if any of properties are invalid.NullPointerException- if anullvalue was found where not allowed.- See Also:
-
builder
Creates a new builder.- Type Parameters:
T- The argument type.- Returns:
- The builder.
-
builder
Creates a new builder initialized with the properties of the given parameter.- Type Parameters:
T- The argument type.- Parameters:
base- The base instance to copy.- Returns:
- The builder.
-