From 1e9251cfefe5e4ce70094b90c000334ca431e954 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Wed, 10 Aug 2016 15:09:07 -0400 Subject: [PATCH] [commands] Delete module when it does not have a setup function. --- discord/ext/commands/bot.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/discord/ext/commands/bot.py b/discord/ext/commands/bot.py index 7250f3a68..d9e02f1fe 100644 --- a/discord/ext/commands/bot.py +++ b/discord/ext/commands/bot.py @@ -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)