Added hermes websocket support. Added chat command support. Added selectable voice command via websocket. Added websocket heartbeat management.

This commit is contained in:
Tom
2024-03-15 12:27:35 +00:00
parent b5cc6b5706
commit d4004d6230
53 changed files with 1227 additions and 461 deletions

View File

@ -0,0 +1,17 @@
namespace TwitchChatTTS.Chat.Commands.Parameters
{
public abstract class ChatCommandParameter
{
public string Name { get; }
public string Description { get; }
public bool Optional { get; }
public ChatCommandParameter(string name, string description, bool optional = false) {
Name = name;
Description = description;
Optional = optional;
}
public abstract bool Validate(string value);
}
}

View File

@ -0,0 +1,23 @@
using Microsoft.Extensions.DependencyInjection;
namespace TwitchChatTTS.Chat.Commands.Parameters
{
public class TTSVoiceNameParameter : ChatCommandParameter
{
private IServiceProvider _serviceProvider;
public TTSVoiceNameParameter(IServiceProvider serviceProvider, bool optional = false) : base("TTS Voice Name", "Name of a TTS voice", optional)
{
_serviceProvider = serviceProvider;
}
public override bool Validate(string value)
{
var user = _serviceProvider.GetRequiredService<User>();
if (user.VoicesAvailable == null)
return false;
value = value.ToLower();
return user.VoicesAvailable.Any(e => e.Value.ToLower() == value);
}
}
}

View File

@ -0,0 +1,14 @@
namespace TwitchChatTTS.Chat.Commands.Parameters
{
public class UnvalidatedParameter : ChatCommandParameter
{
public UnvalidatedParameter(bool optional = false) : base("TTS Voice Name", "Name of a TTS voice", optional)
{
}
public override bool Validate(string value)
{
return true;
}
}
}