Browse Source
[commands] reset view when Optional argument encounters parsing error
pull/7441/head
Sebastian Law
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
8 additions and
1 deletions
-
discord/ext/commands/core.py
|
|
@ -564,7 +564,14 @@ class Command(_BaseCommand, Generic[CogT, P, T]): |
|
|
|
if consume_rest_is_special: |
|
|
|
argument = view.read_rest().strip() |
|
|
|
else: |
|
|
|
argument = view.get_quoted_word() |
|
|
|
try: |
|
|
|
argument = view.get_quoted_word() |
|
|
|
except ArgumentParsingError as exc: |
|
|
|
if self._is_typing_optional(param.annotation): |
|
|
|
view.index = previous |
|
|
|
return None |
|
|
|
else: |
|
|
|
raise exc |
|
|
|
view.previous = previous |
|
|
|
|
|
|
|
# type-checker fails to narrow argument |
|
|
|