Fix run() not dealing properly with coroutines
This commit is contained in:
parent
bc62b3f6ae
commit
d7be2c90a1
@ -17,6 +17,7 @@
|
||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import asyncio
|
||||
import inspect
|
||||
|
||||
from pyrogram.methods.utilities.idle import idle
|
||||
from pyrogram.scaffold import Scaffold
|
||||
@ -51,6 +52,11 @@ class Run(Scaffold):
|
||||
|
||||
if coroutine is not None:
|
||||
run(coroutine)
|
||||
else:
|
||||
if inspect.iscoroutinefunction(self.start):
|
||||
run(self.start())
|
||||
run(idle())
|
||||
run(self.stop())
|
||||
else:
|
||||
self.start()
|
||||
run(idle())
|
||||
|
Loading…
Reference in New Issue
Block a user