Fixed TTS using StreamElements. Fixed several issues.

This commit is contained in:
Tom
2026-01-03 05:19:33 +00:00
parent fb04f4003f
commit aa89578297
16 changed files with 275 additions and 135 deletions

View File

@@ -120,8 +120,7 @@ namespace TwitchChatTTS.Twitch.Socket.Handlers
private int GetTotalBits(TwitchChatFragment[] fragments)
{
return fragments.Where(f => f.Type == "cheermote" && f.Cheermote != null)
.Select(f => f.Cheermote!.Bits)
.Sum();
.Sum(f => f.Cheermote!.Bits);
}
private string GetPermissionPath(string? customRewardId, int bits)

View File

@@ -142,14 +142,14 @@ namespace TwitchChatTTS.Twitch.Socket
_logger.Warning($"Twitch client has been identified, but isn't main or backup [client: {client.UID}][main: {_identified.UID}][backup: {_backup?.UID}]");
clientDisconnect = true;
}
if (clientDisconnect)
client.DisconnectAsync(new SocketDisconnectionEventArgs("Closed", "No need for a tertiary client.")).Wait();
}
finally
{
_mutex.ReleaseMutex();
}
if (clientDisconnect)
await client.DisconnectAsync(new SocketDisconnectionEventArgs("Closed", "No need for a tertiary client."));
}
}
}

View File

@@ -183,7 +183,7 @@ namespace TwitchChatTTS.Twitch.Socket
while (current < total)
{
var size = Encoding.UTF8.GetBytes(content.Substring(current), array);
await _socket!.SendAsync(array, WebSocketMessageType.Text, current + size >= total, _cts!.Token);
await _socket!.SendAsync(array, WebSocketMessageType.Text, current + size >= total, CancellationToken.None);
current += size;
}
_logger.Debug("Twitch TX #" + type + ": " + content);