diff options
| author | Rapptz <[email protected]> | 2015-12-13 20:05:58 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2015-12-13 20:05:58 -0500 |
| commit | ab46afee1db869046375f3e1c26b0cdb4dfdb3b7 (patch) | |
| tree | f29aa1bef8f2c409d6bc53c46e9b91032bb339ad | |
| parent | Editing profile now writes to the cache. (diff) | |
| download | discord.py-ab46afee1db869046375f3e1c26b0cdb4dfdb3b7.tar.xz discord.py-ab46afee1db869046375f3e1c26b0cdb4dfdb3b7.zip | |
Changed functions that return a constant value into properties.
| -rw-r--r-- | discord/channel.py | 1 | ||||
| -rw-r--r-- | discord/server.py | 1 | ||||
| -rw-r--r-- | discord/user.py | 2 |
3 files changed, 4 insertions, 0 deletions
diff --git a/discord/channel.py b/discord/channel.py index 7204d31f..edb45817 100644 --- a/discord/channel.py +++ b/discord/channel.py @@ -99,6 +99,7 @@ class Channel: """bool : Indicates if this is the default channel for the :class:`Server` it belongs to.""" return self.server.id == self.id + @property def mention(self): """str : The string that allows you to mention the channel.""" return '<#{0.id}>'.format(self) diff --git a/discord/server.py b/discord/server.py index 9e0a796f..456f4ca9 100644 --- a/discord/server.py +++ b/discord/server.py @@ -141,6 +141,7 @@ class Server: """Gets the default :class:`Channel` for the server.""" return utils.find(lambda c: c.is_default_channel(), self.channels) + @property def icon_url(self): """Returns the URL version of the server's icon. Returns an empty string if it has no icon.""" if self.icon is None: diff --git a/discord/user.py b/discord/user.py index 35f39d94..973a9ae2 100644 --- a/discord/user.py +++ b/discord/user.py @@ -68,6 +68,7 @@ class User(object): return other.id != self.id return False + @property def avatar_url(self): """Returns a friendly URL version of the avatar variable the user has. An empty string if the user has no avatar.""" @@ -75,6 +76,7 @@ class User(object): return '' return 'https://discordapp.com/api/users/{0.id}/avatars/{0.avatar}.jpg'.format(self) + @property def mention(self): """Returns a string that allows you to mention the given user.""" return '<@{0.id}>'.format(self) |