diff options
| author | Rapptz <[email protected]> | 2016-12-17 14:04:28 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2016-12-17 14:15:10 -0500 |
| commit | bafaf72c8913e8d3fd6695e19decc578a3b0ba33 (patch) | |
| tree | 7c8f938b2b9896740a4ea419a0d3d49e9ef52951 | |
| parent | Add Channel.overwrites to get a channel's permission overwrites. (diff) | |
| download | discord.py-bafaf72c8913e8d3fd6695e19decc578a3b0ba33.tar.xz discord.py-bafaf72c8913e8d3fd6695e19decc578a3b0ba33.zip | |
[commands] Unload all extensions when gracefully closing bot.
| -rw-r--r-- | discord/ext/commands/bot.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/discord/ext/commands/bot.py b/discord/ext/commands/bot.py index fd788182..9025493d 100644 --- a/discord/ext/commands/bot.py +++ b/discord/ext/commands/bot.py @@ -267,6 +267,16 @@ class Bot(GroupMixin, discord.Client): 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| |