aboutsummaryrefslogtreecommitdiff
path: root/discord/webhook
diff options
context:
space:
mode:
authorRapptz <[email protected]>2021-08-23 22:38:33 -0400
committerRapptz <[email protected]>2021-08-23 23:44:20 -0400
commit9dd86bbcb31d41ebc6b4c64856c476cb0eaf5e37 (patch)
treefca4d1d5a07656f419f4c64b405c15b5652eec37 /discord/webhook
parentUse getattr for default_auto_archive_duration in Message.create_thread (diff)
downloaddiscord.py-9dd86bbcb31d41ebc6b4c64856c476cb0eaf5e37.tar.xz
discord.py-9dd86bbcb31d41ebc6b4c64856c476cb0eaf5e37.zip
Add type hints to AsyncWebhookAdapter methods
Diffstat (limited to 'discord/webhook')
-rw-r--r--discord/webhook/async_.py32
1 files changed, 18 insertions, 14 deletions
diff --git a/discord/webhook/async_.py b/discord/webhook/async_.py
index d1063c4f..bcd7903b 100644
--- a/discord/webhook/async_.py
+++ b/discord/webhook/async_.py
@@ -59,9 +59,13 @@ if TYPE_CHECKING:
from ..embeds import Embed
from ..mentions import AllowedMentions
from ..state import ConnectionState
+ from ..http import Response
from ..types.webhook import (
Webhook as WebhookPayload,
)
+ from ..types.message import (
+ Message as MessagePayload,
+ )
from ..guild import Guild
from ..channel import TextChannel
from ..abc import Snowflake
@@ -206,7 +210,7 @@ class AsyncWebhookAdapter:
token: Optional[str] = None,
session: aiohttp.ClientSession,
reason: Optional[str] = None,
- ):
+ ) -> Response[None]:
route = Route('DELETE', '/webhooks/{webhook_id}', webhook_id=webhook_id)
return self.request(route, session, reason=reason, auth_token=token)
@@ -217,7 +221,7 @@ class AsyncWebhookAdapter:
*,
session: aiohttp.ClientSession,
reason: Optional[str] = None,
- ):
+ ) -> Response[None]:
route = Route('DELETE', '/webhooks/{webhook_id}/{webhook_token}', webhook_id=webhook_id, webhook_token=token)
return self.request(route, session, reason=reason)
@@ -229,7 +233,7 @@ class AsyncWebhookAdapter:
*,
session: aiohttp.ClientSession,
reason: Optional[str] = None,
- ):
+ ) -> Response[WebhookPayload]:
route = Route('PATCH', '/webhooks/{webhook_id}', webhook_id=webhook_id)
return self.request(route, session, reason=reason, payload=payload, auth_token=token)
@@ -241,7 +245,7 @@ class AsyncWebhookAdapter:
*,
session: aiohttp.ClientSession,
reason: Optional[str] = None,
- ):
+ ) -> Response[WebhookPayload]:
route = Route('PATCH', '/webhooks/{webhook_id}/{webhook_token}', webhook_id=webhook_id, webhook_token=token)
return self.request(route, session, reason=reason, payload=payload)
@@ -256,7 +260,7 @@ class AsyncWebhookAdapter:
files: Optional[List[File]] = None,
thread_id: Optional[int] = None,
wait: bool = False,
- ):
+ ) -> Response[Optional[MessagePayload]]:
params = {'wait': int(wait)}
if thread_id:
params['thread_id'] = thread_id
@@ -270,7 +274,7 @@ class AsyncWebhookAdapter:
message_id: int,
*,
session: aiohttp.ClientSession,
- ):
+ ) -> Response[MessagePayload]:
route = Route(
'GET',
'/webhooks/{webhook_id}/{webhook_token}/messages/{message_id}',
@@ -290,7 +294,7 @@ class AsyncWebhookAdapter:
payload: Optional[Dict[str, Any]] = None,
multipart: Optional[List[Dict[str, Any]]] = None,
files: Optional[List[File]] = None,
- ):
+ ) -> Response[Message]:
route = Route(
'PATCH',
'/webhooks/{webhook_id}/{webhook_token}/messages/{message_id}',
@@ -307,7 +311,7 @@ class AsyncWebhookAdapter:
message_id: int,
*,
session: aiohttp.ClientSession,
- ):
+ ) -> Response[None]:
route = Route(
'DELETE',
'/webhooks/{webhook_id}/{webhook_token}/messages/{message_id}',
@@ -323,7 +327,7 @@ class AsyncWebhookAdapter:
token: str,
*,
session: aiohttp.ClientSession,
- ):
+ ) -> Response[WebhookPayload]:
route = Route('GET', '/webhooks/{webhook_id}', webhook_id=webhook_id)
return self.request(route, session=session, auth_token=token)
@@ -333,7 +337,7 @@ class AsyncWebhookAdapter:
token: str,
*,
session: aiohttp.ClientSession,
- ):
+ ) -> Response[WebhookPayload]:
route = Route('GET', '/webhooks/{webhook_id}/{webhook_token}', webhook_id=webhook_id, webhook_token=token)
return self.request(route, session=session)
@@ -345,7 +349,7 @@ class AsyncWebhookAdapter:
session: aiohttp.ClientSession,
type: int,
data: Optional[Dict[str, Any]] = None,
- ):
+ ) -> Response[None]:
payload: Dict[str, Any] = {
'type': type,
}
@@ -368,7 +372,7 @@ class AsyncWebhookAdapter:
token: str,
*,
session: aiohttp.ClientSession,
- ):
+ ) -> Response[MessagePayload]:
r = Route(
'GET',
'/webhooks/{webhook_id}/{webhook_token}/messages/@original',
@@ -386,7 +390,7 @@ class AsyncWebhookAdapter:
payload: Optional[Dict[str, Any]] = None,
multipart: Optional[List[Dict[str, Any]]] = None,
files: Optional[List[File]] = None,
- ):
+ ) -> Response[MessagePayload]:
r = Route(
'PATCH',
'/webhooks/{webhook_id}/{webhook_token}/messages/@original',
@@ -401,7 +405,7 @@ class AsyncWebhookAdapter:
token: str,
*,
session: aiohttp.ClientSession,
- ):
+ ) -> Response[None]:
r = Route(
'DELETE',
'/webhooks/{webhook_id}/{wehook_token}/messages/@original',