X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;ds=sidebyside;f=app%2FHttp%2FControllers%2FChannelController.php;h=121ae4e9ce9149fc2162001128dc2943d4a9a004;hb=f0d1a566f5afd76ab7a56b295b71d5756dfd2bc3;hp=15213b412f675481ca86d854a4ecbf1579f0dfc6;hpb=147c5f43c5d41fa18e82edb6651fe5a37c789353;p=alttp.git diff --git a/app/Http/Controllers/ChannelController.php b/app/Http/Controllers/ChannelController.php index 15213b4..121ae4e 100644 --- a/app/Http/Controllers/ChannelController.php +++ b/app/Http/Controllers/ChannelController.php @@ -54,13 +54,16 @@ class ChannelController extends Controller { throw new \Exception('channel has no twitch chat set'); } $validatedData = $request->validate([ + 'adlib' => 'boolean', 'bot_nick' => 'string', 'category' => 'string', 'text' => 'string', ]); $this->authorize('editRestream', $channel); $nick = empty($validatedData['bot_nick']) ? 'localhorsttv' : $validatedData['bot_nick']; - if (empty($validatedData['category'])) { + if (isset($validatedData['adlib']) && $validatedData['adlib']) { + TwitchBotCommand::adlibChat($channel, $request->user()); + } else if (empty($validatedData['category'])) { TwitchBotCommand::chat($channel->twitch_chat, $validatedData['text'], $request->user(), $nick); } else { TwitchBotCommand::randomChat($channel, $validatedData['category'], $request->user(), $nick); @@ -71,7 +74,7 @@ class ChannelController extends Controller { public function chatBotLog(Request $request, Channel $channel) { $this->authorize('editRestream', $channel); $log = $channel->chat_bot_logs() - ->with('origin') + ->with(['origin', 'user']) ->orderBy('created_at', 'DESC') ->limit(150) ->get(); @@ -83,10 +86,13 @@ class ChannelController extends Controller { throw new \Exception('channel has no twitch chat set'); } $validatedData = $request->validate([ + 'adlib' => 'integer|min:0|max:100', 'language' => 'string|in:de,en,es,fr', + 'min_age' => 'integer|min:1', 'respond' => 'string|in:50,no,yes', + 'source' => 'string|in:any,cat,catchan,chan', 'wait_msgs_min' => 'integer|min:1', - 'wait_msgs_max' => 'integer', + 'wait_msgs_max' => 'integer|min:1', 'wait_time_min' => 'integer', 'wait_time_max' => 'integer', ]);