From 835242c2413eca8f3f378b5c67ec5c3c10b6e330 Mon Sep 17 00:00:00 2001 From: Andrei Date: Thu, 26 Jan 2017 02:34:53 -0800 Subject: [PATCH] Add GuildMember.name property, returning nickname or username --- disco/types/guild.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/disco/types/guild.py b/disco/types/guild.py index 95baa3f0..0d2952e3 100644 --- a/disco/types/guild.py +++ b/disco/types/guild.py @@ -147,6 +147,13 @@ class GuildMember(SlottedModel): def __str__(self): return self.user.__str__() + @property + def name(self): + """ + The nickname of this user if set, otherwise their username + """ + return self.nick or self.user.username + def get_voice_state(self): """ Returns @@ -408,4 +415,3 @@ def create_ban(self, user, delete_message_days=0): def create_channel(self, *args, **kwargs): return self.client.api.guilds_channels_create(self.id, *args, **kwargs) -