mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-19 15:36:02 +00:00
[commands] Unload all extensions when gracefully closing bot.
This commit is contained in:
parent
c7946606f4
commit
bafaf72c89
@ -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…
x
Reference in New Issue
Block a user