Skip to content

Commit 38ba10a

Browse files
MiddledotBobDotCom
authored andcommitted
The better fix
1 parent 0961053 commit 38ba10a

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

discord/bot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def add_application_command(self, command: ApplicationCommand) -> None:
133133
raise TypeError("The provided command is a sub-command of group")
134134

135135
if command.cog is MISSING:
136-
command.cog = None
136+
command._set_cog(None)
137137

138138
if self._bot.debug_guilds and command.guild_ids is None:
139139
command.guild_ids = self._bot.debug_guilds

discord/commands/core.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,16 +1086,10 @@ def to_dict(self) -> Dict:
10861086

10871087
return as_dict
10881088

1089-
def add_command(self, command: SlashCommand) -> None:
1090-
if command.cog is MISSING:
1091-
command.cog = self.cog
1092-
1093-
self.subcommands.append(command)
1094-
10951089
def command(self, cls: Type[T] = SlashCommand, **kwargs) -> Callable[[Callable], SlashCommand]:
10961090
def wrap(func) -> T:
10971091
command = cls(func, parent=self, **kwargs)
1098-
self.add_command(command)
1092+
self.subcommands.append(command)
10991093
return command
11001094

11011095
return wrap

0 commit comments

Comments
 (0)