Fix some webhook related type checker errors
This commit is contained in:
parent
0dd4c4c08c
commit
fc66c5b92d
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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(
|
||||
|
Loading…
x
Reference in New Issue
Block a user