mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-19 15:36:02 +00:00
Properly set root parent before copying a command's binding
This commit is contained in:
parent
ca4db68686
commit
5bc085ebab
@ -757,8 +757,8 @@ class Group:
|
||||
self._children: Dict[str, Union[Command, Group]] = {}
|
||||
|
||||
for child in self.__discord_app_commands_group_children__:
|
||||
child = child._copy_with_binding(self) if not cls.__discord_app_commands_skip_init_binding__ else child
|
||||
child.parent = self
|
||||
child = child._copy_with_binding(self) if not cls.__discord_app_commands_skip_init_binding__ else child
|
||||
self._children[child.name] = child
|
||||
if child._attr and not cls.__discord_app_commands_skip_init_binding__:
|
||||
setattr(self, child._attr, child)
|
||||
|
@ -249,12 +249,12 @@ class Cog(metaclass=CogMeta):
|
||||
# Register the application commands
|
||||
children: List[Union[app_commands.Group, app_commands.Command[Self, ..., Any]]] = []
|
||||
for command in cls.__cog_app_commands__:
|
||||
copy = command._copy_with_binding(self)
|
||||
|
||||
if cls.__cog_is_app_commands_group__:
|
||||
# Type checker doesn't understand this type of narrowing.
|
||||
# Not even with TypeGuard somehow.
|
||||
copy.parent = self # type: ignore
|
||||
command.parent = self # type: ignore
|
||||
|
||||
copy = command._copy_with_binding(self)
|
||||
|
||||
children.append(copy)
|
||||
if command._attr:
|
||||
|
Loading…
x
Reference in New Issue
Block a user