1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-30 06:39:01 +01:00

Properly wait when making getPwrChat request

This commit is contained in:
Daniil Gentili 2023-08-06 21:40:44 +02:00
parent 9a91c97b6e
commit 5663eb1ba9
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
2 changed files with 4 additions and 3 deletions

View File

@ -20,6 +20,7 @@ declare(strict_types=1);
namespace danog\MadelineProto\MTProtoSession;
use Amp\SignalException;
use danog\MadelineProto\Lang;
use danog\MadelineProto\Logger;
use danog\MadelineProto\Loop\Update\UpdateLoop;
@ -332,7 +333,7 @@ trait ResponseHandler
$this->logger->logger(\sprintf(Lang::$current_lang['account_banned'], $phone), Logger::FATAL_ERROR);
}
$this->API->logout();
return fn () => new RPCErrorException($response['error_message'], $response['error_code'], $request->getConstructor());
throw new SignalException(\sprintf(Lang::$current_lang['account_banned'], $phone));
case 'AUTH_KEY_UNREGISTERED':
case 'AUTH_KEY_INVALID':
if ($this->API->authorized !== \danog\MadelineProto\API::LOGGED_IN) {
@ -352,7 +353,7 @@ trait ResponseHandler
$phone = isset($this->API->authorization['user']['phone']) ? '+' . $this->API->authorization['user']['phone'] : 'you are currently using';
$this->logger->logger(\sprintf(Lang::$current_lang['account_banned'], $phone), Logger::FATAL_ERROR);
$this->API->logout();
return fn () => new RPCErrorException($response['error_message'], $response['error_code'], $request->getConstructor());
throw new SignalException(\sprintf(Lang::$current_lang['account_banned'], $phone));
}
EventLoop::queue(function () use ($request): void {
$this->API->initAuthorization();

View File

@ -1189,7 +1189,7 @@ trait PeerHandler
$last_count = -1;
do {
try {
$gres = $this->methodCallAsyncRead('channels.getParticipants', ['channel' => $channel, 'filter' => ['_' => $filter, 'q' => $q], 'offset' => $offset, 'limit' => $limit, 'hash' => $hash = $this->getParticipantsHash($channel, $filter, $q, $offset, $limit)], ['heavy' => true]);
$gres = $this->methodCallAsyncRead('channels.getParticipants', ['channel' => $channel, 'filter' => ['_' => $filter, 'q' => $q], 'offset' => $offset, 'limit' => $limit, 'hash' => $hash = $this->getParticipantsHash($channel, $filter, $q, $offset, $limit)], ['heavy' => true, 'FloodWaitLimit' => 86400]);
} catch (RPCErrorException $e) {
if ($e->rpc === 'CHAT_ADMIN_REQUIRED') {
$this->logger->logger($e->rpc);