From 3646be9296c70119e4d71f83ea06e7aa8d0ac4ab Mon Sep 17 00:00:00 2001 From: Paillat Date: Thu, 17 Oct 2024 13:42:32 +0200 Subject: [PATCH] :bug: Union type cannot be used in `ctx`. --- discord/commands/options.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/discord/commands/options.py b/discord/commands/options.py index 382067421f..9208372f23 100644 --- a/discord/commands/options.py +++ b/discord/commands/options.py @@ -45,6 +45,7 @@ from ..utils import MISSING, basic_autocomplete if TYPE_CHECKING: + from ..commands import ApplicationContext from ..ext.commands import Converter from ..member import Member from ..message import Attachment @@ -227,6 +228,13 @@ def __init__( else: from ..ext.commands import Converter + if isinstance(input_type, tuple) and any( + issubclass(op, ApplicationContext) for op in input_type + ): + input_type = next( + op for op in input_type if issubclass(op, ApplicationContext) + ) + if ( isinstance(input_type, Converter) or input_type_is_class