Skip to content

Commit

Permalink
fix: allow dm/gdm instances in default_values
Browse files Browse the repository at this point in the history
  • Loading branch information
shiftinv committed Sep 7, 2024
1 parent 14b5a85 commit de0ca0a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion disnake/ui/action_row.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ def add_channel_select(
channel_types: Optional[List[:class:`.ChannelType`]]
The list of channel types that can be selected in this select menu.
Defaults to all types (i.e. ``None``).
default_values: Optional[Sequence[Union[:class:`.abc.GuildChannel`, :class:`.Thread`, :class:`.PartialMessageable`, :class:`.SelectDefaultValue`, :class:`.Object`]]]
default_values: Optional[Sequence[Union[:class:`.abc.GuildChannel`, :class:`.Thread`, :class:`.abc.PrivateChannel`, :class:`.PartialMessageable`, :class:`.SelectDefaultValue`, :class:`.Object`]]]
The list of values (channels) that are selected by default.
If set, the number of items must be within the bounds set by ``min_values`` and ``max_values``.
Expand Down
15 changes: 11 additions & 4 deletions disnake/ui/select/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
)

from ...abc import GuildChannel, Snowflake
from ...channel import PartialMessageable
from ...channel import DMChannel, GroupChannel, PartialMessageable
from ...components import ChannelSelectMenu
from ...enums import ChannelType, ComponentType, SelectDefaultValueType
from ...object import Object
Expand Down Expand Up @@ -66,7 +66,7 @@ class ChannelSelect(BaseSelect[ChannelSelectMenu, "AnyChannel", V_co]):
channel_types: Optional[List[:class:`.ChannelType`]]
The list of channel types that can be selected in this select menu.
Defaults to all types (i.e. ``None``).
default_values: Optional[Sequence[Union[:class:`.abc.GuildChannel`, :class:`.Thread`, :class:`.PartialMessageable`, :class:`.SelectDefaultValue`, :class:`.Object`]]]
default_values: Optional[Sequence[Union[:class:`.abc.GuildChannel`, :class:`.Thread`, :class:`.abc.PrivateChannel`, :class:`.PartialMessageable`, :class:`.SelectDefaultValue`, :class:`.Object`]]]
The list of values (channels) that are selected by default.
If set, the number of items must be within the bounds set by ``min_values`` and ``max_values``.
Expand All @@ -89,7 +89,14 @@ class ChannelSelect(BaseSelect[ChannelSelectMenu, "AnyChannel", V_co]):
_default_value_type_map: ClassVar[
Mapping[SelectDefaultValueType, Tuple[Type[Snowflake], ...]]
] = {
SelectDefaultValueType.channel: (GuildChannel, Thread, PartialMessageable, Object),
SelectDefaultValueType.channel: (
GuildChannel,
Thread,
DMChannel,
GroupChannel,
PartialMessageable,
Object,
),
}

@overload
Expand Down Expand Up @@ -243,7 +250,7 @@ def channel_select(
channel_types: Optional[List[:class:`.ChannelType`]]
The list of channel types that can be selected in this select menu.
Defaults to all types (i.e. ``None``).
default_values: Optional[Sequence[Union[:class:`.abc.GuildChannel`, :class:`.Thread`, :class:`.PartialMessageable`, :class:`.SelectDefaultValue`, :class:`.Object`]]]
default_values: Optional[Sequence[Union[:class:`.abc.GuildChannel`, :class:`.Thread`, :class:`.abc.PrivateChannel`, :class:`.PartialMessageable`, :class:`.SelectDefaultValue`, :class:`.Object`]]]
The list of values (channels) that are selected by default.
If set, the number of items must be within the bounds set by ``min_values`` and ``max_values``.
Expand Down

0 comments on commit de0ca0a

Please sign in to comment.