Cleanly handle KeyboardInterrupt in run_until_disconnected

This commit is contained in:
Lonami Exo 2018-06-22 13:26:24 +02:00
parent 1a1d9d346c
commit 3d3698562b

View File

@ -27,7 +27,10 @@ class UpdateMethods(UserMethods):
will be running already. Use ``await client.disconnected`` in
this situation instead.
"""
self.loop.run_until_complete(self.disconnected)
try:
self.loop.run_until_complete(self.disconnected)
except KeyboardInterrupt:
self.loop.run_until_complete(self.disconnect())
def on(self, event):
"""