From 37b0fdb898a0f242f68d30abb6c58bd1a15a6524 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Mon, 21 Aug 2017 01:54:33 -0400 Subject: Add webhook support. Allows for usage of either `requests` and `aiohttp` when used in "Standalone" mode. Fixes #704 --- discord/client.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'discord/client.py') 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) -- cgit v1.2.3