@@ -106,6 +106,10 @@ class Select(Generic[V, ST], Item[V]):
106
106
:attr:`discord.ComponentType.string_select`, :attr:`discord.ComponentType.user_select`,
107
107
:attr:`discord.ComponentType.role_select`, :attr:`discord.ComponentType.mentionable_select`,
108
108
or :attr:`discord.ComponentType.channel_select`.
109
+
110
+ The default is :attr:`discord.ComponentType.string`, but if this is created using any of the provided
111
+ aliases: :class:`StringSelect`, :class:`RoleSelect`, :class:`UserSelect`, :class:`MentionableSelect`, or
112
+ :class:`ChannelSelect`, the default will be its respective select type.
109
113
custom_id: :class:`str`
110
114
The ID of the select menu that gets received during an interaction.
111
115
If not given then one is generated for you.
@@ -217,7 +221,7 @@ def __init__(
217
221
@overload
218
222
def __init__ (
219
223
self ,
220
- select_type : Literal [ComponentType .channel_select ],
224
+ select_type : Literal [ComponentType .channel_select ] = ... ,
221
225
* ,
222
226
custom_id : str | None = ...,
223
227
placeholder : str | None = ...,
@@ -240,7 +244,7 @@ def __init__(
240
244
ComponentType .user_select ,
241
245
ComponentType .role_select ,
242
246
ComponentType .mentionable_select ,
243
- ],
247
+ ] = ... ,
244
248
* ,
245
249
custom_id : str | None = ...,
246
250
placeholder : str | None = ...,
@@ -766,7 +770,7 @@ def from_component(cls: type[S], component: SelectMenu) -> S:
766
770
id = component .id ,
767
771
required = component .required ,
768
772
default_values = component .default_values ,
769
- )
773
+ ) # type: ignore
770
774
771
775
@property
772
776
def type (self ) -> ComponentType :
@@ -784,29 +788,71 @@ def uses_label(self) -> bool:
784
788
785
789
if TYPE_CHECKING :
786
790
StringSelect = Select [V , str ]
787
- """A typed alias for :class:`Select` for string values."""
791
+ """A typed alias for :class:`Select` for string values.
792
+
793
+ When creating an instance with this, it will automatically provide the ``select_type``
794
+ parameter as a :attr:`discord.ComponentType.string_select`.
795
+ """
788
796
UserSelect = Select [V , User | Member ]
789
- """A typed alias for :class:`Select` for user-like values."""
797
+ """A typed alias for :class:`Select` for user-like values.
798
+
799
+ When creating an instance with this, it will automatically provide the ``select_type``
800
+ parameter as a :attr:`discord.ComponentType.user_select`.
801
+ """
790
802
RoleSelect = Select [V , Role ]
791
- """A typed alias for :class:`Select` for role values."""
803
+ """A typed alias for :class:`Select` for role values.
804
+
805
+ When creating an instance with this, it will automatically provide the ``select_type``
806
+ parameter as a :attr:`discord.ComponentType.role_select`.
807
+ """
792
808
MentionableSelect = Select [V , User | Member | Role ]
793
- """A typed alias for :class:`Select` for mentionable (role and user-like) values."""
809
+ """A typed alias for :class:`Select` for mentionable (role and user-like) values.
810
+
811
+ When creating an instance with this, it will automatically provide the ``select_type``
812
+ parameter as a :attr:`discord.ComponentType.mentionable_select`.
813
+ """
794
814
ChannelSelect = Select [V , GuildChannel | Thread ]
795
- """A typed alias for :class:`Select` for channel values."""
815
+ """A typed alias for :class:`Select` for channel values.
816
+
817
+ When creating an instance with this, it will automatically provide the ``select_type``
818
+ parameter as a :attr:`discord.ComponentType.channel_select`.
819
+ """
796
820
else :
797
- StringSelect : Select [V , str ] = partial (
821
+ class select_partial (partial ):
822
+ @property
823
+ def __class__ (self ) -> type [Select ]:
824
+ return Select
825
+
826
+ StringSelect : Select [V , str ] = select_partial (
798
827
Select , select_type = ComponentType .string_select
799
828
)
800
- UserSelect : Select [V , User | Member ] = partial (
829
+ """An alias for :class:`Select` that will pass :attr:`discord.ComponentType.string_select`
830
+ as its default ``select_type``.
831
+ """
832
+ UserSelect : Select [V , User | Member ] = select_partial (
801
833
Select , select_type = ComponentType .user_select
802
834
)
803
- RoleSelect : Select [V , Role ] = partial (Select , select_type = ComponentType .role_select )
804
- MentionableSelect : Select [V , Role | User | Member ] = partial (
835
+ """An alias for :class:`Select` that will pass :attr:`discord.ComponentType.user_select`
836
+ as its default ``select_type``.
837
+ """
838
+ RoleSelect : Select [V , Role ] = select_partial (Select , select_type = ComponentType .role_select )
839
+ """An alias for :class:`Select` that will pass :attr:`discord.ComponentType.role_select`
840
+ as its default ``select_type``.
841
+ """
842
+ MentionableSelect : Select [V , Role | User | Member ] = select_partial (
805
843
Select , select_type = ComponentType .mentionable_select
806
844
)
807
- ChannelSelect : Select [V , GuildChannel | Thread ] = partial (
845
+ """An alias for :class:`Select` that will pass :attr:`discord.ComponentType.mentionable_select`
846
+ as its default ``select_type``.
847
+ """
848
+ ChannelSelect : Select [V , GuildChannel | Thread ] = select_partial (
808
849
Select , select_type = ComponentType .channel_select
809
850
)
851
+ """An alias for :class:`Select` that will pass :attr:`discord.ComponentType.channel_select`
852
+ as its default ``select_type``.
853
+ """
854
+
855
+ select_partial .__bases__ = (Select , partial ) # lie to checkers
810
856
811
857
812
858
_select_types = (
0 commit comments