aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMusicOnline <[email protected]>2018-12-22 11:30:11 +0800
committerRapptz <[email protected]>2019-01-28 21:57:29 -0500
commitdc8aa7c35b5e6399d6ed2dcde50eb59ab8abc744 (patch)
tree0982ff77a1e4da5372d7c67e8b8091e94aca9124
parentUse a tuple for startswith in mime detection code. (diff)
downloaddiscord.py-dc8aa7c35b5e6399d6ed2dcde50eb59ab8abc744.tar.xz
discord.py-dc8aa7c35b5e6399d6ed2dcde50eb59ab8abc744.zip
Change Greedy behaviour slightly during conversion errors.
Make Greedy swallow conversion errors and return the default if there are no convertible args
-rw-r--r--discord/ext/commands/core.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py
index a45714b4..89ca1acf 100644
--- a/discord/ext/commands/core.py
+++ b/discord/ext/commands/core.py
@@ -359,22 +359,18 @@ class Command:
# for use with a manual undo
previous = view.index
- # parsing errors get propagated
view.skip_ws()
argument = quoted_word(view)
try:
value = await self.do_conversion(ctx, converter, argument, param)
except CommandError:
- if not result:
- if required:
- raise
- else:
- view.index = previous
- return param.default
view.index = previous
break
else:
result.append(value)
+
+ if not result and not required:
+ return param.default
return result
async def _transform_greedy_var_pos(self, ctx, param, converter):