diff --git a/discord/ext/commands/bot.py b/discord/ext/commands/bot.py index 9025493d9..1aa4133d1 100644 --- a/discord/ext/commands/bot.py +++ b/discord/ext/commands/bot.py @@ -764,10 +764,20 @@ class Bot(GroupMixin, discord.Client): for index in reversed(remove): del event_list[index] - # finally remove the import.. - del lib - del self.extensions[name] - del sys.modules[name] + try: + func = getattr(lib, 'teardown') + except AttributeError: + pass + else: + try: + func(bot) + except: + pass + finally: + # finally remove the import.. + del lib + del self.extensions[name] + del sys.modules[name] # command processing