. */ require 'vendor/autoload.php'; $logger = new Logger(new SettingsLogger); set_error_handler(['\danog\MadelineProto\Exception', 'ExceptionErrorHandler']); if ($argc !== 3) { die("Usage: {$argv[0]} layernumberold layernumbernew\n"); } /** * Get TL info of layer. * * @param int $layer Layer number * * @internal * * @return void */ function getTL($layer) { $layerFile = __DIR__."/../schemas/TL_telegram_v$layer.tl"; $layer = new TL(); $layer->init((new TLSchema)->setAPISchema($layerFile)->setSecretSchema('')); return ['methods' => $layer->getMethods(), 'constructors' => $layer->getConstructors()]; } $old = getTL($argv[1]); $new = getTL($argv[2]); $res = ''; $bot = new \danog\MadelineProto\API('bot.madeline'); $bot->start(); $user = new \danog\MadelineProto\API('secret.madeline'); $user->start(); $methods = []; foreach ($new['methods']->by_id as $constructor) { $name = $constructor['method']; if (!$old['methods']->findByMethod($name)) { if (strtolower($name) === 'account.deleteaccount') { continue; } //readline("$name?"); [$namespace, $method] = explode('.', $name); try { $bot->{$namespace}->{$method}(); } catch (RPCErrorException) { } try { $user->{$namespace}->{$method}(); } catch (RPCErrorException) { } } }