Skip to content

Commit 27d0f6c

Browse files
committed
Remove incorrect parent and fix subcommand check
1 parent d5d0fb3 commit 27d0f6c

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

discord/bot.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,8 @@ def add_application_command(self, command: ApplicationCommand) -> None:
118118
command: :class:`.ApplicationCommand`
119119
The command to add.
120120
"""
121-
try:
122-
if getattr(command, "parent") is not None:
123-
raise TypeError("The provided command is a sub-command of group")
124-
except AttributeError:
125-
pass
121+
if isinstance(command, SlashCommand) and command.is_subcommand:
122+
raise TypeError("The provided command is a sub-command of group")
126123

127124
if self.debug_guilds and command.guild_ids is None:
128125
command.guild_ids = self.debug_guilds
@@ -514,7 +511,6 @@ def application_command(self, **kwargs):
514511
"""
515512

516513
def decorator(func) -> ApplicationCommand:
517-
kwargs.setdefault("parent", self)
518514
result = command(**kwargs)(func)
519515
self.add_application_command(result)
520516
return result

0 commit comments

Comments
 (0)