Пример #1
0
 public function processMessage()
 {
     if ($this->greetUser()) {
         return true;
     }
     if (!$this->Message->Chat->no_spam_mode && $this->dictMatch($this->dict->interjections, $this->dict->interjections_exclusions)) {
         return true;
     }
     if ($this->dictMatch($this->dict->interjection_commands, $this->dict->interjections_exclusions, true)) {
         return true;
     }
     if (!$this->Message->isNormalMessage()) {
         $this->processChannelChange();
     }
     if ($this->sed()) {
         return true;
     }
     if ($this->isBotMentioned()) {
         if ($this->dictCommand($this->dict->reply_commands)) {
             return true;
         }
         if ($this->dictUsers($this->dict->user_replies)) {
             return true;
         }
         if ($this->dictMatch($this->dict->replies)) {
             return true;
         }
         if (count(mb_split(" ", $this->Message->text)) < 6) {
             Telegram::reply($this->Message->Chat->id, $this->Message->message_id, $this->dict->default_reply);
             return true;
         }
     }
     $this->translate();
     return true;
 }
Пример #2
0
 private function processStats()
 {
     $userSQL = new User($this->db);
     if ($this->Message->isNormalMessage()) {
         $userSQL->updateUserMessageStats($this->Message);
     } elseif ($this->Message->MessageType == MessageType::NewChatParticipant) {
         $userSQL->updateWhetherUserIsInChat($this->Message->Chat, $this->Message->User, true);
     } elseif ($this->Message->MessageType == MessageType::LeftChatParticipant) {
         $userSQL->updateWhetherUserIsInChat($this->Message->Chat, $this->Message->User, false);
     } elseif ($this->Message->isCommand()) {
         $userSQL->updateUserCommandStats($this->Message);
     }
 }