From 93154c0ab3fc06f282a100d120432ab78d0bf0bb Mon Sep 17 00:00:00 2001 From: Paillat Date: Thu, 17 Oct 2024 13:42:32 +0200 Subject: [PATCH 1/2] :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 From 0dc7f3902278e0d43b12fa26c5efff1b82311e33 Mon Sep 17 00:00:00 2001 From: Paillat Date: Thu, 17 Oct 2024 13:47:15 +0200 Subject: [PATCH 2/2] :memo: CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index daf082ae66..08cb7d9391 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,8 @@ These changes are available on the `master` branch, but have not yet been releas ([#2595](https://github.com/Pycord-Development/pycord/pull/2595)) - Fixed `BucketType.category` cooldown commands not functioning correctly in private channels. ([#2603](https://github.com/Pycord-Development/pycord/pull/2603)) +- Fixed `SlashCommand`'s `ctx` parameter couldn't be `Union` type. + ([#2611](https://github.com/Pycord-Development/pycord/pull/2611)) ### Changed