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');
$this->authorize('editRestream', $channel);
$channel->join = true;
$channel->save();
- TwitchBotCommand::join($channel->twitch_chat);
+ TwitchBotCommand::join($channel->twitch_chat, $request->user());
return $channel->toJson();
}
$this->authorize('editRestream', $channel);
$channel->join = false;
$channel->save();
- TwitchBotCommand::part($channel->twitch_chat);
+ TwitchBotCommand::part($channel->twitch_chat, $request->user());
return $channel->toJson();
}