]> git.localhorst.tv Git - alttp.git/blobdiff - app/Http/Controllers/ChannelController.php
chat bot settings
[alttp.git] / app / Http / Controllers / ChannelController.php
index b735a6f70b3e3e6fcc45c0df81dfd9446af970e9..f1f3cdbeb4038da5cc8b12a7dc9b2b6060645ea2 100644 (file)
@@ -56,6 +56,22 @@ class ChannelController extends Controller {
                return $channel->toJson();
        }
 
+       public function chatSettings(Request $request, Channel $channel) {
+               if (!$channel->twitch_chat) {
+                       throw new \Exception('channel has no twitch chat set');
+               }
+               $validatedData = $request->validate([
+                       'wait_msgs_min' => 'integer|min:1',
+                       'wait_msgs_max' => 'integer',
+                       'wait_time_min' => 'integer',
+                       'wait_time_max' => 'integer',
+               ]);
+               $this->authorize('editRestream', $channel);
+               $channel->chat_settings = $validatedData;
+               $channel->save();
+               return $channel->toJson();
+       }
+
        public function join(Request $request, Channel $channel) {
                if (!$channel->twitch_chat) {
                        throw new \Exception('channel has no twitch chat set');