From a6f7213c89e9d592c69ea3c631b0cb2bdab19577 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Thu, 15 Apr 2021 07:20:28 -0400 Subject: Rewrite webhooks to play better with typings and rate limits This unfortunately required splitting the types into two. This led to a lot of unfortunate code duplication that I didn't really enjoy writing. The new design allows users to pass an authentication token to make webhook requests without the webhook token and allows to finally edit the webhook channel. The new design also uses a contextvar to store rate limiting information so multiple instances or recreating instances no longer clears the ratelimiting state since it's now essentially a "global" object. Closes #6525, closes #6662, closes #2509, closes #1761 --- docs/api.rst | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'docs') diff --git a/docs/api.rst b/docs/api.rst index 28615d3d..d20a62c2 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -2495,7 +2495,7 @@ Webhook .. attributetable:: Webhook -.. autoclass:: Webhook +.. autoclass:: Webhook() :members: WebhookMessage @@ -2503,22 +2503,23 @@ WebhookMessage .. attributetable:: WebhookMessage -.. autoclass:: WebhookMessage +.. autoclass:: WebhookMessage() :members: -Adapters -~~~~~~~~~ +SyncWebhook +~~~~~~~~~~~~ -Adapters allow you to change how the request should be handled. They all build on a single -interface, :meth:`WebhookAdapter.request`. +.. attributetable:: SyncWebhook -.. autoclass:: WebhookAdapter +.. autoclass:: SyncWebhook() :members: -.. autoclass:: AsyncWebhookAdapter - :members: +SyncWebhookMessage +~~~~~~~~~~~~~~~~~~~ + +.. attributetable:: SyncWebhookMessage -.. autoclass:: RequestsWebhookAdapter +.. autoclass:: SyncWebhookMessage() :members: .. _discord_api_abcs: -- cgit v1.2.3