public final class StringArgument extends Argument<StringArgument,String>
| Constructor and Description |
|---|
StringArgument(@NotNull String name,
@NotNull String prompt)
Creates an instance of this Argument implementation
|
| Modifier and Type | Method and Description |
|---|---|
StringArgument |
clone()
An argument clone is required to prevent a value traveling through different Command calls.
|
String |
getRegex()
Get the regex for validation
|
String |
parse(@NotNull net.dv8tion.jda.api.events.message.MessageReceivedEvent event,
String arg)
To be called if all validations passed.
|
String |
parse(net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent event,
String arg)
To be called if all validations passed.
|
StringArgument |
setRegex(String regex)
Set a regex that the input string must match in order to be valid
|
StringArgument |
setRegex(String regex,
Function<net.dv8tion.jda.api.events.Event,String> regexVerboseGetter)
Set a regex that the input string must match in order to be valid
|
StringArgument |
setRegex(String regex,
String verbose)
Set a regex that the input string must match in order to be valid
|
String |
validate(@NotNull net.dv8tion.jda.api.events.message.MessageReceivedEvent event,
@NotNull String arg)
Validates if the argument input by the user is a valid value.
|
String |
validate(net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent event,
String arg)
Validates if the argument input by the user is a valid value.
|
addValidValues, clone, getDefaultValue, getMax, getMin, getName, getPrompt, getPrompt, getPromptRaw, getType, getValidValues, getValue, inRange, inRange, inRange, inRange, inRange, inRange, isRequired, oneOf, setDefaultValue, setDefaultValue, setMax, setMax, setMax, setMax, setMin, setMin, setMin, setMin, setPromptParser, setRequired, setSlashValue, setValue, validateNullpublic String validate(@NotNull @NotNull net.dv8tion.jda.api.events.message.MessageReceivedEvent event, @NotNull @NotNull String arg)
IArgumentevent - Discord event that triggered this function call.arg - argument input by the user.public String validate(net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent event, String arg)
IArgumentevent - Discord event that triggered this function call.arg - argument input by the user.public String parse(@NotNull @NotNull net.dv8tion.jda.api.events.message.MessageReceivedEvent event, String arg)
IArgumentevent - Discord event that triggered this function call.arg - argument input by the user.IArgument.validate(MessageReceivedEvent, String)public String parse(net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent event, String arg)
IArgumentevent - Discord event that triggered this function call.arg - argument input by the user.IArgument.validate(MessageReceivedEvent, String)public StringArgument setRegex(String regex, String verbose)
regex - Regular expressionverbose - Explanation of regular expressionpublic StringArgument setRegex(String regex, Function<net.dv8tion.jda.api.events.Event,String> regexVerboseGetter)
regex - Regular expressionregexVerboseGetter - Function to get the explanation of regular expressionpublic StringArgument setRegex(String regex)
regex - Regular expressionpublic String getRegex()
public StringArgument clone()
Argument
If your Argument child doesn't have additional attribute, you may just do
return clone(new MyArgument(getName(), getPrompt()));
clone in interface IArgument<StringArgument,String>clone in class Argument<StringArgument,String>