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

Localize account ban message

This commit is contained in:
Daniil Gentili 2023-07-18 15:51:39 +02:00
parent ae45f71af3
commit 00fa47ae64
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
2 changed files with 7 additions and 14 deletions

View File

@ -148,5 +148,7 @@
"invalid_dl.php_session": "%s is not a valid download script because its session ID is different (expected %s, got %s)", "invalid_dl.php_session": "%s is not a valid download script because its session ID is different (expected %s, got %s)",
"need_dl.php": "Could not generate default download script (%s), please create a dl.php file with the following content: %s and pass its URL to the second parameter of getDownloadLink", "need_dl.php": "Could not generate default download script (%s), please create a dl.php file with the following content: %s and pass its URL to the second parameter of getDownloadLink",
"dl.php_powered_by_madelineproto": "Telegram file download server (up to 4GB), powered by <a href=\"https://docs.madelineproto.xyz\" target=\"_blank\">MadelineProto</a>!<br>Click <a href=\"https://docs.madelineproto.xyz/docs/FILES.html#getting-a-download-link\" target=\"_blank\">here</a> for more info on how to setup your very own Telegram file download server!" "dl.php_powered_by_madelineproto": "Telegram file download server (up to 4GB), powered by <a href=\"https://docs.madelineproto.xyz\" target=\"_blank\">MadelineProto</a>!<br>Click <a href=\"https://docs.madelineproto.xyz/docs/FILES.html#getting-a-download-link\" target=\"_blank\">here</a> for more info on how to setup your very own Telegram file download server!",
"account_banned": "!!!!!!! WARNING !!!!!!!\nTelegram's flood prevention system suspended this account.\nTo continue, manual verification is required.\nSend an email to recover@telegram.org, asking to unban the phone number %s, and shortly describe what will you do with this phone number.\nThen login again.\nIf you intentionally deleted this account, ignore this message."
} }

View File

@ -20,6 +20,7 @@ declare(strict_types=1);
namespace danog\MadelineProto\MTProtoSession; namespace danog\MadelineProto\MTProtoSession;
use danog\MadelineProto\Lang;
use danog\MadelineProto\Logger; use danog\MadelineProto\Logger;
use danog\MadelineProto\Loop\Update\UpdateLoop; use danog\MadelineProto\Loop\Update\UpdateLoop;
use danog\MadelineProto\MTProto; use danog\MadelineProto\MTProto;
@ -322,13 +323,8 @@ trait ResponseHandler
case 'SESSION_EXPIRED': case 'SESSION_EXPIRED':
$this->logger->logger($response['error_message'], Logger::FATAL_ERROR); $this->logger->logger($response['error_message'], Logger::FATAL_ERROR);
if (\in_array($response['error_message'], ['USER_DEACTIVATED', 'USER_DEACTIVATED_BAN'], true)) { if (\in_array($response['error_message'], ['USER_DEACTIVATED', 'USER_DEACTIVATED_BAN'], true)) {
$this->logger->logger('!!!!!!! WARNING !!!!!!!', Logger::FATAL_ERROR); $phone = isset($this->API->authorization['user']['phone']) ? '+' . $this->API->authorization['user']['phone'] : '???';
$this->logger->logger("Telegram's flood prevention system suspended this account.", Logger::ERROR); $this->logger->logger(sprintf(Lang::$current_lang['account_banned'], $phone), Logger::FATAL_ERROR);
$this->logger->logger('To continue, manual verification is required.', Logger::FATAL_ERROR);
$phone = isset($this->API->authorization['user']['phone']) ? '+' . $this->API->authorization['user']['phone'] : 'you are currently using';
$this->logger->logger('Send an email to recover@telegram.org, asking to unban the phone number ' . $phone . ', and shortly describe what will you do with this phone number.', Logger::FATAL_ERROR);
$this->logger->logger('Then login again.', Logger::FATAL_ERROR);
$this->logger->logger('If you intentionally deleted this account, ignore this message.', Logger::FATAL_ERROR);
} }
return fn () => new RPCErrorException($response['error_message'], $response['error_code'], $request->getConstructor()); return fn () => new RPCErrorException($response['error_message'], $response['error_code'], $request->getConstructor());
case 'AUTH_KEY_UNREGISTERED': case 'AUTH_KEY_UNREGISTERED':
@ -347,13 +343,8 @@ trait ResponseHandler
$this->logger->logger("Auth key not registered in DC {$this->datacenter} with RPC error {$response['error_message']}, resetting temporary and permanent auth keys...", Logger::ERROR); $this->logger->logger("Auth key not registered in DC {$this->datacenter} with RPC error {$response['error_message']}, resetting temporary and permanent auth keys...", Logger::ERROR);
if ($this->API->authorized_dc == $this->datacenter && $this->API->authorized === \danog\MadelineProto\API::LOGGED_IN) { if ($this->API->authorized_dc == $this->datacenter && $this->API->authorized === \danog\MadelineProto\API::LOGGED_IN) {
$this->logger->logger('Permanent auth key was main authorized key, logging out...', Logger::FATAL_ERROR); $this->logger->logger('Permanent auth key was main authorized key, logging out...', Logger::FATAL_ERROR);
$this->logger->logger('!!!!!!! WARNING !!!!!!!', Logger::FATAL_ERROR);
$this->logger->logger("Telegram's flood prevention system suspended this account.", Logger::ERROR);
$this->logger->logger('To continue, manual verification is required.', Logger::FATAL_ERROR);
$phone = isset($this->API->authorization['user']['phone']) ? '+' . $this->API->authorization['user']['phone'] : 'you are currently using'; $phone = isset($this->API->authorization['user']['phone']) ? '+' . $this->API->authorization['user']['phone'] : 'you are currently using';
$this->logger->logger('Send an email to recover@telegram.org, asking to unban the phone number ' . $phone . ', and quickly describe what will you do with this phone number.', Logger::FATAL_ERROR); $this->logger->logger(sprintf(Lang::$current_lang['account_banned'], $phone), Logger::FATAL_ERROR);
$this->logger->logger('Then login again.', Logger::FATAL_ERROR);
$this->logger->logger('If you intentionally deleted this account, ignore this message.', Logger::FATAL_ERROR);
return fn () => new RPCErrorException($response['error_message'], $response['error_code'], $request->getConstructor()); return fn () => new RPCErrorException($response['error_message'], $response['error_code'], $request->getConstructor());
} }
EventLoop::queue(function () use ($request): void { EventLoop::queue(function () use ($request): void {