X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FModels%2FTwitchBotCommand.php;h=6dc5a218087a8530103a4f998b9ed42fcc32a91e;hb=f6408dcec11bb63eb1c996d73ebf5629335e25aa;hp=94462e4e5798b6d7967052b2d3054a59b77f722b;hpb=4b0f87a8b0683579c53c68f35b18e5d08c30b3b9;p=alttp.git diff --git a/app/Models/TwitchBotCommand.php b/app/Models/TwitchBotCommand.php index 94462e4..6dc5a21 100644 --- a/app/Models/TwitchBotCommand.php +++ b/app/Models/TwitchBotCommand.php @@ -11,7 +11,20 @@ class TwitchBotCommand extends Model { use HasFactory; - public static function join($channel, User $user = null) { + public static function chat($channel, $text, User $user = null, $nick = 'localhorsttv') { + $cmd = new TwitchBotCommand(); + $cmd->command = 'chat'; + $cmd->parameters = [ + 'channel' => $channel, + 'text' => $text, + ]; + $cmd->status = 'pending'; + $cmd->user()->associate($user); + $cmd->bot_nick = $nick; + $cmd->save(); + } + + public static function join($channel, User $user = null, $nick = 'localhorsttv') { $cmd = new TwitchBotCommand(); $cmd->command = 'join'; $cmd->parameters = [ @@ -19,10 +32,11 @@ class TwitchBotCommand extends Model ]; $cmd->status = 'pending'; $cmd->user()->associate($user); + $cmd->bot_nick = $nick; $cmd->save(); } - public static function part($channel, User $user = null) { + public static function part($channel, User $user = null, $nick = 'localhorsttv') { $cmd = new TwitchBotCommand(); $cmd->command = 'part'; $cmd->parameters = [ @@ -30,6 +44,20 @@ class TwitchBotCommand extends Model ]; $cmd->status = 'pending'; $cmd->user()->associate($user); + $cmd->bot_nick = $nick; + $cmd->save(); + } + + public static function randomChat(Channel $channel, $category, User $user = null, $nick = 'localhorsttv') { + $cmd = new TwitchBotCommand(); + $cmd->command = 'random-chat'; + $cmd->parameters = [ + 'channel' => $channel->id, + 'category' => $category, + ]; + $cmd->status = 'pending'; + $cmd->user()->associate($user); + $cmd->bot_nick = $nick; $cmd->save(); }