コード例 #1
0
 public function run($name)
 {
     $name = trim(strtolower($name));
     if (!$name) {
         throw new \Exception('Devi specificare il nome del preferito da eliminare. Es. "/elimina casa"');
     }
     $fav = new Favourite($this->user(), $name);
     $fav->delete();
     $this->replyWithMessage('Preferito ' . $name . ' eliminato.');
 }
コード例 #2
0
 public function run($name)
 {
     $name = trim(strtolower($name));
     if (!$name) {
         throw new \Exception('Devi specificare il nome del preferito da caricare. Es. "/carica casa"');
     }
     $fav = new Favourite($this->user(), $name);
     $fav->loadInSession();
     $this->replyWithMessage('Preferito ' . $name . ' (' . $fav->getDesc() . ') impostato correttamente.');
     $this->replyWithMessage($this->user()->getHint());
 }
コード例 #3
0
 public function run($name)
 {
     $name = trim(strtolower($name));
     if (!$name) {
         throw new \Exception('Devi specificare un nome per il preferito. Es. "/salva casa"');
     }
     if (!$this->user()->hasSession()) {
         throw new \Exception($this->user()->getHint());
     }
     $fav = new Favourite($this->user(), $name);
     $fav->save();
     $this->replyWithMessage('Preferito ' . $name . ' salvato correttamente');
 }