Fixed TTS using StreamElements. Fixed several issues.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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."));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user