Added stores for connections. Added requests for groups, group chatters, group permissions & connections. Using TTS Voice State store.
This commit is contained in:
32
Requests/DeleteConnection.cs
Normal file
32
Requests/DeleteConnection.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using HermesSocketServer.Models;
|
||||
using ILogger = Serilog.ILogger;
|
||||
|
||||
namespace HermesSocketServer.Requests
|
||||
{
|
||||
public class DeleteConnection : IRequest
|
||||
{
|
||||
public string Name => "delete_connection";
|
||||
public string[] RequiredKeys => ["id"];
|
||||
private ILogger _logger;
|
||||
|
||||
public DeleteConnection(ILogger logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public Task<RequestResult> Grant(Channel channel, IDictionary<string, object> data)
|
||||
{
|
||||
var connectionId = data["id"].ToString()!;
|
||||
|
||||
var result = channel.Connections.Remove(connectionId);
|
||||
if (result)
|
||||
{
|
||||
_logger.Information($"Deleted a connection by id [connection id: {connectionId}]");
|
||||
return Task.FromResult(RequestResult.Successful(null));
|
||||
}
|
||||
|
||||
_logger.Warning($"Connection Id does not exist [connection id: {connectionId}]");
|
||||
return Task.FromResult(RequestResult.Failed("Something went wrong when updating the cache."));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user