X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FHttp%2FControllers%2FChannelController.php;h=883ca65eff2360d93bcd20d9fb2d2bf93640caad;hb=ebdf8e5f6761de2abd85b01096a67dee62d7d4aa;hp=dec17e90e7273f5d98cae2e6c0901c2bed0d7ee6;hpb=b537f5570f85af14f7b7d64b34aa1a7946efee23;p=alttp.git diff --git a/app/Http/Controllers/ChannelController.php b/app/Http/Controllers/ChannelController.php index dec17e9..883ca65 100644 --- a/app/Http/Controllers/ChannelController.php +++ b/app/Http/Controllers/ChannelController.php @@ -55,11 +55,16 @@ class ChannelController extends Controller { } $validatedData = $request->validate([ 'bot_nick' => 'string', - 'text' => 'string|required', + 'category' => 'string', + 'text' => 'string', ]); $this->authorize('editRestream', $channel); $nick = empty($validatedData['bot_nick']) ? 'localhorsttv' : $validatedData['bot_nick']; - TwitchBotCommand::chat($channel->twitch_chat, $validatedData['text'], $request->user(), $nick); + if (empty($validatedData['category'])) { + TwitchBotCommand::chat($channel->twitch_chat, $validatedData['text'], $request->user(), $nick); + } else { + TwitchBotCommand::randomChat($channel, $validatedData['category'], $request->user(), $nick); + } return $this->sendChannel($channel); } @@ -68,6 +73,8 @@ class ChannelController extends Controller { throw new \Exception('channel has no twitch chat set'); } $validatedData = $request->validate([ + 'language' => 'string|in:de,en,es,fr', + 'respond' => 'string|in:50,no,yes', 'wait_msgs_min' => 'integer|min:1', 'wait_msgs_max' => 'integer', 'wait_time_min' => 'integer', @@ -164,18 +171,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 +246,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',