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/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
import inspect
|
||||||
|
|
||||||
from pyrogram.methods.utilities.idle import idle
|
from pyrogram.methods.utilities.idle import idle
|
||||||
from pyrogram.scaffold import Scaffold
|
from pyrogram.scaffold import Scaffold
|
||||||
@ -52,6 +53,11 @@ class Run(Scaffold):
|
|||||||
if coroutine is not None:
|
if coroutine is not None:
|
||||||
run(coroutine)
|
run(coroutine)
|
||||||
else:
|
else:
|
||||||
self.start()
|
if inspect.iscoroutinefunction(self.start):
|
||||||
run(idle())
|
run(self.start())
|
||||||
self.stop()
|
run(idle())
|
||||||
|
run(self.stop())
|
||||||
|
else:
|
||||||
|
self.start()
|
||||||
|
run(idle())
|
||||||
|
self.stop()
|
||||||
|
Loading…
Reference in New Issue
Block a user