]> git.localhorst.tv Git - alttp.git/blob - app/TwitchBot/GuessingSolveCommand.php
some guessing game fixes
[alttp.git] / app / TwitchBot / GuessingSolveCommand.php
1 <?php
2
3 namespace App\TwitchBot;
4
5 class GuessingSolveCommand extends ChatCommand {
6
7         public function execute($args) {
8                 if (!$this->channel->hasActiveGuessing()) {
9                         $msg = $this->channel->getGuessingSetting('not_active_message');
10                         $this->messageChannel($msg);
11                         return;
12                 }
13                 if (empty($args) || !$this->channel->isValidGuess($args)) {
14                         $msg = $this->channel->getGuessingSetting('invalid_solution_message');
15                         $this->messageChannel($msg);
16                         return;
17                 }
18                 $winners = $this->channel->solveGuessing($args);
19                 $msg = $this->channel->listGuessingWinners($winners);
20                 $this->messageChannel($msg);
21                 $this->channel->clearGuessing();
22         }
23
24 }
25
26 ?>