]> git.localhorst.tv Git - alttp.git/blobdiff - app/Models/TwitchBotCommand.php
adlib chat
[alttp.git] / app / Models / TwitchBotCommand.php
index f2b35e30657d42a1f57fc66eb9bc437df83233ea..e232bdf9a7a1aebdb079fbc7915928469ded9281 100644 (file)
@@ -11,23 +11,65 @@ class TwitchBotCommand extends Model
 {
        use HasFactory;
 
-       public static function join($channel) {
+       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 = [
+                       '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 = [
                        'channel' => $channel,
                ];
                $cmd->status = 'pending';
+               $cmd->user()->associate($user);
+               $cmd->bot_nick = $nick;
                $cmd->save();
        }
 
-       public static function part($channel) {
+       public static function part($channel, User $user = null, $nick = 'localhorsttv') {
                $cmd = new TwitchBotCommand();
                $cmd->command = 'part';
                $cmd->parameters = [
                        'channel' => $channel,
                ];
                $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();
        }