Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $postgHeader = "Новости юрисдикций";
- $posTG_title = "Рубль и ОФЗ дорожают на фоне общего оптимизма, задвинувшего в угол геополитику";
- $tgpic = "rechtsanwalt-gmbh.ru/images/Countries/All/All_10.jpg";
- $postgLink_news = "https://rechtsanwalt-gmbh.ru/business-news-mail.html?news_id=5592";
- $postgLink_pieces = explode("://", $postgLink_news);
- $postgLink_piece = explode("/", $postgLink_pieces[1]);
- $postgLink_title = $postgLink_piece[0];
- $botToken = "***";
- $chat_id = "@new_rech_test";
- $message = $postgHeader.":* ".$posTG_title." [%7F](".$tgpic.")";
- $bot_url = "https://api.telegram.org/bot$botToken/";
- $url = $bot_url."sendMessage?chat_id=".$chat_id."&parse_mode=Markdown"."&text=*".urlencode($message);
- $buttons = json_encode([
- "inline_keyboard" => [
- // первый ряд
- [
- // первая кнопка первого ряда
- [
- "text" => "👍",
- "callback_data" => "/like"
- ],
- // вторая кнопка первого ряда
- [
- "text" => "😐",
- "callback_data" => "/neutral"
- ],
- // третья кнопка второго ряда
- [
- "text" => "👎",
- "callback_data" => "/dislike"
- ]
- ],
- // второй ряд
- [
- // первая кнопка второго ряда
- [
- "text"=>$postgLink_title,
- "url"=>$postgLink_news
- ],
- ]
- ]
- ], true);
- $content = file_get_contents($url."&reply_markup=".$buttons);
- $updates = json_decode(file_get_contents("php://input") ,true);
- $callback_query = $updates["callback_query"];
- $cq_command = mb_strtolower($callback_query["data"]);
- $like = '👍';
- $neutral = '😐';
- $dislike = '👎';
- $sum = 0;
- $updates = json_decode(file_get_contents("php://input") ,true);
- if($updates['update_id']) {
- if($callback_query['data'] == '/like') {
- $sum = $sum + 1;
- $botToken = "***";
- $chat_id = "@new_rech_test";
- $message1 = "Лайк нажат";
- $bot_url = "https://api.telegram.org/bot$botToken/";
- $messageId = $callback_query["message"]["message_id"];
- $new_buttons = json_encode([
- "inline_keyboard" => [
- // первый ряд
- [
- // первая кнопка первого ряда
- [
- "text" => $like.$sum,
- "callback_data" => "/like"
- ],
- // вторая кнопка первого ряда
- [
- "text" => $neutral,
- "callback_data" => "/neutral"
- ],
- // третья кнопка второго ряда
- [
- "text" => $dislike,
- "callback_data" => "/dislike"
- ]
- ],
- // второй ряд
- [
- // первая кнопка второго ряда
- [
- "text"=>$postgLink_title,
- "url"=>$postgLink_news
- ],
- ]
- ]
- ], true);
- $urledit = $bot_url."editMessageReplyMarkup?chat_id=".$chat_id."&message_id=".$messageId."&reply_markup=".$new_buttons;
- file_get_contents($urledit);
- $updates = json_decode(file_get_contents("php://input") ,true);
- $callback_query = $updates["callback_query"];
- $cq_command = mb_strtolower($callback_query["data"]);
- }
- }
- else {
- $updates = json_decode(file_get_contents("php://input") ,true);
- $callback_query = $updates["callback_query"];
- $cq_command = mb_strtolower($callback_query["data"]);
- }
- ?>
Add Comment
Please, Sign In to add comment