telegramBot::sendChatAction PHP 메소드

sendChatAction() 공개 메소드

Send Chat Action.
public sendChatAction ( integer $chat_id, string $action ) : Array
$chat_id integer
$action string
리턴 Array
    public function sendChatAction($chat_id, $action)
    {
        $actions = array('typing', 'upload_photo', 'record_video', 'upload_video', 'record_audio', 'upload_audio', 'upload_document', 'find_location');
        if (isset($action) && in_array($action, $actions)) {
            $params = compact('chat_id', 'action');
            return $this->sendRequest('sendChatAction', $params);
        }
        throw new TelegramException('Invalid Action! Accepted value: ' . implode(', ', $actions));
    }

Usage Example

예제 #1
0
 } elseif ($message == "/stop") {
     $k = array_search($chatId, $authDialogs);
     if ($k !== false) {
         unset($authDialogs[$k]);
         $f = fopen($fileOfAuth, "w+");
         foreach ($authDialogs as $i => $item) {
             if (trim($item) != null) {
                 fwrite($f, $item . "\r\n");
             }
         }
         fclose($f);
         //$bot->SendMessage($chatId,"Вы успешно вышли из системы!");
         $tg->sendMessage($chatId, 'Вы вышли из режима наблюдения!');
     }
 } elseif ($message == "/photo") {
     $tg->sendChatAction($chatId, 'upload_photo');
     $tg->sendMessage($chatId, 'Эта функция пока не реализована!');
     /*
     $name=uniqid().".jpg";
     								
     exec("service motion stop");
     exec("fswebcam -r 1024x800 --jpeg 99 -D 1 ".$dir."/photos/".$name);
     exec("service motion start");
     sleep(1);
     
     if(is_file($dir."/photos/".$name)){
     		$tg->sendPhoto($chatId, $dir."/photos/".$name);
     		unlink($dir."/photos/".$name);
     }else{
     		$tg->sendMessage($chatId, 'Проблемы с камерой!...');
     }
All Usage Examples Of telegramBot::sendChatAction