<?xml version="1.0" encoding="utf-8"?>
<FictionBook xmlns="http://www.gribuser.ru/xml/fictionbook/2.0" xmlns:l="http://www.w3.org/1999/xlink">
<stylesheet type="text/css">
.body{font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
}
.p{margin:0.5em 0 0 0.3em; padding:0.2em; text-align:justify;
}
</stylesheet>
<description>
<title-info>
<genre>sf_history</genre>
<author>
<first-name>The author's name</first-name>
<last-name>The author's last name</last-name>
</author>
<book-title>Book name</book-title>
<annotation></annotation>
<date>Sana</date>
<lang>ru</lang>
</title-info>
<document-info>
<author><nickname></nickname>
</author>
<program-used>Lib converter jcms</program-used>
<date value=""></date>
<src-url>http://johncms.com</src-url>
<id></id>
<version>1.0</version>
<history><p>book</p></history>
</document-info>
</description>
<body>
<title><p>Telegram bot Like, DisLike</p>
</title>
<section><p><?php </p>
<p>$API_KEY = ''; //a1</p>
<p>define('API_KEY',$API_KEY);</p>
<p></p>
<p>function bot($method,$datas=[]){</p>
<p>    $url = "https://api.telegram.org/bot".API_KEY."/".$method;</p>
<p>    $ch = curl_init();</p>
<p>    curl_setopt($ch,CURLOPT_URL,$url);</p>
<p>    curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);</p>
<p>    curl_setopt($ch,CURLOPT_POSTFIELDS,$datas);</p>
<p>    $res = curl_exec($ch);</p>
<p>    if(curl_error($ch)){</p>
<p>        var_dump(curl_error($ch));</p>
<p>    }else{</p>
<p>        return json_decode($res);</p>
<p>    }</p>
<p>}</p>
<p></p>
<p>$update = json_decode(file_get_contents('php://input'));</p>
<p>$message = $update->message;</p>
<p>$from_id = $message->from->id;</p>
<p>$chat_id = $message->chat->id;</p>
<p>$text = $message->text;</p>
<p>$chat_id2 = $update->callback_query->message->chat->id;</p>
<p>$message_id2 =  $update->callback_query->message->message_id;</p>
<p>$message_id = $update->message->message_id;</p>
<p></p>
<p>$data = $update->callback_query->data;</p>
<p>$test = "115056828";</p>
<p>$abood = "115056828";</p>
<p>$user = $update->callback_query->from->username;</p>
<p>$textE = file_get_contents("send.txt");</p>
<p></p>
<p>if($text and $chat_id == $abood){</p>
<p>  file_put_contents("send.txt","$text");</p>
<p>  bot('sendMessage',[</p>
<p>    'chat_id'=>$chat_id,</p>
<p>    'text'=>"Matn qisqartirildi \n\n $text ",</p>
<p>    'parse_mode'=>"MarkDown",</p>
<p>    'reply_markup'=>json_encode([</p>
<p>    'inline_keyboard'=>[</p>
<p>[</p>
<p>['text'=>"send",'callback_data'=>"send"]</p>
<p>],</p>
<p>]</p>
<p>])</p>
<p>]);</p>
<p>}</p>
<p>if($data == "send"){</p>
<p>bot('sendMessage',[</p>
<p>'chat_id'=>"@unversal",</p>
<p>'text'=>$textE,</p>
<p>'parse_mode'=>'MarkDown',</p>
<p>'disable_web_page_preview'=>true,</p>
<p>'reply_markup'=>json_encode([</p>
<p>'inline_keyboard'=>[</p>
<p>[</p>
<p>['text'=>"Menga yoqdi??",'callback_data'=>"like"],['text'=>"Menga yomqadi??",'callback_data'=>"dslike"]</p>
<p>],</p>
<p>]</p>
<p>])</p>
<p>]);</p>
<p>bot('sendMessage',[</p>
<p>  'chat_id'=>$abood,</p>
<p>  'text'=>"Chop etiladigan nashr",</p>
<p>]);</p>
<p>}</p>
<p>if($data == "info"){</p>
<p>bot('answerCallbackQuery',[</p>
<p>'callback_query_id'=>$update->callback_query->id,</p>
<p>'text'=>"Adminga Yuborildi", //a7</p>
<p>'show_alert'=>true</p>
<p>]);</p>
<p>}</p>
<p>if($data == "like"){</p>
<p>bot('answerCallbackQuery',[</p>
<p>'callback_query_id'=>$update->callback_query->id,</p>
<p>'text'=>"Sizga yoqqanidan hursandmiz", //a8</p>
<p>'show_alert'=>true</p>
<p>]);</p>
<p>bot('sendMessage',[</p>
<p>  'chat_id'=>$abood,</p>
<p>  'message_id'=>$message_id,</p>
<p>  'text'=>"?? : @$user ",</p>
<p>]);</p>
<p>}</p>
<p></p>
<p>if($data == "dslike"){</p>
<p>bot('answerCallbackQuery',[</p>
<p>'callback_query_id'=>$update->callback_query->id,</p>
<p>'text'=>"Yoqmagan Bulsa afsusdamiz", //a9</p>
<p>'show_alert'=>true</p>
<p>]);</p>
<p>bot('sendMessage',[</p>
<p>  'chat_id'=>$abood,</p>
<p>  'message_id'=>$message_id,</p>
<p>  'text'=>"?? : @$user ",</p>
<p>]);</p>
<p>}</p>
</section>
</body>
</FictionBook>