aboutsummaryrefslogtreecommitdiff
path: root/discord/client.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2017-08-21 01:54:33 -0400
committerRapptz <[email protected]>2017-08-21 01:57:07 -0400
commit37b0fdb898a0f242f68d30abb6c58bd1a15a6524 (patch)
treebd752d8748bfb7aa4304b55183d8544f9d14886f /discord/client.py
parentUse time.monotonic instead of time.time for heartbeat code. (diff)
downloaddiscord.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/client.py')
-rw-r--r--discord/client.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/discord/client.py b/discord/client.py
index 4d719a4b..67d1fb9e 100644
--- a/discord/client.py
+++ b/discord/client.py
@@ -36,6 +36,7 @@ from .http import HTTPClient
from .state import ConnectionState
from . import utils, compat
from .backoff import ExponentialBackoff
+from .webhook import Webhook
import asyncio
import aiohttp
@@ -1010,3 +1011,26 @@ class Client:
mutual_guilds=mutual_guilds,
user=User(data=user, state=state),
connected_accounts=data['connected_accounts'])
+
+ @asyncio.coroutine
+ def get_webhook_info(self, webhook_id):
+ """|coro|
+
+ Retrieves a :class:`Webhook` with the specified ID.
+
+ Raises
+ --------
+ HTTPException
+ Retrieving the webhook failed.
+ NotFound
+ Invalid webhook ID.
+ Forbidden
+ You do not have permission to fetch this webhook.
+
+ Returns
+ ---------
+ :class:`Webhook`
+ The webhook you requested.
+ """
+ data = yield from self.http.get_webhook(webhook_id)
+ return Webhook.from_state(data, state=self._connection)