aboutsummaryrefslogtreecommitdiff
path: root/discord/webhook
diff options
context:
space:
mode:
authorRapptz <[email protected]>2021-04-30 01:02:37 -0400
committerRapptz <[email protected]>2021-05-27 00:53:14 -0400
commit85758a75b3ce98b202fe77c15623d0f501aab12e (patch)
tree7dfeb2e940906ac8d3203aef553f6ce9772c841e /discord/webhook
parentFix some type hints in interactions (diff)
downloaddiscord.py-85758a75b3ce98b202fe77c15623d0f501aab12e.tar.xz
discord.py-85758a75b3ce98b202fe77c15623d0f501aab12e.zip
Add interaction related endpoints to async webhook
Diffstat (limited to 'discord/webhook')
-rw-r--r--discord/webhook/async_.py73
1 files changed, 73 insertions, 0 deletions
diff --git a/discord/webhook/async_.py b/discord/webhook/async_.py
index a174644f..3535c58a 100644
--- a/discord/webhook/async_.py
+++ b/discord/webhook/async_.py
@@ -332,6 +332,79 @@ class AsyncWebhookAdapter:
route = Route('GET', '/webhooks/{webhook_id}/{webhook_token}', webhook_id=webhook_id, webhook_token=token)
return self.request(route, session=session)
+ def create_interaction_response(
+ self,
+ interaction_id: int,
+ token: str,
+ *,
+ session: aiohttp.ClientSession,
+ type: int,
+ data: Optional[Dict[str, Any]] = None,
+ ):
+ payload: Dict[str, Any] = {
+ 'type': type,
+ }
+
+ if data is not None:
+ payload['data'] = data
+
+ route = Route(
+ 'POST',
+ '/interactions/{webhook_id}/{webhook_token}/callback',
+ webhook_id=interaction_id,
+ webhook_token=token,
+ )
+
+ return self.request(route, session=session, payload=payload)
+
+ def get_original_interaction_response(
+ self,
+ application_id: int,
+ token: str,
+ *,
+ session: aiohttp.ClientSession,
+ ):
+ r = Route(
+ 'GET',
+ '/webhooks/{webhook_id}/{webhook_token}/messages/@original',
+ webhook_id=application_id,
+ webhook_token=token,
+ )
+ return self.request(r, session=session)
+
+ def edit_original_interaction_response(
+ self,
+ application_id: int,
+ token: str,
+ *,
+ session: aiohttp.ClientSession,
+ payload: Optional[Dict[str, Any]] = None,
+ multipart: Optional[List[Dict[str, Any]]] = None,
+ files: Optional[List[File]] = None,
+ ):
+ r = Route(
+ 'PATCH',
+ '/webhooks/{webhook_id}/{webhook_token}/messages/@original',
+ webhook_id=application_id,
+ webhook_token=token,
+ )
+ return self.request(r, session, payload=payload, multipart=multipart, files=files)
+
+ def delete_original_interaction_response(
+ self,
+ application_id: int,
+ token: str,
+ *,
+ session: aiohttp.ClientSession,
+ ):
+ r = Route(
+ 'DELETE',
+ '/webhooks/{webhook_id}/{wehook_token}/messages/@original',
+ webhook_id=application_id,
+ wehook_token=token,
+ )
+ return self.request(r, session=session)
+
class ExecuteWebhookParameters(NamedTuple):
payload: Optional[Dict[str, Any]]