Telegram.php 1.1 KB

123456789101112131415161718192021222324252627282930313233
  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\Frame\Logger;
  13. use PhpLife\Library\Sphinx;
  14. class Telegram extends Controller
  15. {
  16. public function main(){
  17. $telegram=new \Telegram("532191649:AAGxdBNPQGrHo0Ralqpg_sSZFrJJwCh0KIk");
  18. $msg=$telegram->Text();
  19. // Logger::setLog("cdb@meitu.com",json_encode($msg));
  20. file_put_contents("/data/wwwlogs/log.txt", json_encode($msg),FILE_APPEND);
  21. if ($msg=="/ss5"){
  22. $chat_id = $telegram->ChatID();
  23. $content = array('chat_id' => $chat_id, 'text' => '最新的官网临时地址是【 https://www.ss5.xyz/ 】');
  24. $telegram->sendMessage($content);
  25. }else{
  26. $chat_id = $telegram->ChatID();
  27. $content = array('chat_id' => $chat_id, 'text' => '最新的官网临时地址是【 https://www.ss5.xyz/ 】');
  28. $telegram->sendMessage($content);
  29. }
  30. }
  31. }