Skip to content

Commit

Permalink
fix(ext.bridge): Handle BridgeCommand while unloading cogs (#2048)
Browse files Browse the repository at this point in the history
* handle BridgeCommand

* Update CHANGELOG.md

* Update CHANGELOG.md
  • Loading branch information
OmLanke authored May 7, 2023
1 parent ea3e3db commit bd28a34
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ These changes are available on the `master` branch, but have not yet been releas
([#2029](https://github.com/Pycord-Development/pycord/pull/2029))
- Reflecting the api for gettings bans correctly.
([#1922](https://github.com/Pycord-Development/pycord/pull/1922))
- Fixed unloading of cogs having bridge commands.
([#2048](https://github.com/Pycord-Development/pycord/pull/2048))

## [2.4.1] - 2023-03-20

Expand Down
5 changes: 4 additions & 1 deletion discord/cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,10 @@ def _eject(self, bot) -> None:

try:
for command in self.__cog_commands__:
if isinstance(command, ApplicationCommand):
if hasattr(command, "add_to"):
bot.bridge_commands.remove(command)
continue
elif isinstance(command, ApplicationCommand):
bot.remove_application_command(command)
elif command.parent is None:
bot.remove_command(command.name)
Expand Down

0 comments on commit bd28a34

Please sign in to comment.