Fix run_until_disconnected disconnect with telethon.sync

This commit is contained in:
Lonami Exo 2018-06-27 19:39:47 +02:00
parent ad01bda503
commit c0412e4410

View File

@ -37,7 +37,12 @@ class UpdateMethods(UserMethods):
try:
return self.loop.run_until_complete(self.disconnected)
except KeyboardInterrupt:
# Importing the magic sync module turns disconnect into sync.
# TODO Maybe disconnect() should not need the magic module...
if inspect.iscoroutinefunction(self.disconnect):
self.loop.run_until_complete(self.disconnect())
else:
self.disconnect()
def on(self, event):
"""