[commands] Set constructible FlagConverter flags to not be required

This commit is contained in:
Josh 2021-04-22 13:21:02 +10:00 committed by GitHub
parent 1d7f387122
commit 8457f70477
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -184,6 +184,9 @@ def get_flags(namespace: Dict[str, Any], globals: Dict[str, Any], locals: Dict[s
annotation = flag.annotation = resolve_annotation(flag.annotation, globals, locals, cache)
if flag.default is MISSING and issubclass(annotation, FlagConverter) and annotation._can_be_constructible():
flag.default = annotation._construct_default
if flag.aliases is MISSING:
flag.aliases = []