Browse Source

Allow Optional transformers to work at runtime

pull/7642/head
Rapptz 3 years ago
parent
commit
740c156cd8
  1. 5
      discord/app_commands/transformers.py

5
discord/app_commands/transformers.py

@ -241,6 +241,11 @@ class _TransformMetadata:
def __init__(self, metadata: Type[Transformer]):
self.metadata: Type[Transformer] = metadata
# This is needed to pass typing's type checks.
# e.g. Optional[Transform[discord.Member, MyTransformer]]
def __call__(self) -> None:
pass
async def _identity_transform(cls, interaction: Interaction, value: Any) -> Any:
return value

Loading…
Cancel
Save