diff options
| author | NCPlayz <[email protected]> | 2019-03-25 22:31:03 +0000 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2019-04-06 19:19:47 -0400 |
| commit | 1d701f32b611f421bdd404f2ef523b0c876af1ce (patch) | |
| tree | e1d8e1de5c231d934a681d0220b13148f6eb78b2 /discord/guild.py | |
| parent | Redesign bulk delete events (diff) | |
| download | discord.py-1d701f32b611f421bdd404f2ef523b0c876af1ce.tar.xz discord.py-1d701f32b611f421bdd404f2ef523b0c876af1ce.zip | |
Add fetch custom emoji, all custom emojis; Add user property to Emoji
Diffstat (limited to 'discord/guild.py')
| -rw-r--r-- | discord/guild.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/discord/guild.py b/discord/guild.py index ddaf241c..d0d6daa8 100644 --- a/discord/guild.py +++ b/discord/guild.py @@ -31,6 +31,7 @@ from . import utils from .role import Role from .member import Member, VoiceState from .activity import create_activity +from .emoji import Emoji from .permissions import PermissionOverwrite from .colour import Colour from .errors import InvalidArgument, ClientException @@ -1143,6 +1144,49 @@ class Guild(Hashable): return result + async def fetch_emojis(self): + """|coro| + + Retrieves all custom :class:`Emoji`s from the guild. + + Raises + --------- + HTTPException + An error occurred fetching the emojis. + + Returns + -------- + List[:class:`Emoji`] + The retrieved emojis. + """ + data = await self._state.http.get_all_custom_emojis(self.id) + return [Emoji(guild=self, state=self._state, data=d) for d in data] + + async def fetch_emoji(self, emoji_id): + """|coro| + + Retrieves a custom :class:`Emoji` from the guild. + + Parameters + ------------- + emoji_id: :class:`int` + The emoji's ID. + + Raises + --------- + NotFound + The emoji requested could not be found. + HTTPException + An error occurred fetching the emoji. + + Returns + -------- + :class:`Emoji` + The retrieved emoji. + """ + data = await self._state.http.get_custom_emoji(self.id, emoji_id) + return Emoji(guild=self, state=self._state, data=data) + async def create_custom_emoji(self, *, name, image, roles=None, reason=None): r"""|coro| |