diff --git a/CHANGELOG.md b/CHANGELOG.md index 3314006319..bf46f70f5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,11 @@ These changes are available on the `master` branch, but have not yet been releas - Added `Member.guild_banner` and `Member.display_banner` properties. ([#2556](https://github.com/Pycord-Development/pycord/pull/2556)) +### Fixed + +- Fix `Enum` options not setting the correct type when only one choice is available. + ([#2577](https://github.com/Pycord-Development/pycord/pull/2577)) + ### Changed - Renamed `cover` property of `ScheduledEvent` and `cover` argument of @@ -46,8 +51,8 @@ These changes are available on the `master` branch, but have not yet been releas ([#2555](https://github.com/Pycord-Development/pycord/pull/2555)) - Fixed missing `stacklevel` parameter in `warn_deprecated` function call inside `@utils.deprecated`. ([#2500](https://github.com/Pycord-Development/pycord/pull/2500)) -- Fixed the type hint in `ConnectionState._polls` to reflect actual behavior, changing it - from `Guild` to `Poll`. +- Fixed the type hint in `ConnectionState._polls` to reflect actual behavior, changing + it from `Guild` to `Poll`. ([#2500](https://github.com/Pycord-Development/pycord/pull/2500)) - Fixed missing `__slots__` attributes in `RawReactionClearEmojiEvent` and `RawMessagePollVoteEvent`. diff --git a/discord/commands/options.py b/discord/commands/options.py index 721a03ffe3..382067421f 100644 --- a/discord/commands/options.py +++ b/discord/commands/options.py @@ -198,7 +198,7 @@ def __init__( enum_choices = [] input_type_is_class = isinstance(input_type, type) if input_type_is_class and issubclass(input_type, (Enum, DiscordEnum)): - if description is None: + if description is None and input_type.__doc__ is not None: description = inspect.cleandoc(input_type.__doc__) if description and len(description) > 100: description = description[:97] + "..." @@ -209,7 +209,9 @@ def __init__( ) enum_choices = [OptionChoice(e.name, e.value) for e in input_type] value_class = enum_choices[0].value.__class__ - if all(isinstance(elem.value, value_class) for elem in enum_choices): + if value_class in SlashCommandOptionType.__members__ and all( + isinstance(elem.value, value_class) for elem in enum_choices + ): input_type = SlashCommandOptionType.from_datatype( enum_choices[0].value.__class__ )