Skip to content

Commit c53d929

Browse files
committed
🐛 Union type cannot be used in ctx.
1 parent 9a6cbff commit c53d929

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

discord/commands/options.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
from ..utils import MISSING, basic_autocomplete
4646

4747
if TYPE_CHECKING:
48+
from ..commands import ApplicationContext
4849
from ..ext.commands import Converter
4950
from ..member import Member
5051
from ..message import Attachment
@@ -227,6 +228,13 @@ def __init__(
227228
else:
228229
from ..ext.commands import Converter
229230

231+
if isinstance(input_type, tuple) and any(
232+
issubclass(op, ApplicationContext) for op in input_type
233+
):
234+
input_type = next(
235+
op for op in input_type if issubclass(op, ApplicationContext)
236+
)
237+
230238
if (
231239
isinstance(input_type, Converter)
232240
or input_type_is_class

0 commit comments

Comments
 (0)