#!/usr/bin/env php . */ require 'vendor/autoload.php'; $param = 1; \danog\MadelineProto\Logger::constructor($param); $logger = \danog\MadelineProto\Logger::$default; set_error_handler(['\danog\MadelineProto\Exception', 'ExceptionErrorHandler']); \danog\MadelineProto\Logger::log('Copying readme...', \danog\MadelineProto\Logger::NOTICE); file_put_contents('docs/docs/index.md', '--- title: MadelineProto documentation description: PHP client/server for the telegram MTProto protocol (a better tg-cli) image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png --- '.str_replace(' ['td' => __DIR__.'/src/danog/MadelineProto/TL_td.tl'], 'title' => 'MadelineProto API documentation (td-lib)', 'description' => 'MadelineProto API documentation (td-lib)', 'output_dir' => __DIR__.'/docs/docs/TD_docs', 'readme' => false, 'td' => true, ], [ 'tl_schema' => ['mtproto' => __DIR__.'/src/danog/MadelineProto/TL_mtproto_v1.json'], 'title' => 'MadelineProto API documentation (mtproto)', 'description' => 'MadelineProto API documentation (mtproto)', 'output_dir' => __DIR__.'/docs/docs/MTProto_docs', 'readme' => false, ], [ 'tl_schema' => ['telegram' => __DIR__.'/src/danog/MadelineProto/TL_telegram_v75.tl', 'calls' => __DIR__.'/src/danog/MadelineProto/TL_calls.tl', 'secret' => __DIR__.'/src/danog/MadelineProto/TL_secret.tl', 'td' => __DIR__.'/src/danog/MadelineProto/TL_td.tl'], 'title' => 'MadelineProto API documentation (layer 75)', 'description' => 'MadelineProto API documentation (layer 75)', 'output_dir' => __DIR__.'/docs/docs/API_docs', 'readme' => false, ], ]; $layer_list = ''; foreach (array_slice(glob(__DIR__.'/src/danog/MadelineProto/TL_telegram_*'), 0, -1) as $file) { $layer = preg_replace(['/.*telegram_/', '/\..+/'], '', $file); $docs[] = [ 'tl_schema' => ['telegram' => $file], 'title' => 'MadelineProto API documentation (layer '.$layer.')', 'description' => 'MadelineProto API documentation (layer '.$layer.')', 'output_dir' => __DIR__.'/docs/old_docs/API_docs_'.$layer, 'readme' => true, ]; $layer_list = '[Layer '.$layer.'](API_docs_'.$layer.'/) '; } file_put_contents('docs/old_docs/README.md', '--- title: Documentations of old mtproto layers description: Documentation of old mtproto layers --- # Documentation of old mtproto layers '.$layer_list); $doc = new \danog\MadelineProto\AnnotationsBuilder($logger, $docs[2]); $doc->mk_annotations(); foreach ($docs as $settings) { $doc = new \danog\MadelineProto\DocsBuilder($logger, $settings); $doc->mk_docs(); }