CoalescingConverter
Abstract base class for a coalescing converter.
Coalescing converters take a list of multiple arguments, and consumes as many arguments as it can, combining those arguments into a single value. Upon reaching an argument that can't be consumed, the converter stores its final result and tells the parser how many arguments it managed to consume. The parser will continue processing the unused arguments, passing them to the remaining converters.
You can convert a CoalescingConverter instance to a defaulting or optional converter using toDefaulting or toOptional respectively.
You can create a coalescing converter of your own by extending this class.
Inheritors
Properties
Argument object containing this converter and its metadata.
Current instance of the bot.
Access to the converter builder, perhaps a bit more hacky than it should be but whatever.
If the signatureType isn't sufficient, you can optionally provide a translation key pointing to a longer type string to use for error messages.
This will be set to true by the argument parser if the conversion succeeded.
Intended only for use if this converter is the last one in a set of arguments, if this is true then the converter should throw a DiscordRelayedException when an argument can't be parsed, instead of just stopping and allowing parsing to continue.
For commands with generated signatures, set whether the type string should be shown in the signature.
Translation key pointing to a short string describing the type of data this converter handles. Should be very short.
Validation lambda, which may throw a DiscordRelayedException if required.
Functions
Return a Key representing a pre-translated error string.
Return a translated, formatted error string.
Given a Throwable encountered during the parse function, return a human-readable string to display on Discord.
Call the mutator lambda, if one was provided.
Process the string in the given parser, converting it into a new value.
Use the given option taken straight from the slash command invocation to fill the converter.
Wrap this coalescing converter with a CoalescingToDefaultingConverter, which is a special converter that will act like an DefaultingCoalescingConverter using the same logic of this converter.
Wrap this coalescing converter with a CoalescingToOptionalConverter, which is a special converter that will act like an OptionalCoalescingConverter using the same logic of this converter.
Call the validator lambda, if one was provided.