Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ext.bridge): fix new issue with bridge_commands attribute #1815

Merged
merged 4 commits into from
Dec 3, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion discord/cog.py
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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