Skip to content

Commit

Permalink
fix(ext.bridge): fix new issue with bridge_commands attribute (#1815)
Browse files Browse the repository at this point in the history
* feat(ext.bridge): fix bridge_commands attribute

* bump changelog

* add back "no changes" line

* Fix version link

Co-authored-by: BobDotCom <71356958+BobDotCom@users.noreply.github.com>
  • Loading branch information
Middledot and BobDotCom committed Dec 3, 2022
1 parent 49387eb commit 9db16eb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Expand Up @@ -12,6 +12,13 @@ These changes are available on the `master` branch, but have not yet been releas

_No changes yet_

## [2.3.2] - 2022-12-03

### Fixed

- Fixed another `AttributeError` relating to the new `bridge_commands` attribute on
`ext.bridge.Bot`. ([#1815](https://github.com/Pycord-Development/pycord/pull/1815))

## [2.3.1] - 2022-11-27

### Fixed
Expand Down Expand Up @@ -454,7 +461,8 @@ _No changes yet_
- Fix py3.10 UnionType checks issue.
([#1240](https://github.com/Pycord-Development/pycord/pull/1240))

[unreleased]: https://github.com/Pycord-Development/pycord/compare/v2.3.1...HEAD
[unreleased]: https://github.com/Pycord-Development/pycord/compare/v2.3.2...HEAD
[2.3.2]: https://github.com/Pycord-Development/pycord/compare/v2.3.1...v2.3.2
[2.3.1]: https://github.com/Pycord-Development/pycord/compare/v2.3.0...v2.3.1
[2.3.0]: https://github.com/Pycord-Development/pycord/compare/v2.2.2...v2.3.0
[2.2.2]: https://github.com/Pycord-Development/pycord/compare/v2.2.1...v2.2.2
Expand Down
2 changes: 1 addition & 1 deletion discord/cog.py
Expand Up @@ -542,7 +542,7 @@ def _inject(self: CogT, bot) -> CogT:

for index, command in enumerate(self.__cog_commands__):
if hasattr(command, "add_to"):
bot._bridge_commands.append(command)
bot.bridge_commands.append(command)
continue

command._set_cog(self)
Expand Down
9 changes: 1 addition & 8 deletions discord/ext/bridge/bot.py
Expand Up @@ -49,10 +49,6 @@ def bridge_commands(self) -> list[BridgeCommand | BridgeCommandGroup]:

return cmds

@bridge_commands.setter
def bridge_commands(self, cmds):
self._bridge_commands = cmds

async def get_application_context(
self, interaction: Interaction, cls=None
) -> BridgeApplicationContext:
Expand All @@ -74,10 +70,7 @@ def add_bridge_command(self, command: BridgeCommand):
# Ignore the type hinting error here. All subclasses of BotBase pass the type checks.
command.add_to(self) # type: ignore

if getattr(self, "_bridge_commands", None) is None:
self._bridge_commands = []

self._bridge_commands.append(command)
self.bridge_commands.append(command)

def bridge_command(self, **kwargs):
"""A shortcut decorator that invokes :func:`bridge_command` and adds it to
Expand Down

0 comments on commit 9db16eb

Please sign in to comment.