Browse Source

[commands] Unload all extensions when gracefully closing bot.

pull/316/merge
Rapptz 8 years ago
parent
commit
bafaf72c89
  1. 10
      discord/ext/commands/bot.py

10
discord/ext/commands/bot.py

@ -266,6 +266,16 @@ class Bot(GroupMixin, discord.Client):
coro = self._run_extra(event, event_name, *args, **kwargs)
discord.compat.create_task(coro, loop=self.loop)
@asyncio.coroutine
def close(self):
for extension in self.extensions:
try:
self.unload_extension(extension)
except:
pass
yield from super().close()
@asyncio.coroutine
def on_command_error(self, exception, context):
"""|coro|

Loading…
Cancel
Save