Skip to content
This repository has been archived by the owner on Aug 1, 2021. It is now read-only.

Commit

Permalink
Add GuildMember.name property, returning nickname or username
Browse files Browse the repository at this point in the history
  • Loading branch information
b1naryth1ef committed Jan 26, 2017
1 parent 8216ec4 commit 835242c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion disco/types/guild.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

0 comments on commit 835242c

Please sign in to comment.