Version update check is optional. Removed reliance on web API. Fixed client reconnection due to redemptions.
This commit is contained in:
56
TTS.cs
56
TTS.cs
@@ -86,48 +86,29 @@ namespace TwitchChatTTS
|
||||
return;
|
||||
}
|
||||
|
||||
var hermesVersion = await _hermesApiClient.GetLatestTTSVersion();
|
||||
if (hermesVersion == null)
|
||||
try
|
||||
{
|
||||
_logger.Error("Failed to fetch latest TTS version. Something went wrong.");
|
||||
return;
|
||||
var hermesVersion = await _hermesApiClient.GetLatestTTSVersion();
|
||||
if (hermesVersion == null)
|
||||
{
|
||||
_logger.Error("Failed to fetch latest TTS version. Something went wrong.");
|
||||
return;
|
||||
}
|
||||
if (hermesVersion.MajorVersion > TTS.MAJOR_VERSION || hermesVersion.MajorVersion == TTS.MAJOR_VERSION && hermesVersion.MinorVersion > TTS.MINOR_VERSION)
|
||||
{
|
||||
_logger.Information($"A new update for TTS is avaiable! Version {hermesVersion.MajorVersion}.{hermesVersion.MinorVersion} is available at {hermesVersion.Download}");
|
||||
var changes = hermesVersion.Changelog.Split("\n");
|
||||
if (changes != null && changes.Any())
|
||||
_logger.Information("Changelog:\n - " + string.Join("\n - ", changes) + "\n\n");
|
||||
await Task.Delay(15 * 1000);
|
||||
}
|
||||
}
|
||||
if (hermesVersion.MajorVersion > TTS.MAJOR_VERSION || hermesVersion.MajorVersion == TTS.MAJOR_VERSION && hermesVersion.MinorVersion > TTS.MINOR_VERSION)
|
||||
catch
|
||||
{
|
||||
_logger.Information($"A new update for TTS is avaiable! Version {hermesVersion.MajorVersion}.{hermesVersion.MinorVersion} is available at {hermesVersion.Download}");
|
||||
var changes = hermesVersion.Changelog.Split("\n");
|
||||
if (changes != null && changes.Any())
|
||||
_logger.Information("Changelog:\n - " + string.Join("\n - ", changes) + "\n\n");
|
||||
await Task.Delay(15 * 1000);
|
||||
_logger.Warning("Failed to check for version updates.");
|
||||
}
|
||||
|
||||
await InitializeHermesWebsocket();
|
||||
try
|
||||
{
|
||||
var hermesAccount = await _hermesApiClient.FetchHermesAccountDetails();
|
||||
_user.HermesUserId = hermesAccount.Id;
|
||||
_user.HermesUsername = hermesAccount.Username;
|
||||
_user.TwitchUsername = hermesAccount.Username;
|
||||
_user.TwitchUserId = long.Parse(hermesAccount.BroadcasterId);
|
||||
}
|
||||
catch (ArgumentNullException)
|
||||
{
|
||||
_logger.Error("Ensure you have your Twitch account linked to TTS.");
|
||||
await Task.Delay(TimeSpan.FromSeconds(30));
|
||||
return;
|
||||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
_logger.Error("Ensure you have your Twitch account linked to TTS.");
|
||||
await Task.Delay(TimeSpan.FromSeconds(30));
|
||||
return;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "Failed to initialize properly. Restart app please.");
|
||||
await Task.Delay(TimeSpan.FromSeconds(30));
|
||||
return;
|
||||
}
|
||||
|
||||
_playback.AddOnMixerInputEnded((object? s, SampleProviderEventArgs e) =>
|
||||
{
|
||||
@@ -142,7 +123,8 @@ namespace TwitchChatTTS
|
||||
_veado.Initialize();
|
||||
await _veado.Connect();
|
||||
}
|
||||
catch (Exception e) {
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.Warning(e, "Failed to connect to Veado websocket server.");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user