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

@ -48,7 +48,7 @@ namespace TwitchChatTTS.Hermes.Socket.Requests
}
catch (Exception)
{
_logger.Warning($"Failed to generate a Regular Expression using '{filter.Search}' [filter id: {filter.Id}]");
_logger.Warning($"Failed to create a regular expression for a TTS filter [filter id: {filter.Search}]");
}
_logger.Debug($"Filter data [filter id: {filter.Id}][search: {filter.Search}][replace: {filter.Replace}]");

View File

@ -33,11 +33,14 @@ namespace TwitchChatTTS.Hermes.Socket.Requests
{
try
{
var re = new Regex(filter.Search, ((RegexOptions) filter.Flag) | RegexOptions.Compiled);
var re = new Regex(filter.Search, ((RegexOptions)filter.Flag) | RegexOptions.Compiled);
re.Match(string.Empty);
filter.Regex = re;
}
catch (Exception) { }
catch (Exception)
{
_logger.Warning($"Failed to create a regular expression for a TTS filter [filter id: {filter.Search}]");
}
}
_user.RegexFilters = filters;
_logger.Information($"TTS word filters [count: {_user.RegexFilters.Count}] have been refreshed.");

View File

@ -52,7 +52,10 @@ namespace TwitchChatTTS.Hermes.Socket.Requests
re.Match(string.Empty);
current.Regex = re;
}
catch (Exception) { }
catch (Exception)
{
_logger.Warning($"Failed to create a regular expression for a TTS filter [filter id: {filter.Search}]");
}
_logger.Information($"Filter has been updated [filter id: {filter.Id}]");
}