aboutsummaryrefslogtreecommitdiff
path: root/discord/user.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2015-12-17 00:30:08 -0500
committerRapptz <[email protected]>2015-12-17 00:32:54 -0500
commit51d91c2a82e01275d1c1d888319f1db14dc11791 (patch)
tree80aeac8f9a7d2c9be21e775c9185bec34cb10756 /discord/user.py
parentAdd Message.clean_content property to get prettified mentions. (diff)
downloaddiscord.py-51d91c2a82e01275d1c1d888319f1db14dc11791.tar.xz
discord.py-51d91c2a82e01275d1c1d888319f1db14dc11791.zip
Most data classes now support hashing.
Diffstat (limited to 'discord/user.py')
-rw-r--r--discord/user.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/discord/user.py b/discord/user.py
index a5ef2edb..d2f149c3 100644
--- a/discord/user.py
+++ b/discord/user.py
@@ -36,6 +36,8 @@ class User:
+-----------+------------------------------------+
| x != y | Checks if two users are not equal. |
+-----------+------------------------------------+
+ | hash(x) | Return the user's hash. |
+ +-----------+------------------------------------+
| str(x) | Returns the user's name. |
+-----------+------------------------------------+
@@ -66,6 +68,9 @@ class User:
def __ne__(self, other):
return not self.__eq__(other)
+ def __hash__(self):
+ return hash(self.id)
+
@property
def avatar_url(self):
"""Returns a friendly URL version of the avatar variable the user has. An empty string if