mirror of
https://github.com/danog/TelegramApiServer.git
synced 2024-11-26 20:04:45 +01:00
Start session bugfix
This commit is contained in:
parent
1ecbcb5144
commit
abe9653c6d
@ -86,15 +86,16 @@ class Client
|
|||||||
$instance = new MadelineProto\API($file, $settings);
|
$instance = new MadelineProto\API($file, $settings);
|
||||||
$instance->async(true);
|
$instance->async(true);
|
||||||
$this->instances[$session] = $instance;
|
$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) {
|
if (($instance->API->authorized ?? MTProto::NOT_LOGGED_IN) === MTProto::LOGGED_IN) {
|
||||||
$instance->setEventHandler(EventHandler::class);
|
$instance->setEventHandler(EventHandler::class);
|
||||||
Loop::defer(static function() use($instance) {
|
Loop::defer(static function() use($instance) {
|
||||||
$instance->loop(['async' => true]);
|
$instance->loop(['async' => true]);
|
||||||
});
|
});
|
||||||
} elseif($startSession === true) {
|
|
||||||
$instance->loop(function() use($instance) {
|
|
||||||
yield $instance->start();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user