X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FConsole%2FCommands%2FTwitchChannelInfo.php;h=7b373c8c94ed54fe611280078158799e35002775;hb=771f1761f0abec996838c0ccc71cec0219bad71a;hp=6a3261ca8a9eb1b72bb6e4a3dbd7d9768b88541e;hpb=07a88747f8a252b41b739185fcb68bdee3a60f9a;p=alttp.git diff --git a/app/Console/Commands/TwitchChannelInfo.php b/app/Console/Commands/TwitchChannelInfo.php index 6a3261c..7b373c8 100644 --- a/app/Console/Commands/TwitchChannelInfo.php +++ b/app/Console/Commands/TwitchChannelInfo.php @@ -37,6 +37,10 @@ class TwitchChannelInfo extends Command { $this->line('please acquire a token for localhorsttv first'); return 1; } + if ($this->token->hasExpired()) { + $this->line('access token has expired, refreshing'); + $this->token->refresh(); + } $channels = Channel::where('twitch_chat', '!=', '')->where('twitch_id', '=', '')->get(); foreach ($channels as $channel) { try { @@ -52,7 +56,8 @@ class TwitchChannelInfo extends Command { ->where(function($query) { $query->where('join', true); $query->orWhere('chat', true); - })->chunk(100, function ($channels) { + }) + ->chunk(100, function ($channels) { $this->updateChannelInfos($channels); }); return Command::SUCCESS;