Update madelineProto

This commit is contained in:
Alexander Pankratov 2023-07-04 22:33:27 +02:00
parent 566e618d13
commit e6d400e666
2 changed files with 10 additions and 11 deletions

View File

@ -4,7 +4,6 @@ namespace TelegramApiServer;
use danog\MadelineProto\API;
use danog\MadelineProto\APIWrapper;
use danog\MadelineProto\MTProto;
use InvalidArgumentException;
use Psr\Log\LogLevel;
use ReflectionProperty;
@ -116,7 +115,7 @@ class Client
private function startNotLoggedInSessions(): void
{
foreach ($this->instances as $name => $instance) {
if ($instance->getAuthorization() !== MTProto::LOGGED_IN) {
if ($instance->getAuthorization() !== API::LOGGED_IN) {
{
//Disable logging to stdout
$logLevel = Logger::getInstance()->minLevelIndex;
@ -134,7 +133,7 @@ class Client
public function startLoggedInSession(string $sessionName): void
{
if ($this->instances[$sessionName]->getAuthorization() === MTProto::LOGGED_IN) {
if ($this->instances[$sessionName]->getAuthorization() === API::LOGGED_IN) {
if (empty(EventObserver::$sessionClients[$sessionName])) {
$this->instances[$sessionName]->unsetEventHandler();
}

View File

@ -3,7 +3,7 @@
namespace TelegramApiServer\MadelineProtoExtensions;
use danog\MadelineProto;
use danog\MadelineProto\MTProto;
use danog\MadelineProto\API;
use InvalidArgumentException;
use Revolt\EventLoop;
use TelegramApiServer\Client;
@ -32,7 +32,7 @@ class SystemApiExtensions
/** @var null|MadelineProto\Settings $fullSettings */
$fullSettings = $instance->getSettings();
try {
if ($fullSettings !== null && $instance->getAuthorization() !== MTProto::LOGGED_IN) {
if ($fullSettings !== null && $instance->getAuthorization() !== API::LOGGED_IN) {
$fullSettings->getAppInfo()->getApiId();
$fullSettings->getAppInfo()->getApiHash();
}
@ -57,22 +57,22 @@ class SystemApiExtensions
{
$sessions = [];
foreach ($this->client->instances as $session => $instance) {
/** @var MadelineProto\API $instance */
/** @var API $instance */
$authorized = $instance->API->authorized ?? null;
switch ($authorized) {
case MTProto::NOT_LOGGED_IN;
case API::NOT_LOGGED_IN;
$status = 'NOT_LOGGED_IN';
break;
case MTProto::WAITING_CODE:
case API::WAITING_CODE:
$status = 'WAITING_CODE';
break;
case MTProto::WAITING_PASSWORD:
case API::WAITING_PASSWORD:
$status = 'WAITING_PASSWORD';
break;
case MTProto::WAITING_SIGNUP:
case API::WAITING_SIGNUP:
$status = 'WAITING_SIGNUP';
break;
case MTProto::LOGGED_IN:
case API::LOGGED_IN:
$status = 'LOGGED_IN';
break;
case null: