Add Emoji.is_usable()

This commit is contained in:
Io Mintz 2019-09-20 01:24:16 +00:00 committed by Danny
parent 8240454555
commit 3cef1e09f8

View File

@ -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|