diff --git a/app/Console/Commands/CheckTwitchLiveStatus.php b/app/Console/Commands/CheckTwitchLiveStatus.php index df408ea..4a17c5a 100644 --- a/app/Console/Commands/CheckTwitchLiveStatus.php +++ b/app/Console/Commands/CheckTwitchLiveStatus.php @@ -6,7 +6,6 @@ use App\Livewire\Actions\Api\Twitch\RefreshToken; use App\Models\User; use Illuminate\Console\Command; -use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Log; @@ -18,7 +17,11 @@ class CheckTwitchLiveStatus extends Command public function handle(): int { - $token = User::first()->connections->firstWhere('type_id', ConnectionType::TWITCH->value)->token ?? null; + $user = User::first(); + + (new RefreshToken)->handle($user); + + $token = $user->connections->firstWhere('type_id', ConnectionType::TWITCH->value)->token ?? null; if (! $token) { return self::FAILURE; diff --git a/routes/console.php b/routes/console.php index 006572f..c061d2d 100644 --- a/routes/console.php +++ b/routes/console.php @@ -1,7 +1,6 @@ daily(); -Schedule::command(RefreshTwitchAccessToken::class)->monthly(); - -Schedule::command(CheckTwitchLiveStatus::class)->everyMinute(); +Schedule::command(CheckTwitchLiveStatus::class)->everyFiveMinutes();