diff options
| author | Rapptz <[email protected]> | 2021-07-04 21:19:09 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2021-07-04 21:20:48 -0400 |
| commit | feb0f7f29d33610830a196ffb660fe3e1eb44f42 (patch) | |
| tree | 0327d76b165edca3aa60960e6682d8594e698e9c /discord/components.py | |
| parent | Fix typo in stage_instance.py (diff) | |
| download | discord.py-feb0f7f29d33610830a196ffb660fe3e1eb44f42.tar.xz discord.py-feb0f7f29d33610830a196ffb660fe3e1eb44f42.zip | |
Add SelectOption.__str__
Diffstat (limited to 'discord/components.py')
| -rw-r--r-- | discord/components.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/discord/components.py b/discord/components.py index 789466cf..1ddf7863 100644 --- a/discord/components.py +++ b/discord/components.py @@ -324,6 +324,16 @@ class SelectOption: f'emoji={self.emoji!r} default={self.default!r}>' ) + def __str__(self) -> str: + if self.emoji: + base = f'{self.emoji} {self.label}' + else: + base = self.label + + if self.description: + return f'{base}\n{self.description}' + return base + @classmethod def from_dict(cls, data: SelectOptionPayload) -> SelectOption: try: |