Add support for discord.ui.Select.disabled

This commit is contained in:
Lucas Hardt
2021-07-29 01:58:39 +02:00
committed by GitHub
parent 41e2d3c637
commit ca9b371982
3 changed files with 27 additions and 1 deletions

View File

@ -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: