mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-07-22 10:56:44 +00:00
[commands] Unload cog when command registration fails in _inject
This commit is contained in:
parent
87bc79e6e3
commit
9c109ae59b
@ -616,7 +616,10 @@ class Cog(metaclass=CogMeta):
|
|||||||
for to_undo in self.__cog_commands__[:index]:
|
for to_undo in self.__cog_commands__[:index]:
|
||||||
if to_undo.parent is None:
|
if to_undo.parent is None:
|
||||||
bot.remove_command(to_undo.name)
|
bot.remove_command(to_undo.name)
|
||||||
raise e
|
try:
|
||||||
|
await maybe_coroutine(self.cog_unload)
|
||||||
|
finally:
|
||||||
|
raise e
|
||||||
|
|
||||||
# check if we're overriding the default
|
# check if we're overriding the default
|
||||||
if cls.bot_check is not Cog.bot_check:
|
if cls.bot_check is not Cog.bot_check:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user