예제 #1
1
 public function main()
 {
     $Vote = new Vote($this->db);
     $leaderboard = $Vote->getVoteLeaderboard($this->Message->Chat->id);
     $out = '';
     $index = 0;
     if (!empty($leaderboard)) {
         foreach ($leaderboard as $uservote) {
             $index++;
             $out .= "`" . $this->addOrdinalNumberSuffix($index);
             if ($index >= 10) {
                 $out .= " `";
             } else {
                 $out .= "  `";
             }
             $vote_prefix = $uservote->vote_total > 0 ? "+" : "";
             if (!isset($uservote->vote_total)) {
                 $uservote->vote_total = 0;
             }
             $out .= "*" . $uservote->user->getName() . "* (" . $vote_prefix . $uservote->vote_total . ")\n";
         }
     } else {
         $out .= "No users to display.";
     }
     Telegram::talk($this->Message->Chat->id, $out);
 }
예제 #2
1
 private function main_menu()
 {
     $DbUser = new User($this->db);
     $group_chats = $DbUser->getActiveChatsByUser($this->Message->User);
     $Vote = new Vote($this->db);
     $popularity = $Vote->getVoteTotalForUser($this->Message->User);
     $ranking = Query::getGlobalRanking($this->db, $this->Message->User);
     $this->out = emoji(0x1f44b) . " Hi *" . $this->Message->User->getName() . "*!" . "\nI'm *" . BOT_FRIENDLY_NAME . "*, your _Premier Shitposting Solution_ " . emoji(0x2122) . "." . "\n\n" . emoji(0x1f481) . emoji(0x1f3fb) . "You're a " . $this->Message->User->getLevelAndTitle() . " with `" . $this->Message->User->getBalance() . "` Coin." . "\nOverall, your popularity is at *{$popularity}* points, and you're ranked *" . addOrdinalNumberSuffix($ranking) . "* on the global leaderboard.";
     $this->out .= "\n\n*This menu system is currently under development and may be incomplete/broken. You've been warned!*";
     if ($group_chats) {
         $this->out .= "\n\nI see you in the following group chats:";
         foreach ($group_chats as $chat) {
             $this->out .= "\n`   `• `" . $chat->title . "`";
         }
     }
     $this->out .= "\n\nWhat would you like?";
     $this->keyboard = [[['text' => emoji(0x2754) . ' Help', 'callback_data' => '/help help'], ['text' => emoji(0x1f4bc) . ' Business', 'callback_data' => '/help business']], [['text' => emoji(0x1f3ae) . ' Play a game', 'callback_data' => '/help games'], ['text' => emoji(0x2699) . ' Change preferences', 'callback_data' => '/preferences']]];
 }
예제 #3
1
 public function main()
 {
     $Vote = new Vote($this->db);
     $user_vote_total = $Vote->getVoteTotalForUserInChat($this->Message->User, $this->Message->Chat->id);
     $user_vote_from = $Vote->getUserVotesInChat($this->Message->User, $this->Message->Chat->id);
     $out = "You're on *{$user_vote_total}*. ";
     if (count($user_vote_from) > 0) {
         $out .= "You've voted as follows:";
         $thumbs_up = emoji(0x1f44d);
         $thumbs_down = emoji(0x1f44e) . emoji(0x1f3ff);
         foreach ($user_vote_from as $userVote) {
             $emoji = $userVote->vote == VoteType::Up ? $thumbs_up : $thumbs_down;
             $out .= "\n`   `• " . $emoji . " *" . ($userVote->voted_for ? $userVote->voted_for->getName() : 'uhoh') . "* ";
         }
     } else {
         $out .= "You haven't cast any votes.";
     }
     $out .= "\nYou can see the voting leaderboard with /vote";
     Telegram::talk($this->Message->Chat->id, $out);
 }