mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-07 20:28:38 +00:00
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_'))
|
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 `seek` parameter is needed because
|
||||||
# the retry-loop is iterated over multiple times
|
# the retry-loop is iterated over multiple times
|
||||||
# starting from 0, as an implementation quirk
|
# 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)
|
return json.dumps(obj, separators=(',', ':'), ensure_ascii=True)
|
||||||
|
|
||||||
|
|
||||||
def _parse_ratelimit_header(request: _RequestLike, *, use_clock: bool = False) -> float:
|
def _parse_ratelimit_header(request: Any, *, use_clock: bool = False) -> float:
|
||||||
reset_after = request.headers.get('X-Ratelimit-Reset-After')
|
reset_after: Optional[str] = request.headers.get('X-Ratelimit-Reset-After')
|
||||||
if use_clock or not reset_after:
|
if use_clock or not reset_after:
|
||||||
utc = datetime.timezone.utc
|
utc = datetime.timezone.utc
|
||||||
now = datetime.datetime.now(utc)
|
now = datetime.datetime.now(utc)
|
||||||
|
@ -625,6 +625,8 @@ class WebhookMessage(Message):
|
|||||||
.. versionadded:: 1.6
|
.. versionadded:: 1.6
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
_state: _WebhookState
|
||||||
|
|
||||||
async def edit(
|
async def edit(
|
||||||
self,
|
self,
|
||||||
content: Optional[str] = MISSING,
|
content: Optional[str] = MISSING,
|
||||||
@ -794,7 +796,7 @@ class BaseWebhook(Hashable):
|
|||||||
If this is a partial webhook, then this will always return ``None``.
|
If this is a partial webhook, then this will always return ``None``.
|
||||||
"""
|
"""
|
||||||
guild = self.guild
|
guild = self.guild
|
||||||
return guild and guild.get_channel(self.channel_id)
|
return guild and guild.get_channel(self.channel_id) # type: ignore
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def created_at(self) -> datetime.datetime:
|
def created_at(self) -> datetime.datetime:
|
||||||
@ -1148,7 +1150,7 @@ class Webhook(BaseWebhook):
|
|||||||
def _create_message(self, data):
|
def _create_message(self, data):
|
||||||
state = _WebhookState(self, parent=self._state)
|
state = _WebhookState(self, parent=self._state)
|
||||||
channel = self.channel or Object(id=int(data['channel_id']))
|
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
|
@overload
|
||||||
async def send(
|
async def send(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user