aboutsummaryrefslogtreecommitdiff
path: root/discord/components.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2021-07-04 21:19:09 -0400
committerRapptz <[email protected]>2021-07-04 21:20:48 -0400
commitfeb0f7f29d33610830a196ffb660fe3e1eb44f42 (patch)
tree0327d76b165edca3aa60960e6682d8594e698e9c /discord/components.py
parentFix typo in stage_instance.py (diff)
downloaddiscord.py-feb0f7f29d33610830a196ffb660fe3e1eb44f42.tar.xz
discord.py-feb0f7f29d33610830a196ffb660fe3e1eb44f42.zip
Add SelectOption.__str__
Diffstat (limited to 'discord/components.py')
-rw-r--r--discord/components.py10
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: