diff options
Diffstat (limited to 'discord/user.py')
| -rw-r--r-- | discord/user.py | 59 |
1 files changed, 33 insertions, 26 deletions
diff --git a/discord/user.py b/discord/user.py index 21358267..0b5fcb0d 100644 --- a/discord/user.py +++ b/discord/user.py @@ -114,7 +114,7 @@ class BaseUser(_BaseUser): @property def avatar_url(self): - """Returns a :class:`Asset` for the avatar the user has. + """Returns an :class:`Asset` for the avatar the user has. If the user does not have a traditional avatar, an asset for the default avatar is returned instead. @@ -125,11 +125,11 @@ class BaseUser(_BaseUser): return self.avatar_url_as(format=None, size=1024) def is_avatar_animated(self): - """:class:`bool`: Returns True if the user has an animated avatar.""" + """Indicates if the user has an animated avatar.""" return bool(self.avatar and self.avatar.startswith('a_')) def avatar_url_as(self, *, format=None, static_format='webp', size=1024): - """Returns a :class:`Asset` for the avatar the user has. + """Returns an :class:`Asset` for the avatar the user has. If the user does not have a traditional avatar, an asset for the default avatar is returned instead. @@ -166,28 +166,35 @@ class BaseUser(_BaseUser): @property def default_avatar(self): - """Returns the default avatar for a given user. This is calculated by the user's discriminator""" + """class:`DefaultAvatar`: Returns the default avatar for a given user. This is calculated by the user's discriminator.""" return try_enum(DefaultAvatar, int(self.discriminator) % len(DefaultAvatar)) @property def default_avatar_url(self): - """Returns a URL for a user's default avatar.""" + """:class:`Asset`: Returns a URL for a user's default avatar.""" return Asset(self._state, 'https://cdn.discordapp.com/embed/avatars/{}.png'.format(self.default_avatar.value)) @property def colour(self): - """A property that returns a :class:`Colour` denoting the rendered colour + """:class:`Colour`: A property that returns a colour denoting the rendered colour for the user. This always returns :meth:`Colour.default`. - There is an alias for this under ``color``. + There is an alias for this named :meth:`color`. """ return Colour.default() - color = colour + @property + def color(self): + """:class:`Colour`: A property that returns a color denoting the rendered color + for the user. This always returns :meth:`Colour.default`. + + There is an alias for this named :meth:`colour`. + """ + return self.colour @property def mention(self): - """Returns a string that allows you to mention the given user.""" + """:class:`str`: Returns a string that allows you to mention the given user.""" return '<@{0.id}>'.format(self) def permissions_in(self, channel): @@ -208,14 +215,14 @@ class BaseUser(_BaseUser): @property def created_at(self): - """Returns the user's creation time in UTC. + """:class:`datetime.datetime`: Returns the user's creation time in UTC. 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. + """:class:`str`: Returns the user's display name. For regular users this is just their username, but if they have a guild specific nickname then that @@ -324,13 +331,13 @@ class ClientUser(BaseUser): Returns -------- Optional[:class:`Relationship`] - The relationship if available or ``None`` + The relationship if available or ``None``. """ return self._relationships.get(user_id) @property def relationships(self): - """Returns a :class:`list` of :class:`Relationship` that the user has. + """List[:class:`User`]: Returns all the relationships that the user has. .. note:: @@ -340,7 +347,7 @@ class ClientUser(BaseUser): @property def friends(self): - r"""Returns a :class:`list` of :class:`User`\s that the user is friends with. + r"""List[:class:`User`]: Returns all the users that the user is friends with. .. note:: @@ -350,7 +357,7 @@ class ClientUser(BaseUser): @property def blocked(self): - r"""Returns a :class:`list` of :class:`User`\s that the user has blocked. + r"""List[:class:`User`]: Returns all the users that the user has blocked. .. note:: @@ -366,14 +373,14 @@ class ClientUser(BaseUser): If a bot account is used then a password field is optional, otherwise it is required. - Note - ----- - To upload an avatar, a :term:`py:bytes-like object` must be passed in that - represents the image being uploaded. If this is done through a file - then the file must be opened via ``open('some_filename', 'rb')`` and - the :term:`py:bytes-like object` is given through the use of ``fp.read()``. + .. note:: + + To upload an avatar, a :term:`py:bytes-like object` must be passed in that + represents the image being uploaded. If this is done through a file + then the file must be opened via ``open('some_filename', 'rb')`` and + the :term:`py:bytes-like object` is given through the use of ``fp.read()``. - The only image formats supported for uploading is JPEG and PNG. + The only image formats supported for uploading is JPEG and PNG. Parameters ----------- @@ -542,7 +549,7 @@ class ClientUser(BaseUser): inline_embed_media: :class:`bool` Whether or not to display videos and images from links posted in chat. locale: :class:`str` - The RFC 3066 language identifier of the locale to use for the language + The :rfc:`3066` language identifier of the locale to use for the language of the Discord client. message_display_compact: :class:`bool` Whether or not to use the compact Discord display mode. @@ -654,7 +661,7 @@ class User(BaseUser, discord.abc.Messageable): @property def dm_channel(self): - """Returns the :class:`DMChannel` associated with this user if it exists. + """Optional[:class:`DMChannel`]: Returns the channel associated with this user if it exists. If this returns ``None``, you can create a DM channel by calling the :meth:`create_dm` coroutine function. @@ -711,7 +718,7 @@ class User(BaseUser, discord.abc.Messageable): return [User(state=state, data=friend) for friend in mutuals] def is_friend(self): - """:class:`bool`: Checks if the user is your friend. + """Checks if the user is your friend. .. note:: @@ -723,7 +730,7 @@ class User(BaseUser, discord.abc.Messageable): return r.type is RelationshipType.friend def is_blocked(self): - """:class:`bool`: Checks if the user is blocked. + """Checks if the user is blocked. .. note:: |