Browse Source

Add Emoji.available field

pull/2203/head
Rapptz 6 years ago
parent
commit
8e80eee0d1
  1. 5
      discord/emoji.py

5
discord/emoji.py

@ -168,12 +168,14 @@ class Emoji:
If this emoji is managed by a Twitch integration. If this emoji is managed by a Twitch integration.
guild_id: :class:`int` guild_id: :class:`int`
The guild ID the emoji belongs to. The guild ID the emoji belongs to.
available: :class:`bool`
Whether the emoji is available for use.
user: Optional[:class:`User`] user: Optional[:class:`User`]
The user that created the emoji. This can only be retrieved using :meth:`Guild.fetch_emoji` and The user that created the emoji. This can only be retrieved using :meth:`Guild.fetch_emoji` and
having the :attr:`~Permissions.manage_emojis` permission. having the :attr:`~Permissions.manage_emojis` permission.
""" """
__slots__ = ('require_colons', 'animated', 'managed', 'id', 'name', '_roles', 'guild_id', __slots__ = ('require_colons', 'animated', 'managed', 'id', 'name', '_roles', 'guild_id',
'_state', 'user') '_state', 'user', 'available')
def __init__(self, *, guild, state, data): def __init__(self, *, guild, state, data):
self.guild_id = guild.id self.guild_id = guild.id
@ -186,6 +188,7 @@ class Emoji:
self.id = int(emoji['id']) self.id = int(emoji['id'])
self.name = emoji['name'] self.name = emoji['name']
self.animated = emoji.get('animated', False) self.animated = emoji.get('animated', False)
self.available = emoji.get('available', True)
self._roles = utils.SnowflakeList(map(int, emoji.get('roles', []))) self._roles = utils.SnowflakeList(map(int, emoji.get('roles', [])))
user = emoji.get('user') user = emoji.get('user')
self.user = User(state=self._state, data=user) if user else None self.user = User(state=self._state, data=user) if user else None

Loading…
Cancel
Save