X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FConsole%2FCommands%2FSyncSpeedGaming.php;h=13eb3a30e8b1724857ee4492e692962f21d9796f;hb=9bbd52a3b52020f57124e29c22982c6f2d5b1571;hp=4d2cb9cb27cb9a4a9195f21c93f3851238a6f9c2;hpb=3b4f0e5744d150c273bc450268d5a78ac43b2384;p=alttp.git diff --git a/app/Console/Commands/SyncSpeedGaming.php b/app/Console/Commands/SyncSpeedGaming.php index 4d2cb9c..13eb3a3 100644 --- a/app/Console/Commands/SyncSpeedGaming.php +++ b/app/Console/Commands/SyncSpeedGaming.php @@ -3,6 +3,7 @@ namespace App\Console\Commands; use App\Models\Channel; +use App\Models\DiscordBotCommand; use App\Models\Episode; use App\Models\EpisodePlayer; use App\Models\Event; @@ -179,6 +180,15 @@ class SyncSpeedGaming extends Command { $user = $this->getUserBySGPlayer($sgPlayer); if ($user) { $player->user()->associate($user); + if (empty($user->stream_link)) { + if (!empty($sgPlayer['publicStream'])) { + $user->stream_link = 'https://twitch.tv/'.strtolower($sgPlayer['publicStream']); + $user->save(); + } else if (!empty($sgPlayer['streamingFrom'])) { + $user->stream_link = 'https://twitch.tv/'.strtolower($sgPlayer['streamingFrom']); + $user->save(); + } + } } else { $player->user()->disassociate(); } @@ -195,6 +205,7 @@ class SyncSpeedGaming extends Command { if (!empty($player['discordId'])) { $user = User::find($player['discordId']); if ($user) return $user; + DiscordBotCommand::syncUser($player['discordId']); } if (!empty($player['discordTag'])) { $tag = explode('#', $player['discordTag']);