]> git.localhorst.tv Git - alttp.git/blobdiff - app/Models/TwitchBotCommand.php
adlib chat
[alttp.git] / app / Models / TwitchBotCommand.php
index 14cabf7a9513d0f812d317710b457652d397ac77..e232bdf9a7a1aebdb079fbc7915928469ded9281 100644 (file)
@@ -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();
        }