mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-08 10:53:10 +00:00
[commands] Add support for typing.Annotated
This commit is contained in:
@ -161,6 +161,12 @@ def get_signature_parameters(
|
||||
if annotation is Greedy:
|
||||
raise TypeError('Unparameterized Greedy[...] is disallowed in signature.')
|
||||
|
||||
if hasattr(annotation, '__metadata__'):
|
||||
# Annotated[X, Y] can access Y via __metadata__
|
||||
metadata = annotation.__metadata__
|
||||
if len(metadata) >= 1:
|
||||
annotation = metadata[0]
|
||||
|
||||
if isinstance(annotation, discord.app_commands.transformers._TransformMetadata):
|
||||
annotation = annotation.metadata
|
||||
|
||||
|
Reference in New Issue
Block a user