Skip to content

Commit

Permalink
Merge branch 'Pycord-Development:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
plun1331 authored Jan 21, 2024
2 parents c641d48 + 0cd9ac9 commit 9cda058
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
pip install -r requirements/dev.txt
- name: Setup cache
id: cache-pylint
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: .pylint.d
key: pylint
Expand All @@ -43,7 +43,7 @@ jobs:
pip install -r requirements/dev.txt
- name: Setup cache
id: cache-mypy
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: .mypy_cache
key: mypy
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
pip install -r requirements/dev.txt
- name: Setup cache
id: cache-pytest
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: .pytest_cache
key: ${{ matrix.os }}-${{ matrix.python-version }}-pytest
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,12 @@ These changes are available on the `master` branch, but have not yet been releas
([#2243](https://github.com/Pycord-Development/pycord/pull/2243))
- Fixed `Intents.all()` returning the wrong value.
([#2257](https://github.com/Pycord-Development/pycord/issues/2257))
- Fixed `AuditLogIterator` not respecting the `after` parameter.
([#2295](https://github.com/Pycord-Development/pycord/issues/2295))
- Fixed `AttributeError` when failing to establish initial websocket connection.
([#2301](https://github.com/Pycord-Development/pycord/pull/2301))
- Fixed `AttributeError` caused by `command.cog` being `MISSING`.
([#2303](https://github.com/Pycord-Development/pycord/issues/2303))

## [2.4.1] - 2023-03-20

Expand Down
2 changes: 2 additions & 0 deletions discord/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,8 @@ async def connect(self, *, reconnect: bool = True) -> None:
# Always try to RESUME the connection
# If the connection is not RESUME-able then the gateway will invalidate the session.
# This is apparently what the official Discord client does.
if self.ws is None:
continue
ws_params.update(
sequence=self.ws.sequence, resume=True, session=self.ws.session_id
)
Expand Down
9 changes: 3 additions & 6 deletions discord/commands/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ def _is_typing_annotated(self, annotation):

@property
def cog(self):
return getattr(self, "_cog", MISSING)
return getattr(self, "_cog", None)

@cog.setter
def cog(self, val):
Expand Down Expand Up @@ -1162,7 +1162,7 @@ def __init__(

self._before_invoke = None
self._after_invoke = None
self.cog = MISSING
self.cog = None
self.id = None

# Permissions
Expand Down Expand Up @@ -1238,10 +1238,7 @@ def to_dict(self) -> dict:
return as_dict

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

self.subcommands.append(command)
Expand Down
2 changes: 1 addition & 1 deletion discord/iterators.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ def __init__(
self.before = before
self.user_id = user_id
self.action_type = action_type
self.after = OLDEST_OBJECT
self.after = after or OLDEST_OBJECT
self._users = {}
self._state = guild._state

Expand Down
7 changes: 6 additions & 1 deletion discord/ui/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,12 @@ async def on_timeout(self) -> None:
"""
if self.disable_on_timeout:
self.disable_all_items()
message = self._message or self.parent

if not self._message or self._message.flags.ephemeral:
message = self.parent
else:
message = self.message

if message:
m = await message.edit(view=self)
if m:
Expand Down
26 changes: 23 additions & 3 deletions discord/voice_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
import struct
import threading
import time
from typing import TYPE_CHECKING, Any, Callable
from typing import TYPE_CHECKING, Any, Callable, Literal, overload

from . import opus, utils
from .backoff import ExponentialBackoff
Expand Down Expand Up @@ -623,13 +623,33 @@ def get_ssrc(self, user_id):
user_id
]

@overload
def play(
self,
source: AudioSource,
*,
after: Callable[[Exception | None], Any] = None,
wait_finish: bool = False,
after: Callable[[Exception | None], Any] | None = None,
wait_finish: Literal[False] = False,
) -> None:
...

@overload
def play(
self,
source: AudioSource,
*,
after: Callable[[Exception | None], Any] | None = None,
wait_finish: Literal[True],
) -> asyncio.Future:
...

def play(
self,
source: AudioSource,
*,
after: Callable[[Exception | None], Any] | None = None,
wait_finish: bool = False,
) -> None | asyncio.Future:
"""Plays an :class:`AudioSource`.
The finalizer, ``after`` is called after the source has been exhausted
Expand Down
10 changes: 5 additions & 5 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
-r _.txt
pylint~=3.0.3
pytest~=7.4.3
pytest-asyncio~=0.23.2
pytest~=7.4.4
pytest-asyncio~=0.23.3
# pytest-order~=1.0.1
mypy~=1.7.1
coverage~=7.3
mypy~=1.8.0
coverage~=7.4
pre-commit==3.5.0
codespell==2.2.6
bandit==1.7.6
flake8==6.1.0
flake8==7.0.0

0 comments on commit 9cda058

Please sign in to comment.