[commands] Fix converters not working with Optional for hybrids

This commit is contained in:
Soheab 2025-07-30 22:08:08 +01:00 committed by GitHub
parent 6e7fc133d1
commit 1cd90f8b1c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -256,7 +256,7 @@ def replace_parameter(
# Special case Optional[X] where X is a single type that can optionally be a converter
inner = args[0]
is_inner_transformer = is_transformer(inner)
if is_converter(inner) and not is_inner_transformer:
if (is_converter(inner) or inner in CONVERTER_MAPPING) and not is_inner_transformer:
param = param.replace(annotation=Optional[ConverterTransformer(inner, original)])
else:
raise