]> git.localhorst.tv Git - alttp.git/blobdiff - app/Http/Controllers/ChannelController.php
adlib chat
[alttp.git] / app / Http / Controllers / ChannelController.php
index 026b9aa8ce9fe18c7d0978be820fc1e911c12018..121ae4e9ce9149fc2162001128dc2943d4a9a004 100644 (file)
@@ -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);
@@ -83,6 +86,7 @@ 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',