hermes-server/Requests/DeleteTTSFilter.cs

26 lines
757 B
C#

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