Beispiel #1
0
 public static function getResponse(\PDO $db, Message $message, PlayerMove $move, $bet = NULL)
 {
     $Blackjack = new Blackjack($db, $message->User, $message->Chat, $move, $bet);
     if ($Blackjack->Talk->areMessages()) {
         $keyboard = $Blackjack->Talk->getKeyboard();
         if ($message->isCallback()) {
             \GroupBot\Telegram::edit_inline_message($message->Chat->id, $message->message_id, $Blackjack->Talk->getMessages(), $keyboard);
         } else {
             \GroupBot\Telegram::talk_inline_keyboard($message->Chat->id, $Blackjack->Talk->getMessages(), $keyboard);
         }
         return true;
     }
     return false;
 }
Beispiel #2
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;
 }
Beispiel #3
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);
     }
 }