convert property

FutureOr<T?> Function(StringView view, ContextData context) convert
final

The function called to perform the conversion.

view is a view on the current argument string. For text commands, this will contain the entire content of the message. For Slash Commands, this will contain the content provided by the user for the current argument.

This function should not throw if parsing fails, it should instead return null to indicate failure. A BadInputException will then be added to CommandsPlugin.onCommandError where it can be handled appropriately.

Implementation

final FutureOr<T?> Function(StringView view, ContextData context) convert;