diff options
| author | NCPlayz <[email protected]> | 2019-06-08 22:38:27 +0100 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2019-06-29 19:14:22 -0400 |
| commit | 5698cf6df9b34768a59fc1afa3d16038067949aa (patch) | |
| tree | a61db07a130d8d304ac2879135fc7bed874f112f /discord/guild.py | |
| parent | Implement `Guild.fetch_members` (diff) | |
| download | discord.py-5698cf6df9b34768a59fc1afa3d16038067949aa.tar.xz discord.py-5698cf6df9b34768a59fc1afa3d16038067949aa.zip | |
Implement `Guild.fetch_roles`
Diffstat (limited to 'discord/guild.py')
| -rw-r--r-- | discord/guild.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/discord/guild.py b/discord/guild.py index b706c905..a3f36c47 100644 --- a/discord/guild.py +++ b/discord/guild.py @@ -1521,6 +1521,30 @@ class Guild(Hashable): data = await self._state.http.create_custom_emoji(self.id, name, img, roles=roles, reason=reason) return self._state.store_emoji(self, data) + async def fetch_roles(self): + """|coro| + + Retrieves all :class:`Role` that the guild has. + + .. note:: + + This method is an API call. For general usage, consider :attr:`roles` instead. + + .. versionadded:: 1.3.0 + + Raises + ------- + HTTPException + Retrieving the roles failed. + + Returns + ------- + List[:class:`Role`] + All roles in the guild. + """ + data = await self._state.http.get_roles(self.id) + return [Role(guild=self, state=self._state, data=d) for d in data] + async def create_role(self, *, reason=None, **fields): """|coro| |