From ce15df42754a2215b4aa110f9a4a9e2294498201 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Wed, 13 Apr 2022 22:43:11 -0400 Subject: [PATCH] [commands] Allow commands.Range inside typing.Union or typing.Optional --- discord/ext/commands/converter.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/discord/ext/commands/converter.py b/discord/ext/commands/converter.py index 6cc7e1302..4d7d8622d 100644 --- a/discord/ext/commands/converter.py +++ b/discord/ext/commands/converter.py @@ -1129,6 +1129,10 @@ else: return converted + def __call__(self) -> None: + # Trick to allow it inside typing.Union + pass + def __class_getitem__(cls, obj) -> Range: if not isinstance(obj, tuple): raise TypeError(f'expected tuple for arguments, received {obj.__class__!r} instead')