From abe9653c6d292dc5b2de8e5b9304a487ab3fd848 Mon Sep 17 00:00:00 2001 From: Alexander Pankratov Date: Sun, 26 Jan 2020 23:47:27 +0300 Subject: [PATCH] Start session bugfix --- src/Client.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Client.php b/src/Client.php index 628f7d8..ab2f75d 100644 --- a/src/Client.php +++ b/src/Client.php @@ -86,15 +86,16 @@ class Client $instance = new MadelineProto\API($file, $settings); $instance->async(true); $this->instances[$session] = $instance; + if($startSession === true) { + $instance->loop(function() use($instance) { + yield $instance->start(); + }); + } if (($instance->API->authorized ?? MTProto::NOT_LOGGED_IN) === MTProto::LOGGED_IN) { $instance->setEventHandler(EventHandler::class); Loop::defer(static function() use($instance) { $instance->loop(['async' => true]); }); - } elseif($startSession === true) { - $instance->loop(function() use($instance) { - yield $instance->start(); - }); } }