diff options
| author | Rapptz <[email protected]> | 2021-05-30 03:20:29 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2021-05-30 03:20:29 -0400 |
| commit | 1b1577267129fcf7afa7704832158b391700c1c1 (patch) | |
| tree | 930abdd04d233cb689ad981f2fd5bf0545f6878a | |
| parent | Fix Message.edit typings to take View parameters (diff) | |
| download | discord.py-1b1577267129fcf7afa7704832158b391700c1c1.tar.xz discord.py-1b1577267129fcf7afa7704832158b391700c1c1.zip | |
Allow assigning Select.options to refresh the select menu
| -rw-r--r-- | discord/ui/select.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/discord/ui/select.py b/discord/ui/select.py index e37b55c0..552982ec 100644 --- a/discord/ui/select.py +++ b/discord/ui/select.py @@ -160,6 +160,15 @@ class Select(Item[V]): """List[:class:`discord.SelectOption`]: A list of options that can be selected in this menu.""" return self._underlying.options + @options.setter + def options(self, value: List[SelectOption]): + if not isinstance(value, list): + raise TypeError('options must be a list of SelectOption') + if not all(isinstance(obj, SelectOption) for obj in value): + raise TypeError('all list items must subclass SelectOption') + + self._underlying.options = value + def add_option( self, *, |