diff --git a/discord/file.py b/discord/file.py index e6717ed27..5303e3251 100644 --- a/discord/file.py +++ b/discord/file.py @@ -109,7 +109,7 @@ class File: self.spoiler = spoiler or (self.filename is not None and self.filename.startswith('SPOILER_')) - def reset(self, *, seek: bool = True) -> None: + def reset(self, *, seek: Union[int, bool] = True) -> None: # The `seek` parameter is needed because # the retry-loop is iterated over multiple times # starting from 0, as an implementation quirk diff --git a/discord/utils.py b/discord/utils.py index 37e635bc5..7cb58ea1e 100644 --- a/discord/utils.py +++ b/discord/utils.py @@ -464,8 +464,8 @@ def to_json(obj: Any) -> str: return json.dumps(obj, separators=(',', ':'), ensure_ascii=True) -def _parse_ratelimit_header(request: _RequestLike, *, use_clock: bool = False) -> float: - reset_after = request.headers.get('X-Ratelimit-Reset-After') +def _parse_ratelimit_header(request: Any, *, use_clock: bool = False) -> float: + reset_after: Optional[str] = request.headers.get('X-Ratelimit-Reset-After') if use_clock or not reset_after: utc = datetime.timezone.utc now = datetime.datetime.now(utc) diff --git a/discord/webhook/async_.py b/discord/webhook/async_.py index 7486415c2..18f650ba0 100644 --- a/discord/webhook/async_.py +++ b/discord/webhook/async_.py @@ -625,6 +625,8 @@ class WebhookMessage(Message): .. versionadded:: 1.6 """ + _state: _WebhookState + async def edit( self, content: Optional[str] = MISSING, @@ -794,7 +796,7 @@ class BaseWebhook(Hashable): If this is a partial webhook, then this will always return ``None``. """ guild = self.guild - return guild and guild.get_channel(self.channel_id) + return guild and guild.get_channel(self.channel_id) # type: ignore @property def created_at(self) -> datetime.datetime: @@ -1148,7 +1150,7 @@ class Webhook(BaseWebhook): def _create_message(self, data): state = _WebhookState(self, parent=self._state) channel = self.channel or Object(id=int(data['channel_id'])) - return WebhookMessage(data=data, state=state, channel=channel) + return WebhookMessage(data=data, state=state, channel=channel) # type: ignore @overload async def send(