mirror of
https://github.com/danog/TelegramApiServer.git
synced 2024-11-30 04:19:13 +01:00
Fix: stop only own event handlers
This commit is contained in:
parent
c554bda966
commit
ba43eef862
@ -10,6 +10,7 @@ use InvalidArgumentException;
|
|||||||
use Psr\Log\LogLevel;
|
use Psr\Log\LogLevel;
|
||||||
use ReflectionProperty;
|
use ReflectionProperty;
|
||||||
use RuntimeException;
|
use RuntimeException;
|
||||||
|
use TelegramApiServer\EventObservers\EventHandler;
|
||||||
use TelegramApiServer\EventObservers\EventObserver;
|
use TelegramApiServer\EventObservers\EventObserver;
|
||||||
|
|
||||||
class Client
|
class Client
|
||||||
@ -140,7 +141,13 @@ class Client
|
|||||||
public function startLoggedInSession(string $sessionName): void
|
public function startLoggedInSession(string $sessionName): void
|
||||||
{
|
{
|
||||||
if ($this->instances[$sessionName]->getAuthorization() === API::LOGGED_IN) {
|
if ($this->instances[$sessionName]->getAuthorization() === API::LOGGED_IN) {
|
||||||
if (empty(EventObserver::$sessionClients[$sessionName])) {
|
if (
|
||||||
|
empty(EventObserver::$sessionClients[$sessionName])
|
||||||
|
&& (
|
||||||
|
$this->instances[$sessionName]->getEventHandler() instanceof EventHandler
|
||||||
|
|| $this->instances[$sessionName]->getEventHandler() instanceof \__PHP_Incomplete_Class
|
||||||
|
)
|
||||||
|
) {
|
||||||
$this->instances[$sessionName]->unsetEventHandler();
|
$this->instances[$sessionName]->unsetEventHandler();
|
||||||
}
|
}
|
||||||
$this->instances[$sessionName]->start();
|
$this->instances[$sessionName]->start();
|
||||||
|
Loading…
Reference in New Issue
Block a user