diff --git a/CHANGELOG.md b/CHANGELOG.md index cb2196ab0c..0ce874899d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -188,6 +188,8 @@ These changes are available on the `master` branch, but have not yet been releas ([#2196](https://github.com/Pycord-Development/pycord/pull/2196)) - Fixed `AttributeError` when running permission checks without the `bot` scope. ([#2113](https://github.com/Pycord-Development/pycord/issues/2113)) +- Fixed `Option` not working on bridge commands because `ext.commands.Command` doesn't + recognize them. ([#2256](https://github.com/Pycord-Development/pycord/pull/2256)) ## [2.4.1] - 2023-03-20 diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py index d3ce2e07db..4adb27cad0 100644 --- a/discord/ext/commands/core.py +++ b/discord/ext/commands/core.py @@ -45,6 +45,7 @@ from ...commands import ( ApplicationCommand, + Option, _BaseCommand, message_command, slash_command, @@ -562,7 +563,13 @@ async def dispatch_error(self, ctx: Context, error: Exception) -> None: ctx.bot.dispatch("command_error", ctx, error) async def transform(self, ctx: Context, param: inspect.Parameter) -> Any: - required = param.default is param.empty + if isinstance(param.annotation, Option): + default = param.annotation.default + required = param.annotation.required or default is None + else: + default = param.default + required = default is param.empty + converter = get_converter(param) consume_rest_is_special = ( param.kind == param.KEYWORD_ONLY and not self.rest_is_raw @@ -599,7 +606,7 @@ async def transform(self, ctx: Context, param: inspect.Parameter) -> Any: ): return await converter._construct_default(ctx) raise MissingRequiredArgument(param) - return param.default + return default previous = view.index if consume_rest_is_special: