aboutsummaryrefslogtreecommitdiff
path: root/discord/ext
diff options
context:
space:
mode:
authorRapptz <[email protected]>2016-12-17 14:47:29 -0500
committerRapptz <[email protected]>2016-12-17 14:47:29 -0500
commitfc1a7183a0df1d9b936dc3e5bf6f08fb2676c45e (patch)
tree44def36dbd4fac15e76beebbfe0f13ad57145cb2 /discord/ext
parent[commands] Properly propagate CommandError derived exceptions. (diff)
downloaddiscord.py-fc1a7183a0df1d9b936dc3e5bf6f08fb2676c45e.tar.xz
discord.py-fc1a7183a0df1d9b936dc3e5bf6f08fb2676c45e.zip
[commands] Unload all cogs when gracefully exiting bot.
Diffstat (limited to 'discord/ext')
-rw-r--r--discord/ext/commands/bot.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/discord/ext/commands/bot.py b/discord/ext/commands/bot.py
index 1aa4133d..77123db5 100644
--- a/discord/ext/commands/bot.py
+++ b/discord/ext/commands/bot.py
@@ -274,6 +274,12 @@ class Bot(GroupMixin, discord.Client):
except:
pass
+ for cog in self.cogs:
+ try:
+ self.remove_cog(cog)
+ except:
+ pass
+
yield from super().close()
@asyncio.coroutine