aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2020-01-15 09:26:47 -0500
committerRapptz <[email protected]>2020-01-15 09:27:32 -0500
commit23f16618fdf5fcbeeefed7acb56b579e74bc88d8 (patch)
treefe07bda51ee95e3187f12902cd9341758615d2b7
parent[docs] Fix sphinx warning about heading (diff)
downloaddiscord.py-23f16618fdf5fcbeeefed7acb56b579e74bc88d8.tar.xz
discord.py-23f16618fdf5fcbeeefed7acb56b579e74bc88d8.zip
Make CustomActivity.__str__ not raise errors and match the client
-rw-r--r--discord/activity.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/discord/activity.py b/discord/activity.py
index 6f724199..5b2861bb 100644
--- a/discord/activity.py
+++ b/discord/activity.py
@@ -724,7 +724,12 @@ class CustomActivity(BaseActivity):
return hash((self.name, str(self.emoji)))
def __str__(self):
- return self.name
+ if self.emoji:
+ if self.name:
+ return '%s %s' % (self.emoji, self.name)
+ return str(self.emoji)
+ else:
+ return str(self.name)
def __repr__(self):
return '<CustomActivity name={0.name!r} emoji={0.emoji!r}>'.format(self)