#!/usr/bin/env php . */ require_once 'vendor/autoload.php'; $settings = []; if (file_exists('web_data.php')) { require_once 'web_data.php'; } $MadelineProto = \danog\MadelineProto\Serialization::deserialize('session.madeline'); if (file_exists('number.php') && $MadelineProto === false) { include_once 'number.php'; $MadelineProto = new \danog\MadelineProto\API($settings); $checkedPhone = $MadelineProto->auth->checkPhone(// auth.checkPhone becomes auth->checkPhone [ 'phone_number' => $number, ] ); \danog\MadelineProto\Logger::log($checkedPhone); $sentCode = $MadelineProto->phone_login($number); \danog\MadelineProto\Logger::log($sentCode); echo 'Enter the code you received: '; $code = ''; for ($x = 0; $x < $sentCode['type']['length']; $x++) { $code .= fgetc(STDIN); } $authorization = $MadelineProto->complete_phone_login($code); \danog\MadelineProto\Logger::log($authorization); echo 'Serializing MadelineProto to session.madeline...'.PHP_EOL; echo 'Wrote '.\danog\MadelineProto\Serialization::serialize('session.madeline', $MadelineProto).' bytes'.PHP_EOL; } echo 'Deserializing MadelineProto from session.madeline...'.PHP_EOL; $MadelineProto = \danog\MadelineProto\Serialization::deserialize('session.madeline'); $message = (getenv('TRAVIS_COMMIT') == '') ? 'I iz works always (io laborare sembre) (yo lavorar siempre)' : ('Travis ci tests in progress: commit '.getenv('TRAVIS_COMMIT').', job '.getenv('TRAVIS_JOB_NUMBER').', PHP version: '.getenv('TRAVIS_PHP_VERSION')); $flutter = 'https://storage.pwrtelegram.xyz/pwrtelegrambot/document/file_6570.mp4'; $mention = $MadelineProto->get_info('@danogentili'); // Returns an array with all of the constructors that can be extracted from a username or an id $mention = $mention['user_id']; // Selects only the numeric user id foreach (['@pwrtelegramgroup', '@pwrtelegramgroupita'] as $peer) { $sentMessage = $MadelineProto->messages->sendMessage(['peer' => $peer, 'message' => $message, 'entities' => [['_' => 'inputMessageEntityMentionName', 'offset' => 0, 'length' => strlen($message), 'user_id' => $mention]]]); \danog\MadelineProto\Logger::log($sentMessage); } sleep(5); var_dump($MadelineProto->API->get_updates()); echo 'Serializing MadelineProto to session.madeline...'.PHP_EOL; echo 'Wrote '.\danog\MadelineProto\Serialization::serialize('session.madeline', $MadelineProto).' bytes'.PHP_EOL; echo 'Size of MadelineProto instance is '.strlen(serialize($MadelineProto)).' bytes'.PHP_EOL; if (file_exists('token.php')) { include_once 'token.php'; $MadelineProto = new \danog\MadelineProto\API($settings); $authorization = $MadelineProto->bot_login($token); \danog\MadelineProto\Logger::log($authorization); } $message = 'yay'; $mention = $MadelineProto->get_info('@danogentili'); // Returns an array with all of the constructors that can be extracted from a username or an id $mention = $mention['user_id']; // Selects only the numeric user id foreach (['@pwrtelegramgroup', '@pwrtelegramgroupita'] as $peer) { $sentMessage = $MadelineProto->messages->sendMessage(['peer' => $peer, 'message' => $message, 'entities' => [['_' => 'inputMessageEntityMentionName', 'offset' => 0, 'length' => strlen($message), 'user_id' => $mention]]]); \danog\MadelineProto\Logger::log($sentMessage); } sleep(5); var_dump($MadelineProto->API->get_updates()); while (true) { $sentMessage = $MadelineProto->messages->sendMessage(['peer' => '@pwrtelegramgroupita', 'message' => $message, 'entities' => [['_' => 'inputMessageEntityMentionName', 'offset' => 0, 'length' => strlen($message), 'user_id' => $mention]]]); }