Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/pip/pytest-approx-eq-7.4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Dorukyum authored Jan 21, 2024
2 parents 6788a2e + a8c3ee5 commit f73a222
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ These changes are available on the `master` branch, but have not yet been releas
([#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
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

0 comments on commit f73a222

Please sign in to comment.