[commands] Proper cleanup of cogs.
This commit is contained in:
parent
38bac7fa86
commit
efcc55bd32
@ -377,6 +377,8 @@ class Bot(GroupMixin, discord.Client):
|
|||||||
if name.startswith('on_'):
|
if name.startswith('on_'):
|
||||||
self.remove_listener(member)
|
self.remove_listener(member)
|
||||||
|
|
||||||
|
del cog
|
||||||
|
|
||||||
# extensions
|
# extensions
|
||||||
|
|
||||||
def load_extension(self, name):
|
def load_extension(self, name):
|
||||||
@ -400,7 +402,7 @@ class Bot(GroupMixin, discord.Client):
|
|||||||
|
|
||||||
# remove the cogs registered from the module
|
# remove the cogs registered from the module
|
||||||
for cogname, cog in self.cogs.copy().items():
|
for cogname, cog in self.cogs.copy().items():
|
||||||
if cog.__module__ is lib:
|
if inspect.getmodule(cog) is lib:
|
||||||
self.remove_cog(cogname)
|
self.remove_cog(cogname)
|
||||||
|
|
||||||
# first remove all the commands from the module
|
# first remove all the commands from the module
|
||||||
|
Loading…
x
Reference in New Issue
Block a user