mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-09 05:19:41 +00:00
Fix run_until_disconnected disconnect with telethon.sync
This commit is contained in:
@@ -37,7 +37,12 @@ class UpdateMethods(UserMethods):
|
|||||||
try:
|
try:
|
||||||
return self.loop.run_until_complete(self.disconnected)
|
return self.loop.run_until_complete(self.disconnected)
|
||||||
except KeyboardInterrupt:
|
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())
|
self.loop.run_until_complete(self.disconnect())
|
||||||
|
else:
|
||||||
|
self.disconnect()
|
||||||
|
|
||||||
def on(self, event):
|
def on(self, event):
|
||||||
"""
|
"""
|
||||||
|
Reference in New Issue
Block a user