Exemplo n.º 1
0
 private function revoke($message)
 {
     $telegramId = $message['from']['id'];
     $tg = TelegramUser::findByTelegramId($telegramId);
     if ($tg->status != '/revoke') {
         $tg->status = '/revoke';
         $tg->save();
         $apps = App::findByTelegramUser($tg);
         $keyboard = array();
         foreach ($apps as $a) {
             $keyboard[] = array('[' . $a->client_id . '] - ' . $a->name);
         }
         $markup = array('keyboard' => $keyboard, 'resize_keyboard' => true, 'one_time_keyboard' => true);
         $text = 'Select an app to revoke access or type /cancel to cancel this operation:' . PHP_EOL;
         $params = array('text' => $text, 'chat_id' => $telegramId, 'reply_markup' => json_encode($markup));
         $this->send($params);
         $tg->status = 'revoke_access';
         $tg->save();
     }
 }