<?php
error_reporting(0);
if (!file_exists('madeline.php')) {
copy('
https://phar.madelineproto.xyz/madeline.php', 'madeline.php');
}
$MadelineProto = new \danog\MadelineProto\API('session.madeline');
$MadelineProto->start();
$offset = 0;
register_shutdown_function('shutdown_function', $lock);
closeConnection();
while (true) {
$updates = $MadelineProto->get_updates(['offset' => $offset, 'limit' => 50, 'timeout' => 0]);
\danog\MadelineProto\Logger::log($updates);
foreach ($updates as $update) {
$offset = $update['update_id'] + 1;
$up = $update['update']['_'];
if ($up == 'updateNewMessage' or $up == 'updateNewChannelMessage' or $up == 'updateEditChannelMessage') {
$chatID = $MadelineProto->get_info($update['update']);
$type = $chatID['type'];
$chatID = $chatID['bot_api_id'];
$userID = $update['update']['message']['from_id'];
$msg = $update['update']['message']['message'];
$msg_id = $update['update']['message']['id'];
try {
}catch(Exception $e){
}
catch(\danog\MadelineProto\RPCErrorException $e){
$MadelineProto->messages->sendMessage(['peer' => 1911961328, 'message' => $e]);
}
catch(\danog\MadelineProto\Exception $e){
}
catch(\danog\MadelineProto\TL\Conversion\Exception $e){
}
}
}
}
if ($msg=="Bot on") {
$MadelineProto->messages->sendMessage(['peer' => '$chatID', 'message' => "Bot is on"]);
}
?>