Advertisement
Guest User

AIUTO PHP

a guest
Nov 12th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.67 KB | None | 0 0
  1. <?php
  2.  
  3.   $botToken = "Token";
  4.   $website = "https://api.telegram.org/bot".$botToken;
  5.  
  6.  
  7.   $update = file_get_contents('php://input');
  8.   $update = json_decode($update, TRUE);
  9.  
  10.   $chatId = $update['message']['from']['id'];
  11.   $nome = $update['message']['from']['first_name'];
  12.   $text = $update['message']['text'];
  13.  
  14.  
  15.   $agg = json_decode($update,JSON_PRETTY_PRINT);
  16.  
  17.  
  18.   switch($text)
  19.   {
  20.   case "Info":
  21.   sendMessage($chatId,"Se vuoi contattarci in privato per bug o errori su questo bot o altre cose:
  22. zio3: @zio (Founder)
  23. zio2: @zio (Admin)
  24. zio1: @zio (Admin)
  25. Per limitati: @HWHelpBot
  26. Mi raccomando, quando scrivete in privato avvisate che venite dal bot, o verrete spamreportati
  27. Grazie :D");
  28.   break;
  29.   case "Chi Sia?":
  30.   sendMessage($chatId,"Noi siamo tre amici, che ci siamo conosciuti qui su telegram, e abbiamo deciso di aprire questo gruppo!");
  31.   break;
  32.   case "Male...":
  33.   sendMessage($chatId,"Uh, mi dispiace... Che è successo?");
  34.   break;
  35.   default:
  36.   $tastierabenvenuto = '["Info"],["Male..."],["Chi Sia?"]';
  37.   sendMessage($chatId,"Ciao <b>$nome</b>!
  38. Questo bot ti darà info sul gruppo @HWGroupTech!
  39. Nel gruppo si parla di informatica, bot, programmazione, PC, configurazioni, elettronica... diciamo un pò di tutto!
  40. Clicca i vari pulsanti per avere altre info sul gruppo!",$tastierabenvenuto);
  41.   break;
  42.   }
  43.   function sendMessage($chatId,$text,$tastiera)
  44.   {
  45.     if(isset($tastiera))
  46.     {
  47.     $tastierino = '&reply_markup={"keyboard":['.$tastiera.'],"resize_keyboard":true}';
  48.     }
  49.   $url = $GLOBALS[website]."/sendMessage?chat_id=$chatId&parse_mode=HTML&text=".urlencode($text).$tastierino;
  50.   file_get_contents($url);
  51.   }
  52.  
  53.  
  54.   ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement