3 namespace App\TwitchBot;
5 class GuessingSolveCommand extends ChatCommand {
7 public function execute($args) {
8 if (!$this->channel->hasActiveGuessing()) {
9 $this->messageChannel('Channel has no active guessing game');
13 $this->messageChannel('Please provide a solution to the guessing game');
16 if (!$this->channel->isValidGuess($args)) {
17 $this->messageChannel('Please provide a valid solution to the guessing game');
20 $winners = $this->channel->solveGuessing($args);
22 foreach ($winners as $winner) {
23 if ($winner->score > 0) {
24 $names[] = $winner->uname;
28 $this->messageChannel('nobody wins :(');
30 $this->messageChannel('Congrats '.$this->listAnd($names));
32 $this->channel->clearGuessing();