RuslanK

tgBot

Mar 2nd, 2021 (edited)
849
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.90 KB | None | 0 0
  1. <?php
  2.     function buttons($data, $ch)
  3.     {  
  4.         if(array_key_exists("callback_query", $data)):
  5.             $chat_id = $data[callback_query]['message']['chat']['id'];
  6.             $message_id = $data[callback_query]['message']['message_id'];
  7.         else:
  8.             $chat_id = $data['message']['chat']['id'];
  9.             $message_id = $data['message']['message_id'];
  10.         endif;
  11.  
  12.         $response2 = array(
  13.             'chat_id' => 777,
  14.             'from_chat_id' => $chat_id,
  15.             'message_id' => $message_id
  16.         ); 
  17.        
  18.         curl_setopt($ch2, CURLOPT_POST, 1);  
  19.         curl_setopt($ch2, CURLOPT_POSTFIELDS, $response2);
  20.         curl_setopt($ch2, CURLOPT_RETURNTRANSFER, true);
  21.         curl_setopt($ch2, CURLOPT_HEADER, false);
  22.         curl_exec($ch2);
  23.         curl_close($ch2);  
  24.     }
  25.    
  26.     $token = '777';
  27.     $data = file_get_contents('php://input');
  28.     $data = json_decode($data, true);
  29.     $ch2 = curl_init('https://api.telegram.org/bot' . $token . '/forwardMessage');
  30.     buttons($data, $ch, $ch2);
  31. ?>
Add Comment
Please, Sign In to add comment