diff --git a/discord/webhook/async_.py b/discord/webhook/async_.py index 400522831..3ae23db1d 100644 --- a/discord/webhook/async_.py +++ b/discord/webhook/async_.py @@ -933,12 +933,12 @@ class Webhook(BaseWebhook): return f'' @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 89dc3c174..d358fd5f5 100644 --- a/discord/webhook/sync.py +++ b/discord/webhook/sync.py @@ -522,12 +522,12 @@ class SyncWebhook(BaseWebhook): return f'' @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