mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-20 16:00:29 +00:00
[commands] Fix Annotated not working with FlagConverter
This commit is contained in:
parent
08fa9aa65c
commit
60079aee1b
@ -184,6 +184,11 @@ def get_flags(namespace: Dict[str, Any], globals: Dict[str, Any], locals: Dict[s
|
||||
flag.name = name
|
||||
|
||||
annotation = flag.annotation = resolve_annotation(flag.annotation, globals, locals, cache)
|
||||
if hasattr(annotation, '__metadata__'):
|
||||
# Annotated[X, Y] can access Y via __metadata__
|
||||
metadata = annotation.__metadata__
|
||||
if len(metadata) >= 1:
|
||||
annotation = flag.annotation = metadata[0]
|
||||
|
||||
if flag.default is MISSING and hasattr(annotation, '__commands_is_flag__') and annotation._can_be_constructible():
|
||||
flag.default = annotation._construct_default
|
||||
|
Loading…
x
Reference in New Issue
Block a user