Skip to content

Commit 813c543

Browse files
committed
🐛 Union type cannot be used in ctx.
1 parent fce7396 commit 813c543

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
@@ -50,6 +50,7 @@
5050
from ..message import Attachment
5151
from ..role import Role
5252
from ..user import User
53+
from ..commands import ApplicationContext
5354

5455
InputType = Union[
5556
Type[str],
@@ -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)