hermes-server/Requests/GetChatterIds.cs

24 lines
770 B
C#
Raw Normal View History

2024-12-27 23:31:36 +00:00
using HermesSocketServer.Models;
using ILogger = Serilog.ILogger;
namespace HermesSocketServer.Requests
{
public class GetChatterIds : IRequest
{
public string Name => "get_chatter_ids";
public string[] RequiredKeys => [];
private ILogger _logger;
2024-12-27 23:31:36 +00:00
public GetChatterIds(ILogger logger)
{
_logger = logger;
}
2024-12-27 23:31:36 +00:00
public async Task<RequestResult> Grant(Channel channel, IDictionary<string, object> data)
{
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}]");
return RequestResult.Successful(ids, notifyClientsOnAccount: false);
}
}
}