X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FHttp%2FControllers%2FChannelController.php;fp=app%2FHttp%2FControllers%2FChannelController.php;h=da1f5ef76590166b5e9cf1827ce93cf2c8240421;hb=51a752c7cce2465043dfb3d63a0152b64765b167;hp=f6840f87f837f27e94dc36d4dad096d8d4a4ba17;hpb=4b0f87a8b0683579c53c68f35b18e5d08c30b3b9;p=alttp.git diff --git a/app/Http/Controllers/ChannelController.php b/app/Http/Controllers/ChannelController.php index f6840f8..da1f5ef 100644 --- a/app/Http/Controllers/ChannelController.php +++ b/app/Http/Controllers/ChannelController.php @@ -42,6 +42,18 @@ class ChannelController extends Controller { return $channel->toJson(); } + public function chat(Request $request, Channel $channel) { + if (!$channel->twitch_chat) { + throw new \Exception('channel has no twitch chat set'); + } + $validatedData = $request->validate([ + 'text' => 'string|required', + ]); + $this->authorize('editRestream', $channel); + TwitchBotCommand::chat($channel->twitch_chat, $validatedData['text'], $request->user()); + return $channel->toJson(); + } + public function join(Request $request, Channel $channel) { if (!$channel->twitch_chat) { throw new \Exception('channel has no twitch chat set');