mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-07-14 22:02:07 +00:00
Allow Optional transformers to work at runtime
This commit is contained in:
parent
bbf7a7981b
commit
740c156cd8
@ -241,6 +241,11 @@ class _TransformMetadata:
|
|||||||
def __init__(self, metadata: Type[Transformer]):
|
def __init__(self, metadata: Type[Transformer]):
|
||||||
self.metadata: Type[Transformer] = metadata
|
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:
|
async def _identity_transform(cls, interaction: Interaction, value: Any) -> Any:
|
||||||
return value
|
return value
|
||||||
|
Loading…
x
Reference in New Issue
Block a user