diff options
| author | Rapptz <[email protected]> | 2017-08-21 01:54:33 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2017-08-21 01:57:07 -0400 |
| commit | 37b0fdb898a0f242f68d30abb6c58bd1a15a6524 (patch) | |
| tree | bd752d8748bfb7aa4304b55183d8544f9d14886f /discord/guild.py | |
| parent | Use time.monotonic instead of time.time for heartbeat code. (diff) | |
| download | discord.py-37b0fdb898a0f242f68d30abb6c58bd1a15a6524.tar.xz discord.py-37b0fdb898a0f242f68d30abb6c58bd1a15a6524.zip | |
Add webhook support.
Allows for usage of either `requests` and `aiohttp` when used in
"Standalone" mode.
Fixes #704
Diffstat (limited to 'discord/guild.py')
| -rw-r--r-- | discord/guild.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/discord/guild.py b/discord/guild.py index 3f7b7270..5d7cb134 100644 --- a/discord/guild.py +++ b/discord/guild.py @@ -43,6 +43,7 @@ from .utils import valid_icon_size from .user import User from .invite import Invite from .iterators import AuditLogIterator +from .webhook import Webhook VALID_ICON_FORMATS = {"jpeg", "jpg", "webp", "png"} @@ -799,6 +800,28 @@ class Guild(Hashable): return data['pruned'] @asyncio.coroutine + def webhooks(self): + """|coro| + + Gets the list of webhooks from this guild. + + Requires :attr:`~.Permissions.manage_webhooks` permissions. + + Raises + ------- + Forbidden + You don't have permissions to get the webhooks. + + Returns + -------- + List[:class:`Webhook`] + The webhooks for this guild. + """ + + data = yield from self._state.http.guild_webhooks(self.id) + return [Webhook.from_state(d, state=self._state) for d in data] + + @asyncio.coroutine def estimate_pruned_members(self, *, days): """|coro| |