Added UTF-8 support for Console

This commit is contained in:
Tom 2024-08-07 19:33:10 +00:00
parent 87f3623ed6
commit d6b66b3446

4
TTS.cs
View File

@ -14,6 +14,7 @@ using TwitchChatTTS.OBS.Socket;
using TwitchChatTTS.Twitch.Socket.Messages; using TwitchChatTTS.Twitch.Socket.Messages;
using TwitchChatTTS.Twitch.Socket; using TwitchChatTTS.Twitch.Socket;
using TwitchChatTTS.Chat.Commands; using TwitchChatTTS.Chat.Commands;
using System.Text;
namespace TwitchChatTTS namespace TwitchChatTTS
{ {
@ -76,6 +77,7 @@ namespace TwitchChatTTS
public async Task StartAsync(CancellationToken cancellationToken) public async Task StartAsync(CancellationToken cancellationToken)
{ {
Console.Title = "TTS - Twitch Chat"; Console.Title = "TTS - Twitch Chat";
Console.OutputEncoding = Encoding.UTF8;
License.iConfirmCommercialUse("abcdef"); License.iConfirmCommercialUse("abcdef");
if (string.IsNullOrWhiteSpace(_configuration.Hermes?.Token)) if (string.IsNullOrWhiteSpace(_configuration.Hermes?.Token))
@ -98,7 +100,6 @@ namespace TwitchChatTTS
await Task.Delay(15 * 1000); await Task.Delay(15 * 1000);
} }
await _twitch.Connect();
await InitializeHermesWebsocket(); await InitializeHermesWebsocket();
try try
{ {
@ -126,6 +127,7 @@ namespace TwitchChatTTS
await Task.Delay(TimeSpan.FromSeconds(30)); await Task.Delay(TimeSpan.FromSeconds(30));
return; return;
} }
await _twitch.Connect();
var emoteSet = await _sevenApiClient.FetchChannelEmoteSet(_user.TwitchUserId.ToString()); var emoteSet = await _sevenApiClient.FetchChannelEmoteSet(_user.TwitchUserId.ToString());
if (emoteSet != null) if (emoteSet != null)