using HermesSocketLibrary.db; using HermesSocketLibrary.Requests.Messages; using ILogger = Serilog.ILogger; namespace HermesSocketServer.Requests { public class GetEmotes : IRequest { public string Name => "get_emotes"; public string[] RequiredKeys => []; private Database _database; private ILogger _logger; public GetEmotes(Database database, ILogger logger) { _database = database; _logger = logger; } public async Task Grant(string sender, IDictionary? data) { IList emotes = new List(); string sql = $"SELECT id, name FROM \"Emote\""; await _database.Execute(sql, (IDictionary?) null, (r) => emotes.Add(new EmoteInfo() { Id = r.GetString(0), Name = r.GetString(1) })); _logger.Information($"Fetched all emotes for channel [channel: {sender}]"); return RequestResult.Successful(emotes, notifyClientsOnAccount: false); } } }