Skip to content

Commit 22dc01e

Browse files
authored
Merge branch 'master' into fix-interaction-channel-perms
Signed-off-by: Paillat <[email protected]>
2 parents 7c816a4 + cab0a37 commit 22dc01e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+4309
-4316
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,11 @@ These changes are available on the `master` branch, but have not yet been releas
6262
([#2624](https://github.com/Pycord-Development/pycord/pull/2624))
6363
- Fixed `AttributeError` when accessing `Member.guild_permissions` for user installed
6464
apps. ([#2650](https://github.com/Pycord-Development/pycord/pull/2650))
65+
- Fixed type annotations of cached properties.
66+
([#2635](https://github.com/Pycord-Development/pycord/issues/2635))
6567
- Fixed malformed properties in `Interaction.channel`.
6668
([#2658](https://github.com/Pycord-Development/pycord/pull/2658))
67-
69+
6870
### Changed
6971

7072
- Renamed `cover` property of `ScheduledEvent` and `cover` argument of

discord/client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,8 @@ def _handle_ready(self) -> None:
310310

311311
@property
312312
def latency(self) -> float:
313-
"""Measures latency between a HEARTBEAT and a HEARTBEAT_ACK in seconds.
313+
"""Measures latency between a HEARTBEAT and a HEARTBEAT_ACK in seconds. If no websocket
314+
is present, this returns ``nan``, and if no heartbeat has been received yet, this returns ``float('inf')``.
314315
315316
This could be referred to as the Discord WebSocket protocol latency.
316317
"""

discord/gateway.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,9 @@ async def received_message(self, msg, /):
581581

582582
@property
583583
def latency(self) -> float:
584-
"""Measures latency between a HEARTBEAT and a HEARTBEAT_ACK in seconds."""
584+
"""Measures latency between a HEARTBEAT and a HEARTBEAT_ACK in seconds. If no heartbeat
585+
has been received yet this returns ``float('inf')``.
586+
"""
585587
heartbeat = self._keep_alive
586588
return float("inf") if heartbeat is None else heartbeat.latency
587589

discord/shard.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,9 @@ async def connect(self) -> None:
294294

295295
@property
296296
def latency(self) -> float:
297-
"""Measures latency between a HEARTBEAT and a HEARTBEAT_ACK in seconds for this shard."""
297+
"""Measures latency between a HEARTBEAT and a HEARTBEAT_ACK in seconds for this shard. If no heartbeat
298+
has been received yet this returns ``float('inf')``.
299+
"""
298300
return self._parent.ws.latency
299301

300302
def is_ws_ratelimited(self) -> bool:

discord/utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
Iterator,
5757
Literal,
5858
Mapping,
59-
NewType,
6059
Protocol,
6160
Sequence,
6261
TypeVar,
@@ -151,7 +150,7 @@ def __get__(self, instance, owner):
151150
class _RequestLike(Protocol):
152151
headers: Mapping[str, Any]
153152

154-
cached_property = NewType("cached_property", property)
153+
cached_property = property
155154

156155
P = ParamSpec("P")
157156

475 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
-15.5 KB
Binary file not shown.
5.38 KB
Binary file not shown.
306 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)