diff options
| author | Rapptz <[email protected]> | 2017-02-10 15:46:00 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2017-02-10 16:43:33 -0500 |
| commit | 0dac5e31392710fa76cdc72f4307cc3f3d7a429c (patch) | |
| tree | 6e86f9c9b76bba4492db8acba8355c21b0eb35d7 | |
| parent | Fix NameError in GroupChannel. (diff) | |
| download | discord.py-0dac5e31392710fa76cdc72f4307cc3f3d7a429c.tar.xz discord.py-0dac5e31392710fa76cdc72f4307cc3f3d7a429c.zip | |
Add Client.emojis to get all emojis.
This removes the older get_all_emojis generator.
| -rw-r--r-- | discord/client.py | 11 | ||||
| -rw-r--r-- | discord/state.py | 4 |
2 files changed, 9 insertions, 6 deletions
diff --git a/discord/client.py b/discord/client.py index 5931c22b..9d7903e0 100644 --- a/discord/client.py +++ b/discord/client.py @@ -174,6 +174,11 @@ class Client: return self.connection.guilds @property + def emojis(self): + """List[:class:`Emoji`]: The emojis that the connected client has.""" + return self.connection.emojis + + @property def private_channels(self): """List[:class:`abc.PrivateChannel`]: The private channels that the connected client is participating on.""" return self.connection.private_channels @@ -478,12 +483,6 @@ class Client: """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: - for emoji in guild.emojis: - yield emoji - def get_all_channels(self): """A generator that retrieves every :class:`Channel` the client can 'access'. diff --git a/discord/state.py b/discord/state.py index 5a10a185..2d02da60 100644 --- a/discord/state.py +++ b/discord/state.py @@ -161,6 +161,10 @@ class ConnectionState: self._guilds.pop(guild.id, None) @property + def emojis(self): + return list(self._emojis) + + @property def private_channels(self): return list(self._private_channels.values()) |