X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FHttp%2FControllers%2FChannelController.php;h=c47a4066a20a2d80112558498c1f198c9538786b;hb=7649d12f400f164dd06f6a45486221234052dbb6;hp=f7d57c037137cb330d1fec49036952e3e701e664;hpb=4caeac216c5e5a044d81b63a8aa5b66451162271;p=alttp.git diff --git a/app/Http/Controllers/ChannelController.php b/app/Http/Controllers/ChannelController.php index f7d57c0..c47a406 100644 --- a/app/Http/Controllers/ChannelController.php +++ b/app/Http/Controllers/ChannelController.php @@ -13,12 +13,17 @@ class ChannelController extends Controller { public function search(Request $request) { $validatedData = $request->validate([ + 'id' => 'array', + 'id.*' => 'integer|numeric', 'joinable' => 'boolean|nullable', 'manageable' => 'boolean|nullable', 'phrase' => 'string|nullable', ]); $channels = Channel::query(); + if (!empty($validatedData['id'])) { + $channels = $channels->whereIn('id', $validatedData['id']); + } if (isset($validatedData['joinable']) && $validatedData['joinable']) { $channels = $channels->where('twitch_chat', '!=', ''); } @@ -159,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); } @@ -245,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',