mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-07 10:22:59 +00:00
Add support for discord.ui.Select.disabled
This commit is contained in:
@ -226,6 +226,8 @@ class SelectMenu(Component):
|
||||
Defaults to 1 and must be between 1 and 25.
|
||||
options: List[:class:`SelectOption`]
|
||||
A list of options that can be selected in this menu.
|
||||
disabled: :class:`bool`
|
||||
Whether the select is disabled or not.
|
||||
"""
|
||||
|
||||
__slots__: Tuple[str, ...] = (
|
||||
@ -234,6 +236,7 @@ class SelectMenu(Component):
|
||||
'min_values',
|
||||
'max_values',
|
||||
'options',
|
||||
'disabled',
|
||||
)
|
||||
|
||||
__repr_info__: ClassVar[Tuple[str, ...]] = __slots__
|
||||
@ -245,6 +248,7 @@ class SelectMenu(Component):
|
||||
self.min_values: int = data.get('min_values', 1)
|
||||
self.max_values: int = data.get('max_values', 1)
|
||||
self.options: List[SelectOption] = [SelectOption.from_dict(option) for option in data.get('options', [])]
|
||||
self.disabled: bool = data.get('disabled', False)
|
||||
|
||||
def to_dict(self) -> SelectMenuPayload:
|
||||
payload: SelectMenuPayload = {
|
||||
@ -253,6 +257,7 @@ class SelectMenu(Component):
|
||||
'min_values': self.min_values,
|
||||
'max_values': self.max_values,
|
||||
'options': [op.to_dict() for op in self.options],
|
||||
'disabled': self.disabled,
|
||||
}
|
||||
|
||||
if self.placeholder:
|
||||
|
Reference in New Issue
Block a user