X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FTwitchBot%2FGuessingSolveCommand.php;h=e825791d374040d3c19b5bc641c403b55da8d818;hb=771f1761f0abec996838c0ccc71cec0219bad71a;hp=57ee5f840424640a7f54e9031a650dfc44700ecb;hpb=7fc357a5943bf280ce2fa9aa97ec516af61efd69;p=alttp.git diff --git a/app/TwitchBot/GuessingSolveCommand.php b/app/TwitchBot/GuessingSolveCommand.php index 57ee5f8..e825791 100644 --- a/app/TwitchBot/GuessingSolveCommand.php +++ b/app/TwitchBot/GuessingSolveCommand.php @@ -6,29 +6,18 @@ class GuessingSolveCommand extends ChatCommand { public function execute($args) { if (!$this->channel->hasActiveGuessing()) { - $this->messageChannel('Channel has no active guessing game'); + $msg = $this->channel->getGuessingSetting('not_active_message'); + $this->messageChannel($msg); return; } - if (empty($args)) { - $this->messageChannel('Please provide a solution to the guessing game'); - return; - } - if (!$this->channel->isValidGuess($args)) { - $this->messageChannel('Please provide a valid solution to the guessing game'); + if (empty($args) || !$this->channel->isValidGuess($args)) { + $msg = $this->channel->getGuessingSetting('invalid_solution_message'); + $this->messageChannel($msg); return; } $winners = $this->channel->solveGuessing($args); - $names = []; - foreach ($winners as $winner) { - if ($winner->score > 0) { - $names[] = $winner->uname; - } - } - if (empty($names)) { - $this->messageChannel('nobody wins :('); - } else { - $this->messageChannel('Congrats '.$this->listAnd($names)); - } + $msg = $this->channel->listGuessingWinners($winners); + $this->messageChannel($msg); $this->channel->clearGuessing(); }