Added proper slave mode - additional clients after the first connection. Fixed a few issues. Updated to version 4.8.2.

This commit is contained in:
Tom
2025-03-06 16:05:15 +00:00
parent cbdca1c008
commit 622b359b12
17 changed files with 146 additions and 33 deletions

View File

@@ -99,7 +99,9 @@ namespace TwitchChatTTS.Twitch.Redemptions
{
_redemptions.Add(redemption.Id, redemption);
_logger.Debug($"Added redemption to redemption manager [redemption id: {redemption.Id}]");
} else {
}
else
{
_redemptions[redemption.Id] = redemption;
_logger.Debug($"Updated redemption to redemption manager [redemption id: {redemption.Id}]");
}
@@ -263,6 +265,11 @@ namespace TwitchChatTTS.Twitch.Redemptions
break;
case "SPECIFIC_TTS_VOICE":
case "RANDOM_TTS_VOICE":
if (_user.Slave)
{
_logger.Debug($"Ignoring channel redemption due to being a slave client [chatter id: {senderId}][source: redemption][chatter: {senderDisplayName}][chatter id: {senderId}]");
break;
}
string voiceId = string.Empty;
bool specific = action.Type == "SPECIFIC_TTS_VOICE";
@@ -327,18 +334,43 @@ namespace TwitchChatTTS.Twitch.Redemptions
_logger.Debug($"Played an audio file for channel point redeem [file: {action.Data["file_path"]}][chatter: {senderDisplayName}][chatter id: {senderId}]");
break;
case "NIGHTBOT_PLAY":
if (_user.Slave)
{
_logger.Debug($"Ignoring channel redemption due to being a slave client [chatter id: {senderId}][source: redemption][chatter: {senderDisplayName}][chatter id: {senderId}]");
break;
}
await _nightbot.Play();
break;
case "NIGHTBOT_PAUSE":
if (_user.Slave)
{
_logger.Debug($"Ignoring channel redemption due to being a slave client [chatter id: {senderId}][source: redemption][chatter: {senderDisplayName}][chatter id: {senderId}]");
break;
}
await _nightbot.Pause();
break;
case "NIGHTBOT_SKIP":
if (_user.Slave)
{
_logger.Debug($"Ignoring channel redemption due to being a slave client [chatter id: {senderId}][source: redemption][chatter: {senderDisplayName}][chatter id: {senderId}]");
break;
}
await _nightbot.Skip();
break;
case "NIGHTBOT_CLEAR_PLAYLIST":
if (_user.Slave)
{
_logger.Debug($"Ignoring channel redemption due to being a slave client [chatter id: {senderId}][source: redemption][chatter: {senderDisplayName}][chatter id: {senderId}]");
break;
}
await _nightbot.ClearPlaylist();
break;
case "NIGHTBOT_CLEAR_QUEUE":
if (_user.Slave)
{
_logger.Debug($"Ignoring channel redemption due to being a slave client [chatter id: {senderId}][source: redemption][chatter: {senderDisplayName}][chatter id: {senderId}]");
break;
}
await _nightbot.ClearQueue();
break;
case "VEADOTUBE_SET_STATE":

View File

@@ -14,12 +14,12 @@ namespace TwitchChatTTS.Twitch.Socket.Handlers
public string Name => "channel.chat.message";
private readonly IChatMessageReader _reader;
private readonly User _user;
private readonly ICommandManager _commands;
private readonly IGroupPermissionManager _permissionManager;
private readonly IUsagePolicy<long> _permissionPolicy;
private readonly IChatterGroupManager _chatterGroupManager;
private readonly ServiceBusCentral _bus;
private readonly User _user;
private readonly ILogger _logger;
@@ -35,12 +35,12 @@ namespace TwitchChatTTS.Twitch.Socket.Handlers
)
{
_reader = reader;
_user = user;
_commands = commands;
_permissionManager = permissionManager;
_permissionPolicy = permissionPolicy;
_chatterGroupManager = chatterGroupManager;
_bus = bus;
_user = user;
_logger = logger;
}
@@ -58,13 +58,13 @@ namespace TwitchChatTTS.Twitch.Socket.Handlers
var groups = GetGroups(message.Badges, chatterId);
var bits = GetTotalBits(fragments);
if (message.ChannelPointsCustomRewardId == null)
if (message.ChannelPointsCustomRewardId == null && !_user.Slave)
{
var commandResult = await CheckForChatCommand(message.Message.Text, message, groups);
if (commandResult != ChatCommandResult.Unknown)
return;
}
else
else if (message.ChannelPointsCustomRewardId != null)
{
_bus.Send(this, "chat_message_redemption", message);
}