Advertisement
irokemr

Bot telegram

Feb 26th, 2020
1,015
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.25 KB | None | 0 0
  1. <?php
  2. error_reporting(0);
  3.  
  4. echo"Está página web no tiene nada xD";
  5.  
  6.  
  7.  
  8.  
  9. $botToken = "AQUI API TELEGRAM";
  10.  
  11. $website = "https://api.telegram.org/bot".$botToken;
  12.  
  13.  
  14. $update = file_get_contents('php://input');
  15. $update = json_decode($update, TRUE);
  16.  
  17.  
  18. $chatId = $update["message"]["chat"]["id"];
  19. $nombre = $update['message']['from']['first_name'];
  20. $chatType = $update["message"]["chat"]["type"];
  21.  
  22. $message = $update["message"]["text"];
  23.  
  24.  
  25.  
  26.  
  27.  
  28. $arr = explode(' ',trim($message));
  29. $command = $arr[0];
  30.  
  31. $message = substr(strstr($message," "), 1);
  32.  
  33. //No requieren variables del usuario.
  34. switch ($command) {
  35.    
  36.  
  37.     case "/binario";
  38.  
  39.    
  40.        
  41.          
  42.         $response = file_get_contents("https://todocodigos.000webhostapp.com/binario/binario.php?binario=$message");
  43.  
  44. Binario($chatId, $response);
  45.      break;
  46.      
  47.      
  48.      case "/texto";
  49.  
  50.    
  51.        
  52.          
  53.         $response = file_get_contents("https://todocodigos.000webhostapp.com/binario/texto.php?texto=$message");
  54.  
  55. texto($chatId, $response);
  56.      break;
  57.  
  58.      
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.      
  69.    
  70.  
  71.        
  72.          
  73.    
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.        
  82.        
  83.      
  84.    
  85.  
  86.          
  87.    
  88.        
  89.      
  90.  
  91.  
  92. }
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99. function Binario($chatId, $response)
  100.  
  101.  
  102.  
  103.  
  104.  
  105. {
  106.    
  107.      $url = "$GLOBALS[website]/sendMessage?chat_id=$chatId&parse_mode=HTML&text=".urlencode($response);
  108.     file_get_contents($url);
  109.    
  110.    
  111.    
  112.  
  113.  
  114. }
  115.  
  116. function texto($chatId, $response)
  117.  
  118.  
  119.  
  120.  
  121.  
  122. {
  123.    
  124.      $url = "$GLOBALS[website]/sendMessage?chat_id=$chatId&parse_mode=HTML&text=".urlencode($response);
  125.     file_get_contents($url);
  126.    
  127.    
  128.    
  129.  
  130.  
  131. }
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.    
  153.  
  154.    
  155.    
  156.    
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177. $esempiotastierainline = '[{"text":"Suscribete en youtube","url":"http://youtube.com/user/irokehabbo"},{"text":"Sigueme en twitter","url":"https://twitter.com/jose89yt"}]';
  178.   switch($command){
  179.    
  180.     case "/start":
  181.         sendMessage1($chatId,"Hola $nombre, bienvenidos a la herramienta de youtube");
  182.        
  183.          case "/start":
  184.         sendMessage1($chatId,"Sigueme en youtube y en twitter clicando aquí abajo ⬇️️",$esempiotastierainline,"inline");
  185.         break;
  186.    
  187.   }
  188.  
  189.  
  190.  
  191.  
  192.  
  193.    
  194.    
  195.    
  196.   function sendMessage1($chatId,$text,$tastiera,$tipo){
  197.     if(isset($tastiera)){
  198.       if($tipo == "fisica"){
  199.         $tastierino = '&reply_markup={"keyboard":['.urlencode($tastiera).'],"resize_keyboard":true}';
  200.       }
  201.       else {
  202.         $tastierino = '&reply_markup={"inline_keyboard":['.urlencode($tastiera).'],"resize_keyboard":true}';
  203.       }
  204.     }
  205.     $url = $GLOBALS[website]."/sendMessage?chat_id=$chatId&parse_mode=HTML&text=".urlencode($text).$tastierino;
  206.     file_get_contents($url);
  207.   }
  208.   function answerQuery($callback_query_id,$text){
  209.     $url = $GLOBALS[website]."/answerCallbackQuery?callback_query_id=$callback_query_id&text=".urlencode($text);
  210.     file_get_contents($url);
  211.   }
  212.   function editMessageText($chatId,$message_id,$newText)
  213.   {
  214.     $url = $GLOBALS[website]."/editMessageText?chat_id=$chatId&message_id=$message_id&parse_mode=HTML&text=".urlencode($newText);
  215.     file_get_contents($url);
  216.   }
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement