Browse Source
[commands] Fix converters not working with Optional for hybrids
pull/10247/head
Soheab
4 days ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
1 additions and
1 deletions
-
discord/ext/commands/hybrid.py
|
@ -256,7 +256,7 @@ def replace_parameter( |
|
|
# Special case Optional[X] where X is a single type that can optionally be a converter |
|
|
# Special case Optional[X] where X is a single type that can optionally be a converter |
|
|
inner = args[0] |
|
|
inner = args[0] |
|
|
is_inner_transformer = is_transformer(inner) |
|
|
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)]) |
|
|
param = param.replace(annotation=Optional[ConverterTransformer(inner, original)]) |
|
|
else: |
|
|
else: |
|
|
raise |
|
|
raise |
|
|