Ejemplo n.º 1
0
 public function main()
 {
     if ($this->Message->Chat->isPrivate()) {
         $this->chat = NULL;
     } else {
         $this->chat = $this->Message->Chat;
     }
     if ($this->noParams() == 2) {
         if (strcmp($this->getParam(), '_view_chat') === 0) {
             $DbChat = new \GroupBot\Database\Chat($this->db);
             if ($this->chat = $DbChat->getChatById($this->getParam(1))) {
                 $out = $this->displayLeaderboard();
                 $out .= $this->displayInstructions();
             } else {
                 $out = emoji(0x1f44e) . " Can't find that chat, displaying the Global Leaderboard instead.\n\n";
                 $this->chat = NULL;
                 $out .= $this->displayLeaderboard();
                 $out .= $this->displayInstructions();
             }
         } else {
             $out = $this->performVote();
             //$out .= $this->displayLeaderboard();
             $out .= $this->displayInstructions();
         }
     } else {
         $out = $this->displayLeaderboard();
         $out .= $this->displayInstructions();
     }
     if ($this->Message->Chat->isPrivate()) {
         if ($this->Message->isCallback()) {
             Telegram::edit_inline_message($this->Message->Chat->id, $this->Message->message_id, $out, $this->keyboard);
         } else {
             Telegram::talk_inline_keyboard($this->Message->Chat->id, $out, $this->keyboard);
         }
     } else {
         Telegram::talk($this->Message->Chat->id, $out);
     }
     return true;
 }
Ejemplo n.º 2
0
 public function save(\PDO $db)
 {
     $userSQL = new \GroupBot\Database\Chat($db);
     return $userSQL->updateChat($this);
 }