2024-06-24 22:21:59 +00:00
|
|
|
using HermesSocketLibrary.Requests.Messages;
|
2024-12-27 22:28:22 +00:00
|
|
|
using HermesSocketServer.Services;
|
2024-06-24 22:21:59 +00:00
|
|
|
using ILogger = Serilog.ILogger;
|
|
|
|
|
|
|
|
namespace HermesSocketServer.Requests
|
|
|
|
{
|
|
|
|
public class GetTTSWordFilters : IRequest
|
|
|
|
{
|
|
|
|
public string Name => "get_tts_word_filters";
|
2024-10-20 20:39:13 +00:00
|
|
|
public string[] RequiredKeys => [];
|
2024-12-27 22:28:22 +00:00
|
|
|
private ChannelManager _channels;
|
|
|
|
private ILogger _logger;
|
2024-06-24 22:21:59 +00:00
|
|
|
|
2024-12-27 22:28:22 +00:00
|
|
|
public GetTTSWordFilters(ChannelManager channels, ILogger logger)
|
2024-06-24 22:21:59 +00:00
|
|
|
{
|
2024-12-27 22:28:22 +00:00
|
|
|
_channels = channels;
|
2024-06-24 22:21:59 +00:00
|
|
|
_logger = logger;
|
|
|
|
}
|
|
|
|
|
2024-08-10 19:36:32 +00:00
|
|
|
public async Task<RequestResult> Grant(string sender, IDictionary<string, object>? data)
|
2024-06-24 22:21:59 +00:00
|
|
|
{
|
2024-12-27 22:28:22 +00:00
|
|
|
var channel = _channels.Get(sender);
|
|
|
|
IEnumerable<TTSWordFilter> filters = channel.Filters.Get().Values;
|
2024-06-24 22:21:59 +00:00
|
|
|
|
2024-08-10 19:36:32 +00:00
|
|
|
_logger.Information($"Fetched all word filters for channel [channel: {sender}]");
|
2024-10-20 20:39:13 +00:00
|
|
|
return RequestResult.Successful(filters, notifyClientsOnAccount: false);
|
2024-06-24 22:21:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|