aboutsummaryrefslogtreecommitdiff
path: root/discord/client.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2017-01-04 05:16:59 -0500
committerRapptz <[email protected]>2017-01-04 05:16:59 -0500
commit808a05ff2dd37c63020d099827e4248b4e49059d (patch)
tree558b4198394be13f90e22556b3801e461496e9cd /discord/client.py
parentUpdate examples to match the new rewrite API. (diff)
downloaddiscord.py-808a05ff2dd37c63020d099827e4248b4e49059d.tar.xz
discord.py-808a05ff2dd37c63020d099827e4248b4e49059d.zip
Move global user cache to a WeakValueDictionary.
Diffstat (limited to 'discord/client.py')
-rw-r--r--discord/client.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/discord/client.py b/discord/client.py
index d35b9b3b..2e0696c9 100644
--- a/discord/client.py
+++ b/discord/client.py
@@ -507,14 +507,26 @@ class Client:
# helpers/getters
+ @property
+ def users(self):
+ """Returns a list of all the :class:`User` the bot can see."""
+ return list(self.connection._users.values())
+
def get_channel(self, id):
- """Returns a :class:`Channel` or :class:`PrivateChannel` with the following ID. If not found, returns None."""
+ """Returns a :class:`abc.GuildChannel` or :class:`abc.PrivateChannel` with the following ID.
+
+ If not found, returns None.
+ """
return self.connection.get_channel(id)
def get_guild(self, id):
"""Returns a :class:`Guild` with the given ID. If not found, returns None."""
return self.connection._get_guild(id)
+ def get_user(self, id):
+ """Returns a :class:`User` with the given ID. If not found, returns None."""
+ return self.connection.get_user(id)
+
def get_all_emojis(self):
"""Returns a generator with every :class:`Emoji` the client can see."""
for guild in self.guilds: