Skip to content

Commit 213b639

Browse files
Paillat-devpre-commit-ci[bot]Lulalaby
authored
fix: 🐛 Issue in @option where some annotations could not be used along with channel_types (#2835)
* 🐛 Option: Always set `input_type` to `SlashCommandOptionType.channel` when `channel_types` is set * 📝 CHANGELOG.md * style(pre-commit): auto fixes from pre-commit.com hooks --------- Signed-off-by: Paillat <[email protected]> Signed-off-by: Lala Sabathil <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Lala Sabathil <[email protected]>
1 parent 35c7dc1 commit 213b639

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ These changes are available on the `master` branch, but have not yet been releas
123123
([#2812](https://github.com/Pycord-Development/pycord/pull/2812))
124124
- Fixed `AttributeError` when printing a File component's `__repr__`.
125125
([#2843](https://github.com/Pycord-Development/pycord/pull/2843))
126+
- Fixed `TypeError` when using `@option` with certain annotations and along with
127+
`channel_types`. ([#2835](https://github.com/Pycord-Development/pycord/pull/2835))
126128

127129
### Changed
128130

discord/commands/options.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,9 @@ def __init__(
225225
self.description = description or "No description provided"
226226
self.channel_types: list[ChannelType] = kwargs.pop("channel_types", [])
227227

228-
if isinstance(input_type, SlashCommandOptionType):
228+
if self.channel_types:
229+
self.input_type = SlashCommandOptionType.channel
230+
elif isinstance(input_type, SlashCommandOptionType):
229231
self.input_type = input_type
230232
else:
231233
from ..ext.commands import Converter

0 commit comments

Comments
 (0)