Redid stores. Added user store. Added Channel Manager, to manage data from a single channel.

This commit is contained in:
Tom
2024-10-19 01:50:46 +00:00
parent 3f3ba63554
commit 4d0b38babd
22 changed files with 654 additions and 475 deletions

View File

@@ -1,5 +1,6 @@
using System.Text.Json;
using HermesSocketLibrary.Requests;
using HermesSocketServer.Models;
using HermesSocketServer.Store;
using ILogger = Serilog.ILogger;
@@ -8,7 +9,7 @@ namespace HermesSocketServer.Requests
public class UpdateTTSVoice : IRequest
{
public string Name => "update_tts_voice";
private IStore<string, string> _voices;
private IStore<string, Voice> _voices;
private ILogger _logger;
public UpdateTTSVoice(VoiceStore voices, ILogger logger)
@@ -30,7 +31,11 @@ namespace HermesSocketServer.Requests
if (data["voiceid"] is JsonElement id)
data["voiceid"] = id.ToString();
_voices.Set(data["voiceid"].ToString(), data["voice"].ToString());
_voices.Set(data["voiceid"].ToString(), new Voice()
{
Id = data["voiceid"].ToString()!,
Name = data["voice"].ToString()!
});
_logger.Information($"Updated voice's [voice id: {data["voiceid"]}] name [new name: {data["voice"]}]");
return new RequestResult(true, null);
}