Skip to content

Commit 3aeebfd

Browse files
authored
Merge branch 'master' into feat-media-channels
2 parents 19e4bed + 9259f38 commit 3aeebfd

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

+4316
-4323
lines changed

CHANGELOG.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ These changes are available on the `master` branch, but have not yet been releas
3232
([#2590](https://github.com/Pycord-Development/pycord/pull/2590))
3333
- Added missing `with_counts` parameter to `fetch_guilds` method.
3434
([#2615](https://github.com/Pycord-Development/pycord/pull/2615))
35-
- Added missing permissions: `Permissions.use_soundboard`,
36-
`Permissions.use_external_sounds` and
35+
- Added the following missing permissions: `Permissions.use_soundboard`,
36+
`Permissions.use_external_sounds`, and
3737
`Permissions.view_creator_monetization_analytics`.
3838
([#2620](https://github.com/Pycord-Development/pycord/pull/2620))
3939
- Added `MediaChannel` channel type.
@@ -56,7 +56,7 @@ These changes are available on the `master` branch, but have not yet been releas
5656
([#2595](https://github.com/Pycord-Development/pycord/pull/2595))
5757
- Fixed `BucketType.category` cooldown commands not functioning correctly in private
5858
channels. ([#2603](https://github.com/Pycord-Development/pycord/pull/2603))
59-
- Fixed `SlashCommand`'s `ctx` parameter couldn't be `Union` type.
59+
- Fixed `ctx` parameter of a `SlashCommand` not being `Union` type.
6060
([#2611](https://github.com/Pycord-Development/pycord/pull/2611))
6161
- Fixed `TypeError` when passing `skus` parameter in `Client.entitlements()`.
6262
([#2627](https://github.com/Pycord-Development/pycord/issues/2627))
@@ -66,6 +66,8 @@ These changes are available on the `master` branch, but have not yet been releas
6666
([#2641](https://github.com/Pycord-Development/pycord/pull/2641))
6767
- Fixed `AttributeError` when accessing `Member.guild_permissions` for user installed
6868
apps. ([#2650](https://github.com/Pycord-Development/pycord/pull/2650))
69+
- Fixed type annotations of cached properties.
70+
([#2635](https://github.com/Pycord-Development/pycord/issues/2635))
6971

7072
### Changed
7173

@@ -392,7 +394,7 @@ These changes are available on the `master` branch, but have not yet been releas
392394
([#2075](https://github.com/Pycord-Development/pycord/pull/2075))
393395
- Fixed `before_invoke` not being run for `SlashCommandGroup`.
394396
([#2091](https://github.com/Pycord-Development/pycord/pull/2091))
395-
- Fixed `AttributeError` when accessing a `Select` object's values when it hasn't been
397+
- Fixed `AttributeError` when accessing a `Select` object's values when it has not been
396398
interacted with. ([#2104](https://github.com/Pycord-Development/pycord/pull/2104))
397399
- Fixed `before_invoke` being run twice for slash subcommands.
398400
([#2139](https://github.com/Pycord-Development/pycord/pull/2139))
@@ -423,7 +425,7 @@ These changes are available on the `master` branch, but have not yet been releas
423425
([#2196](https://github.com/Pycord-Development/pycord/pull/2196))
424426
- Fixed `AttributeError` when running permission checks without the `bot` scope.
425427
([#2113](https://github.com/Pycord-Development/pycord/issues/2113))
426-
- Fixed `Option` not working on bridge commands because `ext.commands.Command` doesn't
428+
- Fixed `Option` not working on bridge commands because `ext.commands.Command` does not
427429
recognize them. ([#2256](https://github.com/Pycord-Development/pycord/pull/2256))
428430
- Fixed offset-aware tasks causing `TypeError` when being prepared.
429431
([#2271](https://github.com/Pycord-Development/pycord/pull/2271))
@@ -523,7 +525,7 @@ These changes are available on the `master` branch, but have not yet been releas
523525
### Fixed
524526

525527
- Fixed bugs in `Page.update_files` where file objects stored in memory were causing an
526-
`AttributeError`, and `io.BytesIO` files didn't send properly more than once.
528+
`AttributeError`, and `io.BytesIO` files did not send properly more than once.
527529
([#1869](https://github.com/Pycord-Development/pycord/pull/1869) &
528530
[#1881](https://github.com/Pycord-Development/pycord/pull/1881))
529531
- Fixed bridge groups missing the `parent` attribute.
@@ -878,9 +880,9 @@ These changes are available on the `master` branch, but have not yet been releas
878880
([#1453](https://github.com/Pycord-Development/pycord/pull/1453))
879881
- Update `thread.members` on `thread.fetch_members`.
880882
([#1464](https://github.com/Pycord-Development/pycord/pull/1464))
881-
- Fix the error when Discord doesn't send the `app_permissions` data in `Interaction`.
883+
- Fix the error when Discord does not send the `app_permissions` data in `Interaction`.
882884
([#1467](https://github.com/Pycord-Development/pycord/pull/1467))
883-
- Fix AttributeError when voice client `play()` function isn't completed yet.
885+
- Fix AttributeError when voice client `play()` function is not completed yet.
884886
([#1360](https://github.com/Pycord-Development/pycord/pull/1360))
885887

886888
## [2.0.0-rc.1] - 2022-05-17

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)