Skip to content
Merged
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ These changes are available on the `master` branch, but have not yet been releas
([#2079](https://github.com/Pycord-Development/pycord/pull/2079))
- Fixed `HTTPException` when trying to create a forum thread with files.
([#2075](https://github.com/Pycord-Development/pycord/pull/2075))
- Fixed `AttributeError` when accessing a `Select`'s values when it hasn't been
interacted with. ([#2104](https://github.com/Pycord-Development/pycord/pull/2104))

## [2.4.1] - 2023-03-20

Expand Down
9 changes: 6 additions & 3 deletions discord/ui/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,10 +334,13 @@ def values(
| list[Member | User | Role]
| list[GuildChannel | Thread]
):
"""Union[List[:class:`str`], List[Union[:class:`discord.Member`, :class:`discord.User`]], List[:class:`discord.Role`]],
List[Union[:class:`discord.Member`, :class:`discord.User`, :class:`discord.Role`]], List[:class:`discord.abc.GuildChannel`]]:
A list of values that have been selected by the user.
"""List[:class:`str`] | List[:class:`discord.Member` | :class:`discord.User`]] | List[:class:`discord.Role`]] |
List[:class:`discord.Member` | :class:`discord.User` | :class:`discord.Role`]] | List[:class:`discord.abc.GuildChannel`] | None:
A list of values that have been selected by the user. This will be ``None`` if the select has not been interacted with yet.
"""
if self._interaction is None:
# The select has not been interacted with yet
return None
select_type = self._underlying.type
if select_type is ComponentType.string_select:
return self._selected_values
Expand Down