示例#1
0
 private function getChat()
 {
     if ($this->Message->Chat->isPrivate()) {
         $DbChat = new Chat($this->db);
         if ($this->isParam() && ($this->chat = $DbChat->getChatById($this->getParam()))) {
             return true;
         }
         $this->chat = NULL;
         $this->global = true;
     } else {
         $this->chat = $this->Message->Chat;
     }
     return true;
 }
示例#2
0
 public function main()
 {
     if (!$this->Message->Chat->isPrivate()) {
         $this->group_status();
         Telegram::talk($this->Message->Chat->id, $this->out);
         return true;
     }
     $this->out = '';
     if ($this->isParam()) {
         switch ($this->getParam()) {
             case 'name':
                 $this->change_name();
                 break;
             case 'chat':
                 if ($this->noParams() == 2) {
                     $DbChat = new \GroupBot\Database\Chat($this->db);
                     if ($this->chat = $DbChat->getChatById($this->getParam(1))) {
                         $this->chat_options(false);
                         break;
                     }
                 }
                 $this->all_options();
                 break;
             case 'chatset':
                 if ($this->noParams() == 4) {
                     $DbChat = new \GroupBot\Database\Chat($this->db);
                     if ($this->chat = $DbChat->getChatById($this->getParam(1))) {
                         if ($this->set_option($this->getParam(2), $this->getParam(3))) {
                             $this->chat_options(true);
                         } else {
                             $this->chat_options(false);
                         }
                         break;
                     }
                 }
                 $this->all_options();
                 break;
             case 'yandex':
                 break;
             default:
                 $this->all_options();
         }
     } else {
         $this->all_options();
     }
     if ($this->Message->isCallback()) {
         Telegram::edit_inline_message($this->Message->Chat->id, $this->Message->message_id, $this->out, $this->keyboard);
     } else {
         Telegram::talk_inline_keyboard($this->Message->Chat->id, $this->out, $this->keyboard);
     }
     return true;
 }