Exemplo n.º 1
0
 private function startBot($debug)
 {
     if (isset($debug)) {
         $update = $debug;
     } else {
         $content = file_get_contents("php://input");
         $update = json_decode($content, true);
     }
     if (!$update) {
         return false;
     }
     //        Telegram::talkForced('56390227', print_r($update, true));
     //        return true;
     if (isset($update["message"])) {
         $this->processMessage($update['message']);
     } elseif (isset($update["inline_query"])) {
         $this->InlineQuery = new InlineQuery($update["inline_query"]);
         Telegram::answerInlineQuery($this->InlineQuery->id, $this->InlineQuery->results);
     } elseif (isset($update["callback_query"])) {
         $message = $update["callback_query"]["message"];
         $message['from'] = $update["callback_query"]["from"];
         $message['text'] = $update["callback_query"]["data"];
         $message['callback'] = true;
         $this->processMessage($message);
     }
     return true;
 }