From 56c648ca1707c4aa42aab0479bbc384ae5636eea Mon Sep 17 00:00:00 2001 From: Paillat Date: Fri, 25 Jul 2025 22:25:03 +0200 Subject: [PATCH 1/3] :bug: Option: Always set `input_type` to `SlashCommandOptionType.channel` when `channel_types` is set --- discord/commands/options.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/discord/commands/options.py b/discord/commands/options.py index 0c6b1fb6f3..0425137aed 100644 --- a/discord/commands/options.py +++ b/discord/commands/options.py @@ -225,7 +225,9 @@ def __init__( self.description = description or "No description provided" self.channel_types: list[ChannelType] = kwargs.pop("channel_types", []) - if isinstance(input_type, SlashCommandOptionType): + if self.channel_types: + self.input_type = SlashCommandOptionType.channel + elif isinstance(input_type, SlashCommandOptionType): self.input_type = input_type else: from ..ext.commands import Converter From 9fb773c4c4bfda551773f1f611b8e74dcddc1aff Mon Sep 17 00:00:00 2001 From: Paillat Date: Fri, 25 Jul 2025 22:31:24 +0200 Subject: [PATCH 2/3] :memo: CHANGELOG.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 583ed07ef4..ec9d11d84b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -119,6 +119,9 @@ These changes are available on the `master` branch, but have not yet been releas ([#2781](https://github.com/Pycord-Development/pycord/pull/2781)) - Fixed `VoiceClient` crashing randomly while receiving audio ([#2800](https://github.com/Pycord-Development/pycord/pull/2800)) +- Fixed `TypeError` when using `@option` with certain annotations and along with + `channel_types`. + ([#2835](https://github.com/Pycord-Development/pycord/pull/2835)) ### Changed From 874617c8553da0625c41cb268af4792907e3215e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 25 Jul 2025 21:01:16 +0000 Subject: [PATCH 3/3] style(pre-commit): auto fixes from pre-commit.com hooks --- CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ec9d11d84b..8a2825f564 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -120,8 +120,7 @@ These changes are available on the `master` branch, but have not yet been releas - Fixed `VoiceClient` crashing randomly while receiving audio ([#2800](https://github.com/Pycord-Development/pycord/pull/2800)) - Fixed `TypeError` when using `@option` with certain annotations and along with - `channel_types`. - ([#2835](https://github.com/Pycord-Development/pycord/pull/2835)) + `channel_types`. ([#2835](https://github.com/Pycord-Development/pycord/pull/2835)) ### Changed