Skip to content

Commit

Permalink
Automatically up the credentials
Browse files Browse the repository at this point in the history
Capture the other Tiltify exception as well.
  • Loading branch information
SocksTheWolf committed Aug 18, 2024
1 parent 8e0eb32 commit 59548a1
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions MultiUserRaffleBot/Models/TiltifyService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,20 @@ protected override async Task Tick()
}
}
}
catch (TokenExpiredException)
{
// If the token expires, get a new one.
PrintMessage("Fetching a new token from Tiltify..");
await Login();
continue;
}
catch (Exception ex)
{
PrintMessage($"Loop hit exception: {ex}");
// Tiltify credentials expired.
if (ex is BadScopeException || ex is TokenExpiredException)
{
// If the token expires, get a new one.
PrintMessage("Fetching a new token from Tiltify..");
HasLogin = false;
continue;
}
else
{
PrintMessage($"Loop hit exception: {ex}");
}
}

await timer.WaitForNextTickAsync(default);
Expand Down

0 comments on commit 59548a1

Please sign in to comment.