Fix multiple optional argument sorting

This commit is contained in:
Gnome
2021-09-05 12:39:53 +01:00
parent e9b95eaff7
commit 575a92cd3a
3 changed files with 24 additions and 18 deletions

View File

@@ -577,6 +577,10 @@ class Command(_BaseCommand, Generic[CogT, P, T]):
ctx.bot.dispatch('command_error', ctx, error)
async def transform(self, ctx: Context, param: inspect.Parameter) -> Any:
if param in ctx._ignored_params:
# in a slash command, we need a way to mark a param as default so ctx._ignored_params is used
return param.default if param.default is not param.empty else None
required = param.default is param.empty
converter = get_converter(param)
consume_rest_is_special = param.kind == param.KEYWORD_ONLY and not self.rest_is_raw