2024-06-24 18:21:59 -04:00
|
|
|
using HermesSocketLibrary.Requests;
|
2024-10-18 21:50:46 -04:00
|
|
|
using HermesSocketServer.Services;
|
2024-06-24 18:21:59 -04:00
|
|
|
using ILogger = Serilog.ILogger;
|
|
|
|
|
|
|
|
namespace HermesSocketServer.Requests
|
|
|
|
{
|
|
|
|
public class GetTTSUsers : IRequest
|
|
|
|
{
|
|
|
|
public string Name => "get_tts_users";
|
2024-10-18 21:50:46 -04:00
|
|
|
private ChannelManager _channels;
|
2024-10-17 23:18:40 -04:00
|
|
|
private ILogger _logger;
|
2024-06-24 18:21:59 -04:00
|
|
|
|
2024-10-18 21:50:46 -04:00
|
|
|
public GetTTSUsers(ChannelManager channels, ILogger logger)
|
2024-06-24 18:21:59 -04:00
|
|
|
{
|
2024-10-18 21:50:46 -04:00
|
|
|
_channels = channels;
|
2024-06-24 18:21:59 -04:00
|
|
|
_logger = logger;
|
|
|
|
}
|
|
|
|
|
2024-08-10 15:36:32 -04:00
|
|
|
public async Task<RequestResult> Grant(string sender, IDictionary<string, object>? data)
|
2024-06-24 18:21:59 -04:00
|
|
|
{
|
2024-10-18 21:50:46 -04:00
|
|
|
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);
|
2024-08-10 15:36:32 -04:00
|
|
|
_logger.Information($"Fetched all chatters' selected tts voice for channel [channel: {sender}]");
|
2024-10-17 23:18:40 -04:00
|
|
|
return new RequestResult(true, temp, notifyClientsOnAccount: false);
|
2024-06-24 18:21:59 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|