Skip to content

Commit 1427e10

Browse files
committed
Add check for sub-commands to ApplicationCommandMixin.add_application_command
1 parent f0a4010 commit 1427e10

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

discord/bot.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ def add_application_command(self, command: ApplicationCommand) -> None:
118118
command: :class:`.ApplicationCommand`
119119
The command to add.
120120
"""
121+
try:
122+
if getattr("parent", command) is not None:
123+
raise TypeError("The provided command is a sub-command of group")
124+
except AttributeError:
125+
pass
126+
121127
if self.debug_guilds and command.guild_ids is None:
122128
command.guild_ids = self.debug_guilds
123129
self._pending_application_commands.append(command)

0 commit comments

Comments
 (0)