|
|
@ -239,6 +239,7 @@ class BaseSelect(Item[V]): |
|
|
|
options: List[SelectOption] = MISSING, |
|
|
|
channel_types: List[ChannelType] = MISSING, |
|
|
|
default_values: Sequence[SelectDefaultValue] = MISSING, |
|
|
|
id: Optional[int] = None, |
|
|
|
) -> None: |
|
|
|
super().__init__() |
|
|
|
self._provided_custom_id = custom_id is not MISSING |
|
|
@ -259,7 +260,7 @@ class BaseSelect(Item[V]): |
|
|
|
) |
|
|
|
|
|
|
|
self.row = row |
|
|
|
self.id = custom_id if custom_id is not MISSING else None |
|
|
|
self.id = id |
|
|
|
self._parent: Optional[ActionRow] = None |
|
|
|
self._values: List[PossibleValue] = [] |
|
|
|
|
|
|
@ -393,6 +394,10 @@ class Select(BaseSelect[V]): |
|
|
|
like to control the relative positioning of the row then passing an index is advised. |
|
|
|
For example, row=1 will show up before row=2. Defaults to ``None``, which is automatic |
|
|
|
ordering. The row number must be between 0 and 4 (i.e. zero indexed). |
|
|
|
id: Optional[:class:`int`] |
|
|
|
The ID of the component. This must be unique across the view. |
|
|
|
|
|
|
|
.. versionadded:: 2.6 |
|
|
|
""" |
|
|
|
|
|
|
|
__component_attributes__ = BaseSelect.__component_attributes__ + ('options',) |
|
|
@ -407,6 +412,7 @@ class Select(BaseSelect[V]): |
|
|
|
options: List[SelectOption] = MISSING, |
|
|
|
disabled: bool = False, |
|
|
|
row: Optional[int] = None, |
|
|
|
id: Optional[int] = None, |
|
|
|
) -> None: |
|
|
|
super().__init__( |
|
|
|
self.type, |
|
|
@ -417,6 +423,7 @@ class Select(BaseSelect[V]): |
|
|
|
disabled=disabled, |
|
|
|
options=options, |
|
|
|
row=row, |
|
|
|
id=id, |
|
|
|
) |
|
|
|
|
|
|
|
@property |
|
|
@ -548,6 +555,10 @@ class UserSelect(BaseSelect[V]): |
|
|
|
like to control the relative positioning of the row then passing an index is advised. |
|
|
|
For example, row=1 will show up before row=2. Defaults to ``None``, which is automatic |
|
|
|
ordering. The row number must be between 0 and 4 (i.e. zero indexed). |
|
|
|
id: Optional[:class:`int`] |
|
|
|
The ID of the component. This must be unique across the view. |
|
|
|
|
|
|
|
.. versionadded:: 2.6 |
|
|
|
""" |
|
|
|
|
|
|
|
__component_attributes__ = BaseSelect.__component_attributes__ + ('default_values',) |
|
|
@ -562,6 +573,7 @@ class UserSelect(BaseSelect[V]): |
|
|
|
disabled: bool = False, |
|
|
|
row: Optional[int] = None, |
|
|
|
default_values: Sequence[ValidDefaultValues] = MISSING, |
|
|
|
id: Optional[int] = None, |
|
|
|
) -> None: |
|
|
|
super().__init__( |
|
|
|
self.type, |
|
|
@ -572,6 +584,7 @@ class UserSelect(BaseSelect[V]): |
|
|
|
disabled=disabled, |
|
|
|
row=row, |
|
|
|
default_values=_handle_select_defaults(default_values, self.type), |
|
|
|
id=id, |
|
|
|
) |
|
|
|
|
|
|
|
@property |
|
|
@ -640,6 +653,10 @@ class RoleSelect(BaseSelect[V]): |
|
|
|
like to control the relative positioning of the row then passing an index is advised. |
|
|
|
For example, row=1 will show up before row=2. Defaults to ``None``, which is automatic |
|
|
|
ordering. The row number must be between 0 and 4 (i.e. zero indexed). |
|
|
|
id: Optional[:class:`int`] |
|
|
|
The ID of the component. This must be unique across the view. |
|
|
|
|
|
|
|
.. versionadded:: 2.6 |
|
|
|
""" |
|
|
|
|
|
|
|
__component_attributes__ = BaseSelect.__component_attributes__ + ('default_values',) |
|
|
@ -654,6 +671,7 @@ class RoleSelect(BaseSelect[V]): |
|
|
|
disabled: bool = False, |
|
|
|
row: Optional[int] = None, |
|
|
|
default_values: Sequence[ValidDefaultValues] = MISSING, |
|
|
|
id: Optional[int] = None, |
|
|
|
) -> None: |
|
|
|
super().__init__( |
|
|
|
self.type, |
|
|
@ -664,6 +682,7 @@ class RoleSelect(BaseSelect[V]): |
|
|
|
disabled=disabled, |
|
|
|
row=row, |
|
|
|
default_values=_handle_select_defaults(default_values, self.type), |
|
|
|
id=id, |
|
|
|
) |
|
|
|
|
|
|
|
@property |
|
|
@ -728,6 +747,10 @@ class MentionableSelect(BaseSelect[V]): |
|
|
|
like to control the relative positioning of the row then passing an index is advised. |
|
|
|
For example, row=1 will show up before row=2. Defaults to ``None``, which is automatic |
|
|
|
ordering. The row number must be between 0 and 4 (i.e. zero indexed). |
|
|
|
id: Optional[:class:`int`] |
|
|
|
The ID of the component. This must be unique across the view. |
|
|
|
|
|
|
|
.. versionadded:: 2.6 |
|
|
|
""" |
|
|
|
|
|
|
|
__component_attributes__ = BaseSelect.__component_attributes__ + ('default_values',) |
|
|
@ -742,6 +765,7 @@ class MentionableSelect(BaseSelect[V]): |
|
|
|
disabled: bool = False, |
|
|
|
row: Optional[int] = None, |
|
|
|
default_values: Sequence[ValidDefaultValues] = MISSING, |
|
|
|
id: Optional[int] = None, |
|
|
|
) -> None: |
|
|
|
super().__init__( |
|
|
|
self.type, |
|
|
@ -752,6 +776,7 @@ class MentionableSelect(BaseSelect[V]): |
|
|
|
disabled=disabled, |
|
|
|
row=row, |
|
|
|
default_values=_handle_select_defaults(default_values, self.type), |
|
|
|
id=id, |
|
|
|
) |
|
|
|
|
|
|
|
@property |
|
|
@ -822,6 +847,10 @@ class ChannelSelect(BaseSelect[V]): |
|
|
|
like to control the relative positioning of the row then passing an index is advised. |
|
|
|
For example, row=1 will show up before row=2. Defaults to ``None``, which is automatic |
|
|
|
ordering. The row number must be between 0 and 4 (i.e. zero indexed). |
|
|
|
id: Optional[:class:`int`] |
|
|
|
The ID of the component. This must be unique across the view. |
|
|
|
|
|
|
|
.. versionadded:: 2.6 |
|
|
|
""" |
|
|
|
|
|
|
|
__component_attributes__ = BaseSelect.__component_attributes__ + ( |
|
|
@ -840,6 +869,7 @@ class ChannelSelect(BaseSelect[V]): |
|
|
|
disabled: bool = False, |
|
|
|
row: Optional[int] = None, |
|
|
|
default_values: Sequence[ValidDefaultValues] = MISSING, |
|
|
|
id: Optional[int] = None, |
|
|
|
) -> None: |
|
|
|
super().__init__( |
|
|
|
self.type, |
|
|
@ -851,6 +881,7 @@ class ChannelSelect(BaseSelect[V]): |
|
|
|
row=row, |
|
|
|
channel_types=channel_types, |
|
|
|
default_values=_handle_select_defaults(default_values, self.type), |
|
|
|
id=id, |
|
|
|
) |
|
|
|
|
|
|
|
@property |
|
|
@ -902,6 +933,7 @@ def select( |
|
|
|
max_values: int = ..., |
|
|
|
disabled: bool = ..., |
|
|
|
row: Optional[int] = ..., |
|
|
|
id: Optional[int] = ..., |
|
|
|
) -> SelectCallbackDecorator[V, SelectT]: |
|
|
|
... |
|
|
|
|
|
|
@ -919,6 +951,7 @@ def select( |
|
|
|
disabled: bool = ..., |
|
|
|
default_values: Sequence[ValidDefaultValues] = ..., |
|
|
|
row: Optional[int] = ..., |
|
|
|
id: Optional[int] = ..., |
|
|
|
) -> SelectCallbackDecorator[V, UserSelectT]: |
|
|
|
... |
|
|
|
|
|
|
@ -936,6 +969,7 @@ def select( |
|
|
|
disabled: bool = ..., |
|
|
|
default_values: Sequence[ValidDefaultValues] = ..., |
|
|
|
row: Optional[int] = ..., |
|
|
|
id: Optional[int] = ..., |
|
|
|
) -> SelectCallbackDecorator[V, RoleSelectT]: |
|
|
|
... |
|
|
|
|
|
|
@ -953,6 +987,7 @@ def select( |
|
|
|
disabled: bool = ..., |
|
|
|
default_values: Sequence[ValidDefaultValues] = ..., |
|
|
|
row: Optional[int] = ..., |
|
|
|
id: Optional[int] = ..., |
|
|
|
) -> SelectCallbackDecorator[V, ChannelSelectT]: |
|
|
|
... |
|
|
|
|
|
|
@ -970,6 +1005,7 @@ def select( |
|
|
|
disabled: bool = ..., |
|
|
|
default_values: Sequence[ValidDefaultValues] = ..., |
|
|
|
row: Optional[int] = ..., |
|
|
|
id: Optional[int] = ..., |
|
|
|
) -> SelectCallbackDecorator[V, MentionableSelectT]: |
|
|
|
... |
|
|
|
|
|
|
@ -986,6 +1022,7 @@ def select( |
|
|
|
disabled: bool = False, |
|
|
|
default_values: Sequence[ValidDefaultValues] = MISSING, |
|
|
|
row: Optional[int] = None, |
|
|
|
id: Optional[int] = None, |
|
|
|
) -> SelectCallbackDecorator[V, BaseSelectT]: |
|
|
|
"""A decorator that attaches a select menu to a component. |
|
|
|
|
|
|
@ -1065,6 +1102,10 @@ def select( |
|
|
|
Number of items must be in range of ``min_values`` and ``max_values``. |
|
|
|
|
|
|
|
.. versionadded:: 2.4 |
|
|
|
id: Optional[:class:`int`] |
|
|
|
The ID of the component. This must be unique across the view. |
|
|
|
|
|
|
|
.. versionadded:: 2.6 |
|
|
|
""" |
|
|
|
|
|
|
|
def decorator(func: ItemCallbackType[V, BaseSelectT]) -> ItemCallbackType[V, BaseSelectT]: |
|
|
@ -1083,6 +1124,7 @@ def select( |
|
|
|
'min_values': min_values, |
|
|
|
'max_values': max_values, |
|
|
|
'disabled': disabled, |
|
|
|
'id': id, |
|
|
|
} |
|
|
|
if issubclass(callback_cls, Select): |
|
|
|
func.__discord_ui_model_kwargs__['options'] = options |
|
|
|