aboutsummaryrefslogtreecommitdiff
path: root/discord/user.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2016-04-29 06:39:21 -0400
committerRapptz <[email protected]>2016-04-29 06:39:21 -0400
commit133e8d3a447d7bb012cb8a97b0aeef12d4ac9025 (patch)
tree1e83026a6485b9cd941f84e163b40871f328f2e1 /discord/user.py
parentAdd permissions for changing or managing nicknames. (diff)
downloaddiscord.py-133e8d3a447d7bb012cb8a97b0aeef12d4ac9025.tar.xz
discord.py-133e8d3a447d7bb012cb8a97b0aeef12d4ac9025.zip
Add support for server specific nicknames.
Diffstat (limited to 'discord/user.py')
-rw-r--r--discord/user.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/discord/user.py b/discord/user.py
index 822f7be1..b1cc0b4c 100644
--- a/discord/user.py
+++ b/discord/user.py
@@ -125,3 +125,14 @@ class User:
This is when the user's discord account was created."""
return snowflake_time(self.id)
+ @property
+ def display_name(self):
+ """Returns the user's display name.
+
+ For regular users this is just their username, but
+ if they have a server specific nickname then that
+ is returned instead.
+ """
+ nickname = getattr(self, 'nick', None)
+ return nickname if nickname is not None else self.name
+