当前位置: 首页>>代码示例>>PHP>>正文


PHP Request::getInput方法代码示例

本文整理汇总了PHP中Longman\TelegramBot\Request::getInput方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::getInput方法的具体用法?PHP Request::getInput怎么用?PHP Request::getInput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Longman\TelegramBot\Request的用法示例。


在下文中一共展示了Request::getInput方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handle

 /**
  * Handle bot request from webhook
  *
  * @return bool
  */
 public function handle()
 {
     $this->input = Request::getInput();
     if (empty($this->input)) {
         throw new TelegramException('Input is empty!');
     }
     $post = json_decode($this->input, true);
     if (empty($post)) {
         throw new TelegramException('Invalid JSON!');
     }
     return $this->processUpdate(new Update($post, $this->bot_name))->isOk();
 }
开发者ID:noplanman,项目名称:php-telegram-bot,代码行数:17,代码来源:Telegram.php

示例2: handle

 /**
  * Handle bot request
  *
  * @return \Longman\TelegramBot\Telegram
  */
 public function handle()
 {
     $this->input = Request::getInput();
     if (empty($this->input)) {
         throw new TelegramException('Input is empty!');
     }
     $post = json_decode($this->input, true);
     if (empty($post)) {
         throw new TelegramException('Invalid JSON!');
     }
     $update = new Update($post, $this->bot_name);
     $this->insertRequest($update);
     $message = $update->getMessage();
     // check type
     $type = $message->getType();
     switch ($type) {
         default:
         case 'text':
             // do nothing
             break;
         case 'command':
             // execute command
             $command = $message->getCommand();
             return $this->executeCommand($command, $update);
             break;
         case 'new_chat_participant':
             // trigger new participant
             $command = 'new_chat_participant';
             return $this->executeCommand($command, $update);
             break;
         case 'left_chat_participant':
             // trigger left chat participant
             $command = 'left_chat_participant';
             return $this->executeCommand($command, $update);
             break;
         case 'new_chat_title':
             // trigger new_chat_title
             break;
         case 'delete_chat_photo':
             // trigger delete_chat_photo
             break;
         case 'group_chat_created':
             // trigger group_chat_created
             break;
     }
 }
开发者ID:TAOOAT,项目名称:php-telegram-bot,代码行数:51,代码来源:Telegram.php

示例3: handle

 /**
  * Handle bot request
  *
  * @return \Longman\TelegramBot\Telegram
  */
 public function handle()
 {
     $this->input = Request::getInput();
     if (empty($this->input)) {
         throw new TelegramException('Input is empty!');
     }
     $post = json_decode($this->input, true);
     if (empty($post)) {
         throw new TelegramException('Invalid JSON!');
     }
     $update = new Update($post, $this->bot_name);
     //Load admin Commands
     if ($this->admin_enabled) {
         $message = $update->getMessage();
         //$from = $message->getFrom();
         //$user_id = $from->getId();
         //Admin command avaiable only in single chat with the bot
         $chat = $message->getChat();
         $user_id = $chat->getId();
         if (in_array($user_id, $this->admins_list)) {
             $this->addCommandsPath(BASE_PATH . '/Admin');
         }
     }
     $this->insertRequest($update);
     $message = $update->getMessage();
     // check type
     $type = $message->getType();
     switch ($type) {
         default:
         case 'text':
             // do nothing
             break;
         case 'command':
             // execute command
             $command = $message->getCommand();
             return $this->executeCommand($command, $update);
             break;
         case 'new_chat_participant':
             // trigger new participant
             return $this->executeCommand('Newchatparticipant', $update);
             break;
         case 'left_chat_participant':
             // trigger left chat participant
             return $this->executeCommand('Leftchatparticipant', $update);
             break;
         case 'new_chat_title':
             // trigger new_chat_title
             return $this->executeCommand('Newchattitle', $update);
             break;
         case 'delete_chat_photo':
             // trigger delete_chat_photo
             return $this->executeCommand('Deletechatphoto', $update);
             break;
         case 'group_chat_created':
             // trigger group_chat_created
             return $this->executeCommand('Groupchatcreated', $update);
             break;
     }
 }
开发者ID:nodir-y,项目名称:php-telegram-bot,代码行数:64,代码来源:Telegram.php

示例4: handle

 /**
  * Handle bot request
  *
  * @return \Longman\TelegramBot\Telegram
  */
 public function handle()
 {
     $this->input = Request::getInput();
     if (empty($this->input)) {
         throw new TelegramException('Input is empty!');
     }
     $post = json_decode($this->input, true);
     if (empty($post)) {
         throw new TelegramException('Invalid JSON!');
     }
     $update = new Update($post, $this->bot_name);
     $this->insertRequest($update);
     $command = $update->getMessage()->getCommand();
     if (!empty($command)) {
         return $this->executeCommand($command, $update);
     }
 }
开发者ID:aniston,项目名称:php-telegram-bot,代码行数:22,代码来源:Telegram.php

示例5: handle

 /**
  * Handle bot request
  *
  * @return \Longman\TelegramBot\Telegram
  */
 public function handle()
 {
     $this->input = Request::getInput();
     if (empty($this->input)) {
         throw new TelegramException('Input is empty!');
     }
     $post = json_decode($this->input, true);
     if (empty($post)) {
         throw new TelegramException('Invalid JSON!');
     }
     $update = new Update($post, $this->bot_name);
     $this->insertRequest($update);
     $message = $update->getMessage();
     // check type
     $type = $message->getType();
     switch ($type) {
         default:
         case 'text':
             // do nothing
             $chat_id = $message->getChat()->getId();
             $message_id = $message->getMessageId();
             $text = $message->getText();
             //Si estamos en modo test
             $test = new Test();
             $datatest = $test->realizarAccionesTest($message);
             if (!is_null($datatest)) {
                 return Request::sendMessage($datatest);
             } else {
                 // do nothing
             }
             break;
         case 'command':
             // execute command
             $command = $message->getCommand();
             return $this->executeCommand($command, $update);
             break;
         case 'new_chat_participant':
             // trigger new participant
             return $this->executeCommand('Newchatparticipant', $update);
             break;
         case 'left_chat_participant':
             // trigger left chat participant
             return $this->executeCommand('Leftchatparticipant', $update);
             break;
         case 'new_chat_title':
             // trigger new_chat_title
             break;
         case 'delete_chat_photo':
             // trigger delete_chat_photo
             break;
         case 'group_chat_created':
             // trigger group_chat_created
             break;
     }
 }
开发者ID:Bizkaitarra,项目名称:pintxobot,代码行数:60,代码来源:Telegram.php


注:本文中的Longman\TelegramBot\Request::getInput方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。