Using Serilog. Added partial OBS batch request support. Added update checking. Added more commands. Added enabled/disabled TTS voices. And more.
This commit is contained in:
28
User.cs
28
User.cs
@@ -1,5 +1,6 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Text.RegularExpressions;
|
||||
using TwitchChatTTS.Hermes;
|
||||
using HermesSocketLibrary.Requests.Messages;
|
||||
|
||||
namespace TwitchChatTTS
|
||||
{
|
||||
@@ -7,29 +8,38 @@ namespace TwitchChatTTS
|
||||
{
|
||||
// Hermes user id
|
||||
public string HermesUserId { get; set; }
|
||||
public string HermesUsername { get; set; }
|
||||
public long TwitchUserId { get; set; }
|
||||
public string TwitchUsername { get; set; }
|
||||
|
||||
public string SevenEmoteSetId { get; set; }
|
||||
|
||||
public string DefaultTTSVoice { get; set; }
|
||||
// voice id -> voice name
|
||||
public IDictionary<string, string> VoicesAvailable { get; set; }
|
||||
public IDictionary<string, string> VoicesAvailable { get => _voicesAvailable; set { _voicesAvailable = value; WordFilterRegex = GenerateEnabledVoicesRegex(); } }
|
||||
// chatter/twitch id -> voice name
|
||||
public IDictionary<long, string> VoicesSelected { get; set; }
|
||||
public HashSet<string> VoicesEnabled { get; set; }
|
||||
// voice names
|
||||
public HashSet<string> VoicesEnabled { get => _voicesEnabled; set { _voicesEnabled = value; WordFilterRegex = GenerateEnabledVoicesRegex(); } }
|
||||
|
||||
public IDictionary<string, TTSUsernameFilter> ChatterFilters { get; set; }
|
||||
public IList<TTSWordFilter> RegexFilters { get; set; }
|
||||
public IList<TTSWordFilter> RegexFilters { get; set; }
|
||||
[JsonIgnore]
|
||||
public Regex? WordFilterRegex { get; set; }
|
||||
|
||||
private IDictionary<string, string> _voicesAvailable;
|
||||
private HashSet<string> _voicesEnabled;
|
||||
|
||||
|
||||
public User() {
|
||||
|
||||
public User()
|
||||
{
|
||||
}
|
||||
|
||||
public Regex? GenerateEnabledVoicesRegex() {
|
||||
private Regex? GenerateEnabledVoicesRegex()
|
||||
{
|
||||
if (VoicesAvailable == null || VoicesAvailable.Count() <= 0)
|
||||
return null;
|
||||
|
||||
var enabledVoicesString = string.Join("|", VoicesAvailable.Select(v => v.Value));
|
||||
var enabledVoicesString = string.Join("|", VoicesAvailable.Where(v => VoicesEnabled == null || !VoicesEnabled.Any() || VoicesEnabled.Contains(v.Value)).Select(v => v.Value));
|
||||
return new Regex($@"\b({enabledVoicesString})\:(.*?)(?=\Z|\b(?:{enabledVoicesString})\:)", RegexOptions.IgnoreCase);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user