]> git.localhorst.tv Git - alttp.git/blobdiff - app/TwitchBot/GuessingSolveCommand.php
some guessing game fixes
[alttp.git] / app / TwitchBot / GuessingSolveCommand.php
index b4a877d5b45d8b9378bb0cab431830872d46f6ec..e825791d374040d3c19b5bc641c403b55da8d818 100644 (file)
@@ -16,20 +16,8 @@ class GuessingSolveCommand extends ChatCommand {
                        return;
                }
                $winners = $this->channel->solveGuessing($args);
-               $names = [];
-               foreach ($winners as $winner) {
-                       if ($winner->score > 0) {
-                               $names[] = $winner->uname;
-                       }
-               }
-               if (empty($names)) {
-                       $msg = $this->channel->getGuessingSetting('no_winners_message');
-                       $this->messageChannel($msg);
-               } else {
-                       $msg = $this->channel->getGuessingSetting('winners_message');
-                       $msg = str_replace('{names}', $this->listAnd($names), $msg);
-                       $this->messageChannel($msg);
-               }
+               $msg = $this->channel->listGuessingWinners($winners);
+               $this->messageChannel($msg);
                $this->channel->clearGuessing();
        }