2024-12-27 23:31:36 +00:00
|
|
|
using HermesSocketServer.Models;
|
2024-06-24 22:21:59 +00:00
|
|
|
using ILogger = Serilog.ILogger;
|
|
|
|
|
|
|
|
namespace HermesSocketServer.Requests
|
|
|
|
{
|
|
|
|
public class GetChatterIds : IRequest
|
|
|
|
{
|
|
|
|
public string Name => "get_chatter_ids";
|
2024-10-20 20:39:13 +00:00
|
|
|
public string[] RequiredKeys => [];
|
2024-06-24 22:21:59 +00:00
|
|
|
private ILogger _logger;
|
|
|
|
|
2024-12-27 23:31:36 +00:00
|
|
|
public GetChatterIds(ILogger logger)
|
2024-06-24 22:21:59 +00:00
|
|
|
{
|
|
|
|
_logger = logger;
|
|
|
|
}
|
|
|
|
|
2024-12-28 17:24:02 +00:00
|
|
|
public Task<RequestResult> Grant(Channel channel, IDictionary<string, object> data)
|
2024-06-24 22:21:59 +00:00
|
|
|
{
|
2024-12-27 23:31:36 +00:00
|
|
|
IEnumerable<long> ids = channel.Chatters.Get().Values.Select(c => c.ChatterId);
|
|
|
|
_logger.Information($"Fetched all chatters for channel [channel: {channel.Id}]");
|
2024-12-28 17:24:02 +00:00
|
|
|
return Task.FromResult(RequestResult.Successful(ids, notifyClientsOnAccount: false));
|
2024-06-24 22:21:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|