Advertisement
MyZik

Untitled

Jul 2nd, 2018
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.63 KB | None | 0 0
  1.     /**
  2.      * @param CallbackQuery $query
  3.      * @param Telegram $telegram
  4.      * @param Update $update
  5.      * @return \Longman\TelegramBot\Entities\ServerResponse
  6.      * @throws \Longman\TelegramBot\Exception\TelegramException
  7.      */
  8.     public function newOrder(CallbackQuery $query, Telegram $telegram, Update $update) {
  9.         $callback_data = $query->getData();
  10.  
  11.         if (strpos($callback_data, 'newOrder_') !== 0) {
  12.             return Request::emptyResponse();
  13.         }
  14.  
  15.         $current = substr($callback_data, strlen('newOrder_')); // ID of service
  16.  
  17.         $update['message']['text'] = $current;
  18.         $result = (new NeworderCommand($telegram, $update))->preExecute();
  19.  
  20.         return $result;
  21.     }
  22.  
  23.  
  24.  
  25. /**
  26.  * SURVEY COMMAND
  27.  */
  28. /**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**/
  29.     switch ($state) {
  30.             case 0:
  31.                 if ($text === '' || ($this->getCallbackQuery() !== null && $text !== '') || !is_numeric($text) || self::searchOrder($text) == false) {
  32.                     $notes['state'] = 0;
  33.                     $this->conversation->update();
  34.  
  35.                     $data['text'] = 'Write  service ID';
  36.  
  37.                     if ($text !== '')
  38.                         $data['text'] = 'Please, write service ID';
  39.  
  40.                     $result = Request::sendMessage($data);
  41.                     break;
  42.                 }
  43.  
  44.                 $notes['service_id'] = $text;
  45.                 $service = self::searchService($notes['order_id']);
  46.                 $text = '';
  47.  
  48.             case 1:
  49.                 ...
  50.             case 2:
  51.                 ...
  52.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement