mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-09 05:19:41 +00:00
Allow start when the loop is not running
This commit is contained in:
@@ -32,10 +32,11 @@ class UpdateMethods(UserMethods):
|
||||
If the loop is already running, this method returns a coroutine
|
||||
that you should await on your own code.
|
||||
"""
|
||||
if self.loop.is_running():
|
||||
return self._run_until_disconnected() # Let the user await it
|
||||
else:
|
||||
self.loop.run_until_complete(self._run_until_disconnected())
|
||||
coro = self._run_until_disconnected()
|
||||
return (
|
||||
coro if self.loop.is_running()
|
||||
else self.loop.run_until_complete(coro)
|
||||
)
|
||||
|
||||
def on(self, event):
|
||||
"""
|
||||
|
Reference in New Issue
Block a user