Fixed compiler warnings.
This commit is contained in:
@@ -1,6 +1,3 @@
|
||||
using System.Text.Json;
|
||||
using HermesSocketLibrary.db;
|
||||
using HermesSocketLibrary.Requests.Messages;
|
||||
using HermesSocketServer.Models;
|
||||
using ILogger = Serilog.ILogger;
|
||||
|
||||
@@ -10,31 +7,18 @@ namespace HermesSocketServer.Requests
|
||||
{
|
||||
public string Name => "get_redeemable_actions";
|
||||
public string[] RequiredKeys => [];
|
||||
private readonly JsonSerializerOptions _options;
|
||||
private readonly Database _database;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public GetRedeemableActions(JsonSerializerOptions options, Database database, ILogger logger)
|
||||
public GetRedeemableActions(ILogger logger)
|
||||
{
|
||||
_options = options;
|
||||
_database = database;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public async Task<RequestResult> Grant(Channel channel, IDictionary<string, object> data)
|
||||
public Task<RequestResult> Grant(Channel channel, IDictionary<string, object> data)
|
||||
{
|
||||
var temp = new Dictionary<string, object>() { { "user", channel.Id } };
|
||||
|
||||
var redemptions = new List<RedeemableAction>();
|
||||
string sql = $"SELECT name, type, data FROM \"Action\" WHERE \"userId\" = @user";
|
||||
await _database.Execute(sql, temp, (r) => redemptions.Add(new RedeemableAction()
|
||||
{
|
||||
Name = r.GetString(0),
|
||||
Type = r.GetString(1),
|
||||
Data = JsonSerializer.Deserialize<IDictionary<string, string>>(r.GetString(2), _options)!
|
||||
}));
|
||||
var redemptions = channel.Actions.Get().Values;
|
||||
_logger.Information($"Fetched all chatters' selected tts voice for channel [channel: {channel.Id}]");
|
||||
return RequestResult.Successful(redemptions, notifyClientsOnAccount: false);
|
||||
return Task.FromResult(RequestResult.Successful(redemptions, notifyClientsOnAccount: false));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user