]> git.localhorst.tv Git - alttp.git/blobdiff - app/Http/Controllers/ChannelController.php
some guessing game fixes
[alttp.git] / app / Http / Controllers / ChannelController.php
index dec17e90e7273f5d98cae2e6c0901c2bed0d7ee6..c47a4066a20a2d80112558498c1f198c9538786b 100644 (file)
@@ -164,18 +164,7 @@ class ChannelController extends Controller {
                        case 'solve':
                                if ($channel->hasActiveGuessing() && $channel->isValidGuess($validatedData['solution'])) {
                                        $winners = $channel->solveGuessing($validatedData['solution']);
-                                       $names = [];
-                                       foreach ($winners as $winner) {
-                                               if ($winner->score > 0) {
-                                                       $names[] = $winner->uname;
-                                               }
-                                       }
-                                       if (empty($names)) {
-                                               $msg = $channel->getGuessingSetting('no_winners_message');
-                                       } else {
-                                               $msg = $channel->getGuessingSetting('winners_message');
-                                               $msg = str_replace('{names}', $channel->listAnd($names), $msg);
-                                       }
+                                       $msg = $channel->listGuessingWinners($winners);
                                        if (!empty($msg)) {
                                                TwitchBotCommand::chat($channel->twitch_chat, $msg);
                                        }
@@ -250,7 +239,9 @@ class ChannelController extends Controller {
                $validatedData = $request->validate([
                        'active_message' => 'string',
                        'cancel_message' => 'string',
+                       'close_winners_message' => 'string',
                        'invalid_solution_message' => 'string',
+                       'leaderboard_type' => 'string',
                        'no_winners_message' => 'string',
                        'not_active_message' => 'string',
                        'points_exact_first' => 'numeric|min:1|max:5',