mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-07 12:18:59 +00:00
Add interaction related endpoints to async webhook
This commit is contained in:
parent
d42c63e186
commit
85758a75b3
@ -332,6 +332,79 @@ class AsyncWebhookAdapter:
|
|||||||
route = Route('GET', '/webhooks/{webhook_id}/{webhook_token}', webhook_id=webhook_id, webhook_token=token)
|
route = Route('GET', '/webhooks/{webhook_id}/{webhook_token}', webhook_id=webhook_id, webhook_token=token)
|
||||||
return self.request(route, session=session)
|
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):
|
class ExecuteWebhookParameters(NamedTuple):
|
||||||
payload: Optional[Dict[str, Any]]
|
payload: Optional[Dict[str, Any]]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user