Пример #1
0
 public function run()
 {
     if (!$this->user()->stop) {
         throw new \Exception('Nessuna fermata impostata!');
     }
     $stop = new Stop($this->user()->stop);
     $this->replyWithMessage('Linee fermata ' . $stop->getName());
     $this->replyWithMessage($stop->getRoutesDisplay());
 }
Пример #2
0
 /**
  * @inheritdoc
  */
 public function run($arguments)
 {
     list($stopId) = explode(' ', $arguments);
     $stop = new Stop($stopId);
     list($lat, $lng) = $stop->getLatLng();
     $this->user()->stop = $stopId;
     $this->replyWithMessage('Fermata ' . $stop->getName() . ' impostata.');
     $this->replyWithMessage('Linee per questa fermata:');
     $this->replyWithMessage($stop->getRoutesDisplay());
     $this->replyWithLocation($lat, $lng);
     $this->replyWithMessage($this->user()->getHint());
 }
Пример #3
0
 /**
  * handle location message
  */
 private function handleLocation($update)
 {
     $location = $update->getMessage()->getLocation();
     $lat = $location->getLatitude();
     $lng = $location->getLongitude();
     $stops = Stop::getNearest($lat, $lng);
     $chatId = $update->getMessage()->getChat()->getId();
     $this->telegramClient->sendMessage($chatId, 'Fermate nelle vicinanze:', false, null, $this->telegramClient->replyKeyboardMarkup($stops, true, true));
 }