hermes-server/Requests/GetTTSUsers.cs

30 lines
1.0 KiB
C#

using HermesSocketLibrary.Requests;
using HermesSocketServer.Services;
using ILogger = Serilog.ILogger;
namespace HermesSocketServer.Requests
{
public class GetTTSUsers : IRequest
{
public string Name => "get_tts_users";
private ChannelManager _channels;
private ILogger _logger;
public GetTTSUsers(ChannelManager channels, ILogger logger)
{
_channels = channels;
_logger = logger;
}
public async Task<RequestResult> Grant(string sender, IDictionary<string, object>? data)
{
var channel = _channels.Get(sender);
if (channel == null)
return new RequestResult(false, null, notifyClientsOnAccount: false);
var temp = channel.Chatters.Get().ToDictionary(p => p.Key, p => p.Value.VoiceId);
_logger.Information($"Fetched all chatters' selected tts voice for channel [channel: {sender}]");
return new RequestResult(true, temp, notifyClientsOnAccount: false);
}
}
}