Esempio n. 1
0
 /**
  * save comment of this user into comments table
  * @param  [type] $_feedback [description]
  * @return [type]            [description]
  */
 private static function saveComment($_feedback)
 {
     $meta = ['url' => 'telegram'];
     if (bot::$user_id) {
         $meta['user'] = bot::$user_id;
     }
     $result = \lib\db\comments::save($_feedback, $meta);
     // send feedback to javad account after saving in comments table
     $text = "📨 بازخورد جدید از ";
     $text .= bot::response('from', 'first_name');
     $text .= ' ' . bot::response('from', 'last_name');
     $text .= "\n{$_feedback}\n";
     $text .= "\nکد کاربر " . bot::response('from');
     $text .= ' @' . bot::response('from', 'username');
     $msg = ['method' => 'sendMessage', 'text' => $text, 'chat_id' => '46898544'];
     $result = bot::sendResponse($msg);
     return $result;
 }
Esempio n. 2
0
 /**
  * finisht register process
  * @param  [type] $_status [description]
  * @return [type]          [description]
  */
 private static function finish($_status)
 {
     $result = ['text' => "", 'reply_markup' => menu::main(true)];
     switch ($_status) {
         case 'limit':
             $txt = T_('Dear friend') . "\n";
             $txt .= T_('We need your phone number to verifying your account.') . "\n";
             $txt .= T_('If you dont want share your number, we cant presenting our services to you!') . "\n";
             $result['text'] = $txt;
             step::stop();
             break;
         case 'successful':
             $txt = T_('Registering user is successful.') . "\n";
             $result['text'] = $txt;
             $result['reply_markup'] = null;
             bot::sendResponse($result);
         case 'registered':
             // check if want to come back to specefic step, do it
             $result = self::successful();
             break;
         case 'failed':
             $result = false;
         case 'return':
             $txt = T_('Cancel registration and return to main menu') . "\n";
             $result['text'] = $txt;
             step::stop();
             break;
         case 'wrong':
         default:
             // else send messge to attention to user to only send contact detail
             $txt = T_('Please only use below keyboard.');
             $txt = T_('We need your contact!') . "\n";
             $menu = menu_profile::getContact(true);
             $result['text'] = $txt;
             $result['reply_markup'] = $menu;
             break;
     }
     // return menu
     return $result;
 }