[commands] Delete module when it does not have a setup function.

This commit is contained in:
Rapptz 2016-08-10 15:09:07 -04:00
parent 6344504dfc
commit 1e9251cfef

View File

@ -712,6 +712,8 @@ class Bot(GroupMixin, discord.Client):
lib = importlib.import_module(name)
if not hasattr(lib, 'setup'):
del lib
del sys.modules[name]
raise discord.ClientException('extension does not have a setup function')
lib.setup(self)