Cleaned up request acks. Added internal service bus for internal messaging.
This commit is contained in:
34
Hermes/Socket/Requests/GetDefaultTTSVoiceAck.cs
Normal file
34
Hermes/Socket/Requests/GetDefaultTTSVoiceAck.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System.Text.Json;
|
||||
using Serilog;
|
||||
|
||||
namespace TwitchChatTTS.Hermes.Socket.Requests
|
||||
{
|
||||
public class GetDefaultTTSVoiceAck : IRequestAck
|
||||
{
|
||||
public string Name => "get_default_tts_voice";
|
||||
private readonly User _user;
|
||||
private readonly JsonSerializerOptions _options;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public GetDefaultTTSVoiceAck(User user, JsonSerializerOptions options, ILogger logger)
|
||||
{
|
||||
_user = user;
|
||||
_options = options;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Acknowledge(string requestId, string json, IDictionary<string, object>? requestData)
|
||||
{
|
||||
string? defaultVoice = json;
|
||||
if (defaultVoice != null)
|
||||
{
|
||||
_user.DefaultTTSVoice = defaultVoice;
|
||||
_logger.Information($"Default TTS voice was changed [voice: {defaultVoice}]");
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Error($"Failed to load default TTS voice.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user