aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIo Mintz <[email protected]>2019-09-20 01:24:16 +0000
committerDanny <[email protected]>2019-09-19 21:24:16 -0400
commit3cef1e09f81c36137ffb5c576b244301d26df61a (patch)
treedc522efad0a215e80d90e0bf5f0a0d135b9dd7fb
parentAdd self_stream property to VoiceState object. (diff)
downloaddiscord.py-3cef1e09f81c36137ffb5c576b244301d26df61a.tar.xz
discord.py-3cef1e09f81c36137ffb5c576b244301d26df61a.zip
Add Emoji.is_usable()
-rw-r--r--discord/emoji.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/discord/emoji.py b/discord/emoji.py
index 5e864b28..f581d950 100644
--- a/discord/emoji.py
+++ b/discord/emoji.py
@@ -249,6 +249,15 @@ class Emoji:
""":class:`Guild`: The guild this emoji belongs to."""
return self._state._get_guild(self.guild_id)
+ def is_usable(self):
+ """:class:`bool`: Whether the bot can use this emoji."""
+ if not self.available:
+ return False
+ if not self._roles:
+ return True
+ emoji_roles, my_roles = self._roles, self.guild.me._roles
+ return any(my_roles.has(role_id) for role_id in emoji_roles)
+
async def delete(self, *, reason=None):
"""|coro|