Changed sender parameter to channel.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using HermesSocketLibrary.db;
|
||||
using HermesSocketServer.Models;
|
||||
using ILogger = Serilog.ILogger;
|
||||
|
||||
namespace HermesSocketServer.Requests
|
||||
@@ -7,21 +7,17 @@ namespace HermesSocketServer.Requests
|
||||
{
|
||||
public string Name => "get_chatter_ids";
|
||||
public string[] RequiredKeys => [];
|
||||
private Database _database;
|
||||
private ILogger _logger;
|
||||
|
||||
public GetChatterIds(Database database, ILogger logger)
|
||||
public GetChatterIds(ILogger logger)
|
||||
{
|
||||
_database = database;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public async Task<RequestResult> Grant(string sender, IDictionary<string, object>? data)
|
||||
public async Task<RequestResult> Grant(Channel channel, IDictionary<string, object> data)
|
||||
{
|
||||
IList<long> ids = new List<long>();
|
||||
string sql = $"SELECT id FROM \"Chatter\"";
|
||||
await _database.Execute(sql, (IDictionary<string, object>?) null, (r) => ids.Add(r.GetInt64(0)));
|
||||
_logger.Information($"Fetched all chatters for channel [channel: {sender}]");
|
||||
IEnumerable<long> ids = channel.Chatters.Get().Values.Select(c => c.ChatterId);
|
||||
_logger.Information($"Fetched all chatters for channel [channel: {channel.Id}]");
|
||||
return RequestResult.Successful(ids, notifyClientsOnAccount: false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user