diff --git a/Requests/GetTTSUsers.cs b/Requests/GetTTSUsers.cs index 09ee4d4..c1c09ff 100644 --- a/Requests/GetTTSUsers.cs +++ b/Requests/GetTTSUsers.cs @@ -1,5 +1,5 @@ -using HermesSocketLibrary.db; using HermesSocketLibrary.Requests; +using HermesSocketServer.Store; using ILogger = Serilog.ILogger; namespace HermesSocketServer.Requests @@ -7,24 +7,20 @@ namespace HermesSocketServer.Requests public class GetTTSUsers : IRequest { public string Name => "get_tts_users"; - private readonly Database _database; - private readonly ILogger _logger; + private ChatterStore _chatters; + private ILogger _logger; - public GetTTSUsers(Database database, ILogger logger) + public GetTTSUsers(ChatterStore chatters, ILogger logger) { - _database = database; + _chatters = chatters; _logger = logger; } public async Task Grant(string sender, IDictionary? data) { - var temp = new Dictionary() { { "user", sender } }; - - IDictionary users = new Dictionary(); - string sql = $"SELECT \"ttsVoiceId\", \"chatterId\" FROM \"TtsChatVoice\" WHERE \"userId\" = @user"; - await _database.Execute(sql, temp, (r) => users.Add(r.GetInt64(1), r.GetString(0))); + var temp = _chatters.Get(sender); _logger.Information($"Fetched all chatters' selected tts voice for channel [channel: {sender}]"); - return new RequestResult(true, users, notifyClientsOnAccount: false); + return new RequestResult(true, temp, notifyClientsOnAccount: false); } } } \ No newline at end of file