Browse Source

[commands] Elaborate more on disallowed types in Greedy and Optional

pull/796/merge
Rapptz 7 years ago
parent
commit
99b1390e5a
  1. 2
      docs/ext/commands/api.rst
  2. 7
      docs/ext/commands/commands.rst

2
docs/ext/commands/api.rst

@ -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:

7
docs/ext/commands/commands.rst

@ -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…
Cancel
Save