From 64d1c04660101e7c70eb7aacb4ade17a91775f62 Mon Sep 17 00:00:00 2001 From: Krutyi 4el <60041069+Krutyi-4el@users.noreply.github.com> Date: Sat, 9 Dec 2023 18:47:10 +0200 Subject: [PATCH 1/2] fix(ext.commands): Fixed required=False when default is None --- discord/ext/commands/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py index 4adb27cad0..24d7d86d87 100644 --- a/discord/ext/commands/core.py +++ b/discord/ext/commands/core.py @@ -565,7 +565,7 @@ async def dispatch_error(self, ctx: Context, error: Exception) -> None: async def transform(self, ctx: Context, param: inspect.Parameter) -> Any: if isinstance(param.annotation, Option): default = param.annotation.default - required = param.annotation.required or default is None + required = param.annotation.required and default is None else: default = param.default required = default is param.empty From 63b67e28335da42675f14f61e60c415d863458f9 Mon Sep 17 00:00:00 2001 From: Krutyi-4el <60041069+Krutyi-4el@users.noreply.github.com> Date: Mon, 11 Dec 2023 11:55:54 +0200 Subject: [PATCH 2/2] fix(ext.commands): Ignore default when checking if arg is required Co-authored-by: Dorukyum <53639936+Dorukyum@users.noreply.github.com> Signed-off-by: Krutyi-4el <60041069+Krutyi-4el@users.noreply.github.com> --- discord/ext/commands/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py index 24d7d86d87..c2282d28bf 100644 --- a/discord/ext/commands/core.py +++ b/discord/ext/commands/core.py @@ -565,7 +565,7 @@ async def dispatch_error(self, ctx: Context, error: Exception) -> None: async def transform(self, ctx: Context, param: inspect.Parameter) -> Any: if isinstance(param.annotation, Option): default = param.annotation.default - required = param.annotation.required and default is None + required = param.annotation.required else: default = param.default required = default is param.empty