34 lines
1.0 KiB
C#
34 lines
1.0 KiB
C#
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.");
|
|
}
|
|
}
|
|
}
|
|
} |