mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-07-04 01:00:00 +00:00
[commands] Elaborate more on disallowed types in Greedy and Optional
This commit is contained in:
parent
2721689254
commit
99b1390e5a
@ -185,7 +185,7 @@ Converters
|
|||||||
As a consequence of this behaviour, most input errors are silently discarded,
|
As a consequence of this behaviour, most input errors are silently discarded,
|
||||||
since it is used as an indicator of when to stop parsing.
|
since it is used as an indicator of when to stop parsing.
|
||||||
|
|
||||||
When a parser error is met the greedy converter stops converting, it undos the
|
When a parser error is met the greedy converter stops converting, undoes the
|
||||||
internal string parsing routine, and continues parsing regularly.
|
internal string parsing routine, and continues parsing regularly.
|
||||||
|
|
||||||
For example, in the following code:
|
For example, in the following code:
|
||||||
|
@ -471,6 +471,10 @@ Consider the following example:
|
|||||||
In this example, since the argument could not be converted into an ``int``, the default of ``99`` is passed and the parser
|
In this example, since the argument could not be converted into an ``int``, the default of ``99`` is passed and the parser
|
||||||
resumes handling, which in this case would be to pass it into the ``liquid`` parameter.
|
resumes handling, which in this case would be to pass it into the ``liquid`` parameter.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
This converter only works in regular positional parameters, not variable parameters or keyword-only parameters.
|
||||||
|
|
||||||
Greedy
|
Greedy
|
||||||
^^^^^^^^
|
^^^^^^^^
|
||||||
|
|
||||||
@ -533,6 +537,9 @@ This command can be invoked any of the following ways:
|
|||||||
unintended parsing ambiguities in your code. One technique would be to clamp down the expected syntaxes
|
unintended parsing ambiguities in your code. One technique would be to clamp down the expected syntaxes
|
||||||
allowed through custom converters or reordering the parameters to minimise clashes.
|
allowed through custom converters or reordering the parameters to minimise clashes.
|
||||||
|
|
||||||
|
To help aid with some parsing ambiguities, :class:`str`, ``None`` and :data:`~ext.commands.Greedy` are
|
||||||
|
forbidden as parameters for the :data:`~ext.commands.Greedy` converter.
|
||||||
|
|
||||||
.. _ext_commands_error_handler:
|
.. _ext_commands_error_handler:
|
||||||
|
|
||||||
Error Handling
|
Error Handling
|
||||||
|
Loading…
x
Reference in New Issue
Block a user