Added missing websocket support for Redemptions and Actions. Fixed Ad Break actions. Cleaned some code.

This commit is contained in:
Tom
2025-01-07 15:30:13 +00:00
parent 77b37f04b6
commit 64cb0c1f6d
17 changed files with 227 additions and 36 deletions

View File

@ -7,7 +7,6 @@ using org.mariuszgromada.math.mxparser;
using Serilog;
using TwitchChatTTS.Bus;
using TwitchChatTTS.Bus.Data;
using TwitchChatTTS.Hermes.Socket;
using TwitchChatTTS.OBS.Socket;
using TwitchChatTTS.OBS.Socket.Data;
using TwitchChatTTS.Veadotube;
@ -23,7 +22,6 @@ namespace TwitchChatTTS.Twitch.Redemptions
private readonly ServiceBusCentral _bus;
private readonly User _user;
private readonly OBSSocketClient _obs;
private readonly HermesSocketClient _hermes;
private readonly VeadoSocketClient _veado;
private readonly NightbotApiClient _nightbot;
private readonly AudioPlaybackEngine _playback;
@ -36,7 +34,6 @@ namespace TwitchChatTTS.Twitch.Redemptions
ServiceBusCentral bus,
User user,
[FromKeyedServices("obs")] SocketClient<WebSocketMessage> obs,
[FromKeyedServices("hermes")] SocketClient<WebSocketMessage> hermes,
[FromKeyedServices("veadotube")] SocketClient<object> veado,
NightbotApiClient nightbot,
AudioPlaybackEngine playback,
@ -48,7 +45,6 @@ namespace TwitchChatTTS.Twitch.Redemptions
_bus = bus;
_user = user;
_obs = (obs as OBSSocketClient)!;
_hermes = (hermes as HermesSocketClient)!;
_veado = (veado as VeadoSocketClient)!;
_nightbot = nightbot;
_playback = playback;
@ -284,12 +280,12 @@ namespace TwitchChatTTS.Twitch.Redemptions
if (_user.VoicesSelected.ContainsKey(senderId))
{
await _hermes.UpdateTTSUser(senderId, voiceId);
_bus.Send(this, "tts.user.voice.update", new Dictionary<string, object>() { { "chatter", senderId }, { "voice", voiceId } });
_logger.Debug($"Sent request to update chat TTS voice [voice: {voiceName}][chatter id: {senderId}][source: redemption][chatter: {senderDisplayName}][chatter id: {senderId}]");
}
else
{
await _hermes.CreateTTSUser(senderId, voiceId);
_bus.Send(this, "tts.user.voice.create", new Dictionary<string, object>() { { "chatter", senderId }, { "voice", voiceId } });
_logger.Debug($"Sent request to create chat TTS voice [voice: {voiceName}][chatter id: {senderId}][source: redemption][chatter: {senderDisplayName}][chatter id: {senderId}]");
}
break;