public final class CommandArgumentConfigBuilder
extends java.lang.Object
CommandConfigBuilder, used in
CommandConfigBuilder.addArguments(CommandArgumentConfigBuilder...)CommandConfigBuilder.build() is called.| Constructor and Description |
|---|
CommandArgumentConfigBuilder(int id,
java.lang.String argumentName)
Default values:
has no description
isn't optional
has no default string value
shouldn't be parsed to Double
has no default double value
shouldn't be in quotes
multi word choosing is disabled
|
| Modifier and Type | Method and Description |
|---|---|
CommandArgumentConfigBuilder |
addDoubleValidators(java.util.function.DoublePredicate... validators)
Adds predicates that will be used to validate double value.
The argument must also be set to setParseToDouble(boolean) |
CommandArgumentConfigBuilder |
addStringValidators(java.util.function.Predicate<java.lang.String>... validators)
Adds predicates that will be used to validate string value.
|
CommandArgumentConfigBuilder |
enableCustomArgumentChoosing(boolean enable)
Setting this to true enables custom argument choosing.
|
CommandArgumentConfigBuilder |
setArgumentDescription(java.lang.String desc)
The description will be shown in command inspection (command info) and in wrong-command-usage error message
|
CommandArgumentConfigBuilder |
setArgumentOptions(java.lang.String... options)
Execution of the argument's command will fail if given argument value doesn't match these options.
|
CommandArgumentConfigBuilder |
setDefaultDoubleValue(double num)
Sets default value that will be used if the argument is omitted.
|
@NotNull CommandArgumentConfigBuilder |
setDefaultStringValue(java.lang.String str)
Sets default value that will be used if the argument is omitted.
|
CommandArgumentConfigBuilder |
setInQuotes(boolean bool)
When set to true the argument will have to be typed in quotes (" ").
This is useful for separation of arguments with spaces. |
CommandArgumentConfigBuilder |
setOptional(boolean bool)
When set to true the argument will be optional and could be omitted.
|
CommandArgumentConfigBuilder |
setParseToDouble(boolean bool)
When set to true the argument's value will be parsed to Double and will be accessible using
CommandArguments.getDoubleArgumentValue(int). |
public CommandArgumentConfigBuilder(int id,
java.lang.String argumentName)
id - id of the argument which will be required to get it's value.
The best practice is store the id in a static final fieldargumentName - name of the argument which will be used in command description,
command list and in wrong-command-usage error messagepublic CommandArgumentConfigBuilder setArgumentDescription(java.lang.String desc)
@SafeVarargs public final CommandArgumentConfigBuilder addStringValidators(java.util.function.Predicate<java.lang.String>... validators)
public CommandArgumentConfigBuilder addDoubleValidators(java.util.function.DoublePredicate... validators)
setParseToDouble(boolean)public CommandArgumentConfigBuilder setArgumentOptions(java.lang.String... options)
public CommandArgumentConfigBuilder setOptional(boolean bool)
setParseToDouble(boolean)public CommandArgumentConfigBuilder setInQuotes(boolean bool)
@NotNull public @NotNull CommandArgumentConfigBuilder setDefaultStringValue(java.lang.String str)
setOptional(boolean)public CommandArgumentConfigBuilder setDefaultDoubleValue(double num)
setParseToDouble(boolean),
setOptional(boolean)public CommandArgumentConfigBuilder setParseToDouble(boolean bool)
CommandArguments.getDoubleArgumentValue(int).public CommandArgumentConfigBuilder enableCustomArgumentChoosing(boolean enable)
AbstractCommand.chooseArgumentSymbols(net.dv8tion.jda.api.events.message.MessageReceivedEvent, java.lang.String, int) and the method
will be able to process the splitting itself.