aboutsummaryrefslogtreecommitdiff
path: root/discord
diff options
context:
space:
mode:
authorSteve C <[email protected]>2021-08-26 20:46:25 -0400
committerGitHub <[email protected]>2021-08-26 20:46:25 -0400
commit059ec161f873cef26c974362d1b3e4b576568f8d (patch)
treeb0dca64ec2b429e9846c99ace0db1aaacebe0e17 /discord
parentAdd default value for invitable in HTTPClient (diff)
downloaddiscord.py-059ec161f873cef26c974362d1b3e4b576568f8d.tar.xz
discord.py-059ec161f873cef26c974362d1b3e4b576568f8d.zip
Fix Webhook return types
Also add positional only arguments where applicable
Diffstat (limited to 'discord')
-rw-r--r--discord/webhook/async_.py12
-rw-r--r--discord/webhook/sync.py12
2 files changed, 12 insertions, 12 deletions
diff --git a/discord/webhook/async_.py b/discord/webhook/async_.py
index 40052283..3ae23db1 100644
--- a/discord/webhook/async_.py
+++ b/discord/webhook/async_.py
@@ -933,12 +933,12 @@ class Webhook(BaseWebhook):
return f'<Webhook id={self.id!r}>'
@property
- def url(self):
+ def url(self) -> str:
""":class:`str` : Returns the webhook's url."""
return f'https://discord.com/api/webhooks/{self.id}/{self.token}'
@classmethod
- def partial(cls, id: int, token: str, *, session: aiohttp.ClientSession, bot_token: Optional[str] = None):
+ def partial(cls, id: int, token: str, *, session: aiohttp.ClientSession, bot_token: Optional[str] = None) -> Webhook:
"""Creates a partial :class:`Webhook`.
Parameters
@@ -974,7 +974,7 @@ class Webhook(BaseWebhook):
return cls(data, session, token=bot_token)
@classmethod
- def from_url(cls, url: str, *, session: aiohttp.ClientSession, bot_token: Optional[str] = None):
+ def from_url(cls, url: str, *, session: aiohttp.ClientSession, bot_token: Optional[str] = None) -> Webhook:
"""Creates a partial :class:`Webhook` from a webhook URL.
Parameters
@@ -1013,7 +1013,7 @@ class Webhook(BaseWebhook):
return cls(data, session, token=bot_token) # type: ignore
@classmethod
- def _as_follower(cls, data, *, channel, user):
+ def _as_follower(cls, data, *, channel, user) -> Webhook:
name = f"{channel.guild} #{channel}"
feed: WebhookPayload = {
'id': data['webhook_id'],
@@ -1029,7 +1029,7 @@ class Webhook(BaseWebhook):
return cls(feed, session=session, state=state, token=state.http.token)
@classmethod
- def from_state(cls, data, state):
+ def from_state(cls, data, state) -> Webhook:
session = state.http._HTTPClient__session
return cls(data, session=session, state=state, token=state.http.token)
@@ -1555,7 +1555,7 @@ class Webhook(BaseWebhook):
self._state.store_view(view, message_id)
return message
- async def delete_message(self, message_id: int):
+ async def delete_message(self, message_id: int, /) -> None:
"""|coro|
Deletes a message owned by this webhook.
diff --git a/discord/webhook/sync.py b/discord/webhook/sync.py
index 89dc3c17..d358fd5f 100644
--- a/discord/webhook/sync.py
+++ b/discord/webhook/sync.py
@@ -522,12 +522,12 @@ class SyncWebhook(BaseWebhook):
return f'<Webhook id={self.id!r}>'
@property
- def url(self):
+ def url(self) -> str:
""":class:`str` : Returns the webhook's url."""
return f'https://discord.com/api/webhooks/{self.id}/{self.token}'
@classmethod
- def partial(cls, id: int, token: str, *, session: Session = MISSING, bot_token: Optional[str] = None):
+ def partial(cls, id: int, token: str, *, session: Session = MISSING, bot_token: Optional[str] = None) -> SyncWebhook:
"""Creates a partial :class:`Webhook`.
Parameters
@@ -566,7 +566,7 @@ class SyncWebhook(BaseWebhook):
return cls(data, session, token=bot_token)
@classmethod
- def from_url(cls, url: str, *, session: Session = MISSING, bot_token: Optional[str] = None):
+ def from_url(cls, url: str, *, session: Session = MISSING, bot_token: Optional[str] = None) -> SyncWebhook:
"""Creates a partial :class:`Webhook` from a webhook URL.
Parameters
@@ -650,7 +650,7 @@ class SyncWebhook(BaseWebhook):
return SyncWebhook(data, self.session, token=self.auth_token, state=self._state)
- def delete(self, *, reason: Optional[str] = None, prefer_auth: bool = True):
+ def delete(self, *, reason: Optional[str] = None, prefer_auth: bool = True) -> None:
"""Deletes this Webhook.
Parameters
@@ -918,7 +918,7 @@ class SyncWebhook(BaseWebhook):
if wait:
return self._create_message(data)
- def fetch_message(self, id: int) -> SyncWebhookMessage:
+ def fetch_message(self, id: int, /) -> SyncWebhookMessage:
"""Retrieves a single :class:`~discord.SyncWebhookMessage` owned by this webhook.
.. versionadded:: 2.0
@@ -1034,7 +1034,7 @@ class SyncWebhook(BaseWebhook):
)
return self._create_message(data)
- def delete_message(self, message_id: int):
+ def delete_message(self, message_id: int, /) -> None:
"""Deletes a message owned by this webhook.
This is a lower level interface to :meth:`WebhookMessage.delete` in case