Add Emoji.is_usable()
This commit is contained in:
parent
8240454555
commit
3cef1e09f8
@ -249,6 +249,15 @@ class Emoji:
|
|||||||
""":class:`Guild`: The guild this emoji belongs to."""
|
""":class:`Guild`: The guild this emoji belongs to."""
|
||||||
return self._state._get_guild(self.guild_id)
|
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):
|
async def delete(self, *, reason=None):
|
||||||
"""|coro|
|
"""|coro|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user