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

28 lines
870 B
C#

using HermesSocketServer.Services;
using ILogger = Serilog.ILogger;
namespace HermesSocketServer.Requests
{
public class DeleteTTSFilter : IRequest
{
public string Name => "delete_tts_filter";
public string[] RequiredKeys => ["id"];
private ChannelManager _channels;
private ILogger _logger;
public DeleteTTSFilter(ChannelManager channels, ILogger logger)
{
_channels = channels;
_logger = logger;
}
public async Task<RequestResult> Grant(string sender, IDictionary<string, object>? data)
{
var channel = _channels.Get(sender);
channel.Filters.Remove(data!["id"].ToString());
_logger.Information($"Deleted a TTS filter by id [tts filter id: {data["id"]}]");
return RequestResult.Successful(null);
}
}
}