hermes-server/Requests/GetTTSWordFilters.cs
2024-12-27 22:28:22 +00:00

29 lines
971 B
C#

using HermesSocketLibrary.Requests.Messages;
using HermesSocketServer.Services;
using ILogger = Serilog.ILogger;
namespace HermesSocketServer.Requests
{
public class GetTTSWordFilters : IRequest
{
public string Name => "get_tts_word_filters";
public string[] RequiredKeys => [];
private ChannelManager _channels;
private ILogger _logger;
public GetTTSWordFilters(ChannelManager channels, ILogger logger)
{
_channels = channels;
_logger = logger;
}
public async Task<RequestResult> Grant(string sender, IDictionary<string, object>? data)
{
var channel = _channels.Get(sender);
IEnumerable<TTSWordFilter> filters = channel.Filters.Get().Values;
_logger.Information($"Fetched all word filters for channel [channel: {sender}]");
return RequestResult.Successful(filters, notifyClientsOnAccount: false);
}
}
}