Telegram.php 897 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: chendeben
  5. * Date: 2017/12/6
  6. * Time: 11:50
  7. */
  8. namespace PhpLife\App\Api\Controller;
  9. use PhpLife\App\Api\Package\Database\File;
  10. use PhpLife\App\Api\Package\Database\Hash;
  11. use PhpLife\App\Api\Controller;
  12. use PhpLife\Library\Sphinx;
  13. class Telegram extends Controller
  14. {
  15. public function main(){
  16. $telegram=new \Telegram("532191649:AAGxdBNPQGrHo0Ralqpg_sSZFrJJwCh0KIk");
  17. $msg=$telegram->Text();
  18. if ($msg=="地址"){
  19. $chat_id = $telegram->ChatID();
  20. $content = array('chat_id' => $chat_id, 'text' => '最新的官网地址是【 https://ss5.my110.cf 】');
  21. $telegram->sendMessage($content);
  22. }else{
  23. $chat_id = $telegram->ChatID();
  24. $content = array('chat_id' => $chat_id, 'text' => '你说:'.$msg);
  25. $telegram->sendMessage($content);
  26. }
  27. }
  28. }