X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FModels%2FTwitchBotCommand.php;h=e232bdf9a7a1aebdb079fbc7915928469ded9281;hb=f0d1a566f5afd76ab7a56b295b71d5756dfd2bc3;hp=14cabf7a9513d0f812d317710b457652d397ac77;hpb=51a752c7cce2465043dfb3d63a0152b64765b167;p=alttp.git diff --git a/app/Models/TwitchBotCommand.php b/app/Models/TwitchBotCommand.php index 14cabf7..e232bdf 100644 --- a/app/Models/TwitchBotCommand.php +++ b/app/Models/TwitchBotCommand.php @@ -11,7 +11,19 @@ class TwitchBotCommand extends Model { use HasFactory; - public static function chat($channel, $text, User $user = null) { + public static function adlibChat(Channel $channel, User $user = null) { + $cmd = new TwitchBotCommand(); + $cmd->command = 'adlib-chat'; + $cmd->parameters = [ + 'channel' => $channel->id, + ]; + $cmd->status = 'pending'; + $cmd->user()->associate($user); + $cmd->bot_nick = 'horstiebot'; + $cmd->save(); + } + + public static function chat($channel, $text, User $user = null, $nick = 'localhorsttv') { $cmd = new TwitchBotCommand(); $cmd->command = 'chat'; $cmd->parameters = [ @@ -20,10 +32,11 @@ class TwitchBotCommand extends Model ]; $cmd->status = 'pending'; $cmd->user()->associate($user); + $cmd->bot_nick = $nick; $cmd->save(); } - public static function join($channel, User $user = null) { + public static function join($channel, User $user = null, $nick = 'localhorsttv') { $cmd = new TwitchBotCommand(); $cmd->command = 'join'; $cmd->parameters = [ @@ -31,10 +44,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 = [ @@ -42,6 +56,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(); }