]> git.localhorst.tv Git - alttp.git/blobdiff - app/Models/TwitchBotCommand.php
add twitch chat comand
[alttp.git] / app / Models / TwitchBotCommand.php
index 94462e4e5798b6d7967052b2d3054a59b77f722b..14cabf7a9513d0f812d317710b457652d397ac77 100644 (file)
@@ -11,6 +11,18 @@ class TwitchBotCommand extends Model
 {
        use HasFactory;
 
+       public static function chat($channel, $text, User $user = null) {
+               $cmd = new TwitchBotCommand();
+               $cmd->command = 'chat';
+               $cmd->parameters = [
+                       'channel' => $channel,
+                       'text' => $text,
+               ];
+               $cmd->status = 'pending';
+               $cmd->user()->associate($user);
+               $cmd->save();
+       }
+
        public static function join($channel, User $user = null) {
                $cmd = new TwitchBotCommand();
                $cmd->command = 'join';