11from __future__ import annotations
22
33from functools import partial
4+ from collections .abc import Sequence
45from typing import TYPE_CHECKING , ClassVar , Iterator , TypeVar
56
67from ..components import ActionRow as ActionRowComponent
7- from ..components import SelectOption , _component_factory
8+ from ..components import SelectOption , SelectDefaultValue , _component_factory
89from ..enums import ButtonStyle , ChannelType , ComponentType
910from ..utils import find , get
1011from .button import Button
@@ -210,6 +211,53 @@ def add_button(
210211
211212 return self .add_item (button )
212213
214+ @overload
215+ def add_select (
216+ self ,
217+ select_type : Literal [ComponentType .string_select ] = ...,
218+ * ,
219+ custom_id : str | None = ...,
220+ placeholder : str | None = ...,
221+ min_values : int = ...,
222+ max_values : int = ...,
223+ options : list [SelectOption ] | None = ...,
224+ disabled : bool = ...,
225+ id : int | None = ...,
226+ ) -> None : ...
227+
228+ @overload
229+ def add_select (
230+ self ,
231+ select_type : Literal [ComponentType .channel_select ] = ...,
232+ * ,
233+ custom_id : str | None = ...,
234+ placeholder : str | None = ...,
235+ min_values : int = ...,
236+ max_values : int = ...,
237+ channel_types : list [ChannelType ] | None = ...,
238+ disabled : bool = ...,
239+ id : int | None = ...,
240+ default_values : Sequence [SelectDefaultValue ] | None = ...,
241+ ) -> None : ...
242+
243+ @overload
244+ def add_select (
245+ self ,
246+ select_type : Literal [
247+ ComponentType .user_select ,
248+ ComponentType .role_select ,
249+ ComponentType .mentionable_select ,
250+ ] = ...,
251+ * ,
252+ custom_id : str | None = ...,
253+ placeholder : str | None = ...,
254+ min_values : int = ...,
255+ max_values : int = ...,
256+ disabled : bool = ...,
257+ id : int | None = ...,
258+ default_values : Sequence [SelectDefaultValue ] | None = ...,
259+ ) -> None : ...
260+
213261 def add_select (
214262 self ,
215263 select_type : ComponentType = ComponentType .string_select ,
@@ -222,6 +270,7 @@ def add_select(
222270 channel_types : list [ChannelType ] | None = None ,
223271 disabled : bool = False ,
224272 id : int | None = None ,
273+ default_values : Sequence [SelectDefaultValue ] | None = None ,
225274 ) -> Self :
226275 """Adds a :class:`Select` to the container.
227276
@@ -256,6 +305,11 @@ def add_select(
256305 Whether the select is disabled or not. Defaults to ``False``.
257306 id: Optional[:class:`int`]
258307 The select menu's ID.
308+ default_values: Optional[Sequence[Union[:class:`discord.SelectDefaultValue`, :class:`discord.abc.Snowflake`]]]
309+ The default values of this select. Only applicable if :attr:`.select_type` is not :attr:`discord.ComponentType.string_select`.
310+
311+ These can be either :class:`discord.SelectDefaultValue` instances or models, which will be converted into :class:`discord.SelectDefaultValue`
312+ instances.
259313 """
260314
261315 select = Select (
@@ -268,6 +322,7 @@ def add_select(
268322 channel_types = channel_types or [],
269323 disabled = disabled ,
270324 id = id ,
325+ default_values = default_values
271326 )
272327
273328 return self .add_item (select )
0 commit comments