diff --git a/src/danog/MadelineProto/MTProto.php b/src/danog/MadelineProto/MTProto.php index e589c7af..a2437307 100644 --- a/src/danog/MadelineProto/MTProto.php +++ b/src/danog/MadelineProto/MTProto.php @@ -54,7 +54,7 @@ class MTProto /* const V = 71; */ - const V = 99; + const V = 100; const NOT_LOGGED_IN = 0; const WAITING_CODE = 1; const WAITING_SIGNUP = -1; @@ -462,6 +462,7 @@ class MTProto // Extra parameters to pass to the proxy class using setExtra 'pfs' => extension_loaded('gmp'), ], + 'default_dc' => 2 ], 'app_info' => [ // obtained in https://my.telegram.org //'api_id' => you should put an API id in the settings array you provide diff --git a/src/danog/MadelineProto/MTProtoTools/CallHandler.php b/src/danog/MadelineProto/MTProtoTools/CallHandler.php index 74d3e899..476a077b 100644 --- a/src/danog/MadelineProto/MTProtoTools/CallHandler.php +++ b/src/danog/MadelineProto/MTProtoTools/CallHandler.php @@ -247,8 +247,8 @@ trait CallHandler } catch (\danog\MadelineProto\Exception $e) { $last_error = $e->getMessage().' in '.basename($e->getFile(), '.php').' on line '.$e->getLine(); if (strpos($e->getMessage(), 'Received request to switch to DC ') === 0) { - if ($this->authorized_dc === -1 && ($method === 'users.getUsers' && $args = ['id' => [['_' => 'inputUserSelf']]]) || $method === 'auth.exportAuthorization') { - $this->authorized_dc = $this->datacenter->curdc; + if (($method === 'users.getUsers' && $args = ['id' => [['_' => 'inputUserSelf']]]) || $method === 'auth.exportAuthorization' || $method === 'updates.getDifference') { + $this->settings['connection_settings']['default_dc'] = $this->authorized_dc = $this->datacenter->curdc; } $last_recv = $this->datacenter->sockets[$aargs['datacenter']]->last_recv; \danog\MadelineProto\Logger::log($e->getMessage(), \danog\MadelineProto\Logger::WARNING);