1
0
mirror of https://github.com/danog/telerpc.git synced 2024-11-30 04:38:57 +01:00
This commit is contained in:
Daniil Gentili 2024-06-15 18:55:38 +02:00
parent 58bb7dd5e4
commit bd0da09fb5

View File

@ -10,7 +10,11 @@ final class Main
'SLOWMODE_WAIT_%d' => 420, 'SLOWMODE_WAIT_%d' => 420,
'TAKEOUT_INIT_DELAY_%d' => 420, 'TAKEOUT_INIT_DELAY_%d' => 420,
'FLOOD_PREMIUM_WAIT_%d' => 420, 'FLOOD_PREMIUM_WAIT_%d' => 420,
'FLOOD_TEST_PHONE_WAIT_%d' => 420,
'SESSION_PASSWORD_NEEDED' => 401, 'SESSION_PASSWORD_NEEDED' => 401,
'AUTH_KEY_DUPLICATED' => 406,
]; ];
private ?\PDO $pdo = null; private ?\PDO $pdo = null;
@ -119,7 +123,7 @@ final class Main
$r[$code][$error][] = $method; $r[$code][$error][] = $method;
} }
$errors[$error] = true; $errors[$error] = true;
if (\in_array($error, ['USER_BOT_REQUIRED', 'USER_BOT_INVALID']) && !\in_array($method, $bot_only) && !in_array($method, ['bots.setBotInfo', 'bots.getBotInfo'])) { if (\in_array($error, ['USER_BOT_REQUIRED', 'USER_BOT_INVALID']) && !\in_array($method, $bot_only) && !\in_array($method, ['bots.setBotInfo', 'bots.getBotInfo'])) {
$bot_only[] = $method; $bot_only[] = $method;
} }
}); });
@ -202,8 +206,8 @@ final class Main
$q = $this->pdo->prepare('SELECT error, method FROM errors'); $q = $this->pdo->prepare('SELECT error, method FROM errors');
$q->execute(); $q->execute();
$r = $q->fetchAll(PDO::FETCH_COLUMN | PDO::FETCH_GROUP); $r = $q->fetchAll(PDO::FETCH_COLUMN | PDO::FETCH_GROUP);
foreach (array_merge($r, self::GLOBAL_CODES) as $error => $methods) { foreach (\array_merge($r, self::GLOBAL_CODES) as $error => $methods) {
if (is_int($methods)) { if (\is_int($methods)) {
$methods = []; $methods = [];
} }
$anyok = false; $anyok = false;