X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FHttp%2FControllers%2FChannelController.php;h=15213b412f675481ca86d854a4ecbf1579f0dfc6;hb=948653e5ae0412fbbee7945175470e328910245f;hp=b72742f2d835d664ed7c55e30d8b3cf6e1aa6e14;hpb=cf210ddda8ff5336feee10f733b022a72d906238;p=alttp.git diff --git a/app/Http/Controllers/ChannelController.php b/app/Http/Controllers/ChannelController.php index b72742f..15213b4 100644 --- a/app/Http/Controllers/ChannelController.php +++ b/app/Http/Controllers/ChannelController.php @@ -55,14 +55,29 @@ 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); } + public function chatBotLog(Request $request, Channel $channel) { + $this->authorize('editRestream', $channel); + $log = $channel->chat_bot_logs() + ->with('origin') + ->orderBy('created_at', 'DESC') + ->limit(150) + ->get(); + return $log->values()->toJson(); + } + public function chatSettings(Request $request, Channel $channel) { if (!$channel->twitch_chat) { throw new \Exception('channel has no twitch chat set');