]> git.localhorst.tv Git - alttp.git/blobdiff - app/TwitchBot/GuessingSolveCommand.php
guessing game settings
[alttp.git] / app / TwitchBot / GuessingSolveCommand.php
index 57ee5f840424640a7f54e9031a650dfc44700ecb..b4a877d5b45d8b9378bb0cab431830872d46f6ec 100644 (file)
@@ -6,15 +6,13 @@ 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);
@@ -25,9 +23,12 @@ class GuessingSolveCommand extends ChatCommand {
                        }
                }
                if (empty($names)) {
-                       $this->messageChannel('nobody wins :(');
+                       $msg = $this->channel->getGuessingSetting('no_winners_message');
+                       $this->messageChannel($msg);
                } else {
-                       $this->messageChannel('Congrats '.$this->listAnd($names));
+                       $msg = $this->channel->getGuessingSetting('winners_message');
+                       $msg = str_replace('{names}', $this->listAnd($names), $msg);
+                       $this->messageChannel($msg);
                }
                $this->channel->clearGuessing();
        }