Changed sender parameter to channel.

This commit is contained in:
Tom
2024-12-27 23:31:36 +00:00
parent 06bfe110bb
commit 8277ea0154
27 changed files with 113 additions and 134 deletions

View File

@@ -1,4 +1,5 @@
using HermesSocketLibrary.db;
using HermesSocketServer.Models;
using ILogger = Serilog.ILogger;
namespace HermesSocketServer.Requests
@@ -16,16 +17,16 @@ namespace HermesSocketServer.Requests
_logger = logger;
}
public async Task<RequestResult> Grant(string sender, IDictionary<string, object>? data)
public async Task<RequestResult> Grant(Channel channel, IDictionary<string, object> data)
{
var temp = new Dictionary<string, object>() { { "user", sender } };
var temp = new Dictionary<string, object>() { { "user", channel.Id } };
var voices = new List<string>();
string sql = $"SELECT v.name FROM \"TtsVoiceState\" s "
+ "INNER JOIN \"TtsVoice\" v ON s.\"ttsVoiceId\" = v.id "
+ "WHERE \"userId\" = @user AND state = true";
await _database.Execute(sql, temp, (r) => voices.Add(r.GetString(0)));
_logger.Information($"Fetched all enabled TTS voice for channel [channel: {sender}]");
_logger.Information($"Fetched all enabled TTS voice for channel [channel: {channel.Id}]");
return RequestResult.Successful(voices, notifyClientsOnAccount: false);
}
}