Fixed issues with TTS voice changes. Added proper handling for slave clients. Fixed several stores. Fixed database saving to safely save foreign keys.

This commit is contained in:
Tom
2025-03-06 16:11:36 +00:00
parent 3e717522c2
commit fd0bca5c7c
13 changed files with 139 additions and 96 deletions

View File

@@ -20,20 +20,20 @@ namespace HermesSocketServer.Requests
public Task<RequestResult> Grant(Channel channel, IDictionary<string, object> data)
{
var id = data["voice"].ToString()!;
var state = data["state"].ToString() == "True";
var voiceId = data["voice"].ToString()!;
var state = data["state"].ToString()?.ToLower() == "true";
var voiceState = new TTSVoiceState()
{
Id = id,
Id = voiceId,
UserId = channel.Id,
Enabled = state,
};
var result = channel.VoiceStates.Set(id, voiceState);
var result = channel.VoiceStates.Set(voiceId, voiceState);
if (result)
{
_logger.Information($"Updated voice state on channel [voice id: {id}][state: {state}][channel: {channel.Id}]");
_logger.Information($"Updated voice state on channel [voice id: {voiceId}][state: {state}][channel: {channel.Id}]");
return Task.FromResult(RequestResult.Successful(voiceState));
}
return Task.FromResult(RequestResult.Failed("Something went wrong when updating the database."));