From 647f00f7d65186443dec5163393ac47d1c325250 Mon Sep 17 00:00:00 2001 From: Middledot <78228142+Middledot@users.noreply.github.com> Date: Wed, 14 Dec 2022 10:57:26 -0500 Subject: [PATCH] fix(ext.bridge): fix groups missing parent attr (#1823) * fix(ext.bridge): fix groups missing parent attr * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * chore(changelog): add changelog entry * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Lala Sabathil --- CHANGELOG.md | 9 ++++++++- discord/ext/bridge/core.py | 13 +++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 524adfbe19..06fad6b7ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,11 +16,18 @@ _No changes yet_ ### Fixed +- Fixed bridge groups missing the `parent` attribute. + ([#1823](https://github.com/Pycord-Development/pycord/pull/1823)) + +## [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)) - Fixed an `AttributeError` in select relating to the select type. ([#1814](https://github.com/Pycord-Development/pycord/pull/1814)) -- Fix `Thread.applied_tags` always returning an empty list. +- Fixed `Thread.applied_tags` always returning an empty list. ([#1817](https://github.com/Pycord-Development/pycord/pull/1817)) ## [2.3.1] - 2022-11-27 diff --git a/discord/ext/bridge/core.py b/discord/ext/bridge/core.py index c917310e89..22fad26f52 100644 --- a/discord/ext/bridge/core.py +++ b/discord/ext/bridge/core.py @@ -311,12 +311,17 @@ class BridgeCommandGroup(BridgeCommand): If :func:`map_to` is used, the mapped slash command. """ + ext_variant: BridgeExtGroup + slash_variant: BridgeSlashGroup + def __init__(self, callback, *args, **kwargs): - self.ext_variant: BridgeExtGroup = BridgeExtGroup(callback, *args, **kwargs) - name = kwargs.pop("name", self.ext_variant.name) - self.slash_variant: BridgeSlashGroup = BridgeSlashGroup( - callback, name, *args, **kwargs + super().__init__( + callback, + ext_variant=(ext_var := BridgeExtGroup(callback, *args, **kwargs)), + slash_variant=BridgeSlashGroup(callback, ext_var.name, *args, **kwargs), + parent=kwargs.pop("parent", None), ) + self.subcommands: list[BridgeCommand] = [] self.mapped: SlashCommand | None = None