Start session bugfix

This commit is contained in:
Alexander Pankratov 2020-01-26 23:47:27 +03:00
parent 1ecbcb5144
commit abe9653c6d

View File

@ -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();
});
}
}