Skip to content

Commit 9cda058

Browse files
authored
Merge branch 'Pycord-Development:master' into master
2 parents c641d48 + 0cd9ac9 commit 9cda058

File tree

9 files changed

+49
-19
lines changed

9 files changed

+49
-19
lines changed

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
pip install -r requirements/dev.txt
2222
- name: Setup cache
2323
id: cache-pylint
24-
uses: actions/cache@v3
24+
uses: actions/cache@v4
2525
with:
2626
path: .pylint.d
2727
key: pylint
@@ -43,7 +43,7 @@ jobs:
4343
pip install -r requirements/dev.txt
4444
- name: Setup cache
4545
id: cache-mypy
46-
uses: actions/cache@v3
46+
uses: actions/cache@v4
4747
with:
4848
path: .mypy_cache
4949
key: mypy

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
pip install -r requirements/dev.txt
3636
- name: Setup cache
3737
id: cache-pytest
38-
uses: actions/cache@v3
38+
uses: actions/cache@v4
3939
with:
4040
path: .pytest_cache
4141
key: ${{ matrix.os }}-${{ matrix.python-version }}-pytest

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,12 @@ These changes are available on the `master` branch, but have not yet been releas
201201
([#2243](https://github.com/Pycord-Development/pycord/pull/2243))
202202
- Fixed `Intents.all()` returning the wrong value.
203203
([#2257](https://github.com/Pycord-Development/pycord/issues/2257))
204+
- Fixed `AuditLogIterator` not respecting the `after` parameter.
205+
([#2295](https://github.com/Pycord-Development/pycord/issues/2295))
206+
- Fixed `AttributeError` when failing to establish initial websocket connection.
207+
([#2301](https://github.com/Pycord-Development/pycord/pull/2301))
208+
- Fixed `AttributeError` caused by `command.cog` being `MISSING`.
209+
([#2303](https://github.com/Pycord-Development/pycord/issues/2303))
204210

205211
## [2.4.1] - 2023-03-20
206212

discord/client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,8 @@ async def connect(self, *, reconnect: bool = True) -> None:
653653
# Always try to RESUME the connection
654654
# If the connection is not RESUME-able then the gateway will invalidate the session.
655655
# This is apparently what the official Discord client does.
656+
if self.ws is None:
657+
continue
656658
ws_params.update(
657659
sequence=self.ws.sequence, resume=True, session=self.ws.session_id
658660
)

discord/commands/core.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,7 @@ def _is_typing_annotated(self, annotation):
846846

847847
@property
848848
def cog(self):
849-
return getattr(self, "_cog", MISSING)
849+
return getattr(self, "_cog", None)
850850

851851
@cog.setter
852852
def cog(self, val):
@@ -1162,7 +1162,7 @@ def __init__(
11621162

11631163
self._before_invoke = None
11641164
self._after_invoke = None
1165-
self.cog = MISSING
1165+
self.cog = None
11661166
self.id = None
11671167

11681168
# Permissions
@@ -1238,10 +1238,7 @@ def to_dict(self) -> dict:
12381238
return as_dict
12391239

12401240
def add_command(self, command: SlashCommand) -> None:
1241-
# check if subcommand has no cog set
1242-
# also check if cog is MISSING because it
1243-
# might not have been set by the cog yet
1244-
if command.cog is MISSING and self.cog is not MISSING:
1241+
if command.cog is None and self.cog is not None:
12451242
command.cog = self.cog
12461243

12471244
self.subcommands.append(command)

discord/iterators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ def __init__(
430430
self.before = before
431431
self.user_id = user_id
432432
self.action_type = action_type
433-
self.after = OLDEST_OBJECT
433+
self.after = after or OLDEST_OBJECT
434434
self._users = {}
435435
self._state = guild._state
436436

discord/ui/view.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,12 @@ async def on_timeout(self) -> None:
368368
"""
369369
if self.disable_on_timeout:
370370
self.disable_all_items()
371-
message = self._message or self.parent
371+
372+
if not self._message or self._message.flags.ephemeral:
373+
message = self.parent
374+
else:
375+
message = self.message
376+
372377
if message:
373378
m = await message.edit(view=self)
374379
if m:

discord/voice_client.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
import struct
4747
import threading
4848
import time
49-
from typing import TYPE_CHECKING, Any, Callable
49+
from typing import TYPE_CHECKING, Any, Callable, Literal, overload
5050

5151
from . import opus, utils
5252
from .backoff import ExponentialBackoff
@@ -623,13 +623,33 @@ def get_ssrc(self, user_id):
623623
user_id
624624
]
625625

626+
@overload
626627
def play(
627628
self,
628629
source: AudioSource,
629630
*,
630-
after: Callable[[Exception | None], Any] = None,
631-
wait_finish: bool = False,
631+
after: Callable[[Exception | None], Any] | None = None,
632+
wait_finish: Literal[False] = False,
632633
) -> None:
634+
...
635+
636+
@overload
637+
def play(
638+
self,
639+
source: AudioSource,
640+
*,
641+
after: Callable[[Exception | None], Any] | None = None,
642+
wait_finish: Literal[True],
643+
) -> asyncio.Future:
644+
...
645+
646+
def play(
647+
self,
648+
source: AudioSource,
649+
*,
650+
after: Callable[[Exception | None], Any] | None = None,
651+
wait_finish: bool = False,
652+
) -> None | asyncio.Future:
633653
"""Plays an :class:`AudioSource`.
634654
635655
The finalizer, ``after`` is called after the source has been exhausted

requirements/dev.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
-r _.txt
22
pylint~=3.0.3
3-
pytest~=7.4.3
4-
pytest-asyncio~=0.23.2
3+
pytest~=7.4.4
4+
pytest-asyncio~=0.23.3
55
# pytest-order~=1.0.1
6-
mypy~=1.7.1
7-
coverage~=7.3
6+
mypy~=1.8.0
7+
coverage~=7.4
88
pre-commit==3.5.0
99
codespell==2.2.6
1010
bandit==1.7.6
11-
flake8==6.1.0
11+
flake8==7.0.0

0 commit comments

Comments
 (0)