Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ These changes are available on the `master` branch, but have not yet been releas
([#3105](https://github.com/Pycord-Development/pycord/pull/3105))
- Fixed the update of a user's `avatar_decoration` to now cause an `on_user_update`
event to fire. ([#3103](https://github.com/Pycord-Development/pycord/pull/3103))
- Fixed `TypeError` when using `Literal` type hints with the `option` decorator without
explicitly passing `input_type`.
([#3123](https://github.com/Pycord-Development/pycord/pull/3123))

### Deprecated

Expand Down
4 changes: 4 additions & 0 deletions discord/commands/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
TypeVar,
Union,
get_args,
get_origin,
)

if sys.version_info >= (3, 12):
Expand Down Expand Up @@ -226,6 +227,9 @@ def __init__(
self._parameter_name = self.name # default
input_type = self._parse_type_alias(input_type)
input_type = self._strip_none_type(input_type)
if get_origin(input_type) is Literal:
args = get_args(input_type)
input_type = type(args[0]) if args else str
self._raw_type: InputType | tuple = input_type

enum_choices = []
Expand Down
Loading