Twitch connection now relies on events to connect. Added logging for when TTS filter is not a regex. Minor code clean up.

This commit is contained in:
Tom
2025-01-19 01:23:29 +00:00
parent 86fc6bc24d
commit cbdca1c008
9 changed files with 102 additions and 68 deletions

View File

@@ -247,7 +247,7 @@ namespace TwitchChatTTS.Hermes.Socket
public void Initialize()
{
_logger.Information("Initializing Hermes websocket client.");
_logger.Information("Initializing Tom to Speech websocket client.");
OnConnected += async (sender, e) =>
{
@@ -257,7 +257,7 @@ namespace TwitchChatTTS.Hermes.Socket
return;
Connected = true;
}
_logger.Information("Hermes websocket client connected.");
_logger.Information("Tom to Speech websocket client connected.");
_heartbeatTimer.Enabled = true;
LastHeartbeatReceived = DateTime.UtcNow;
@@ -281,7 +281,7 @@ namespace TwitchChatTTS.Hermes.Socket
LoggedIn = false;
Ready = false;
_logger.Warning("Hermes websocket client disconnected.");
_logger.Warning("Tom to Speech websocket client disconnected.");
_heartbeatTimer.Enabled = false;
await Reconnect(_backoff);
@@ -396,7 +396,7 @@ namespace TwitchChatTTS.Hermes.Socket
}
catch (Exception ex)
{
_logger.Error(ex, "Failed to send a heartbeat back to the Hermes websocket server.");
_logger.Error(ex, "Failed to send a heartbeat back to the Tom to Speech websocket server.");
}
}
else if (signalTime - LastHeartbeatReceived > TimeSpan.FromSeconds(120))
@@ -407,7 +407,7 @@ namespace TwitchChatTTS.Hermes.Socket
}
catch (Exception ex)
{
_logger.Error(ex, "Failed to disconnect from Hermes websocket server.");
_logger.Error(ex, "Failed to disconnect from Tom to Speech websocket server.");
Ready = false;
LoggedIn = false;
Connected = false;
@@ -423,7 +423,7 @@ namespace TwitchChatTTS.Hermes.Socket
{
if (!Connected)
{
_logger.Warning("Hermes websocket client is not connected. Not sending a message.");
_logger.Warning("Tom to Speech websocket client is not connected. Not sending a message.");
return;
}