Throw flood waits in resolve_username

This commit is contained in:
Daniil Gentili 2018-03-20 16:52:26 +01:00
parent 214471bc60
commit af8443caf2

View File

@ -750,7 +750,9 @@ trait PeerHandler
$res = $this->method_call('contacts.resolveUsername', ['username' => str_replace('@', '', $username)], ['datacenter' => $this->datacenter->curdc]); $res = $this->method_call('contacts.resolveUsername', ['username' => str_replace('@', '', $username)], ['datacenter' => $this->datacenter->curdc]);
} catch (\danog\MadelineProto\RPCErrorException $e) { } catch (\danog\MadelineProto\RPCErrorException $e) {
\danog\MadelineProto\Logger::log('Username resolution failed with error '.$e->getMessage(), \danog\MadelineProto\Logger::ERROR); \danog\MadelineProto\Logger::log('Username resolution failed with error '.$e->getMessage(), \danog\MadelineProto\Logger::ERROR);
if (strpos($e->rpc, 'FLOOD_WAIT_') === 0) {
throw $e;
}
return false; return false;
} }
if ($res['_'] === 'contacts.resolvedPeer') { if ($res['_'] === 'contacts.resolvedPeer') {