From f31377ccdaf9825ddffd58c5b872516c5e841bac Mon Sep 17 00:00:00 2001 From: Varun J Date: Thu, 8 Sep 2022 11:34:07 +0530 Subject: [PATCH] [commands] fix Range to allow 3.10 Union syntax --- discord/ext/commands/converter.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/discord/ext/commands/converter.py b/discord/ext/commands/converter.py index 9c6d123ae..9b9b1b027 100644 --- a/discord/ext/commands/converter.py +++ b/discord/ext/commands/converter.py @@ -1096,6 +1096,13 @@ else: return converted + def __call__(self) -> None: + # Trick to allow it inside typing.Union + pass + + def __or__(self, rhs) -> Any: + return Union[self, rhs] + def __class_getitem__(cls, obj) -> Range: if not isinstance(obj, tuple): raise TypeError(f'expected tuple for arguments, received {obj.__class__!r} instead')