private Task OnMessageInternalAsync(string msg) { var message = ChatResponse.Parse(msg); System.IO.File.AppendAllText(@"C:\chat.txt", $"\n\n{msg}"); return(Console.Out.WriteLineAsync(msg)); }
public TwitchChatApiClient(RestClientProvider restClientProvider, SocketClientProvider socketClientProvider, CacheClientProvider cacheClientProvider, string clientId, string userAgent, string socketUrl, RetryMode defaultRetryMode = RetryMode.AlwaysRetry, JsonSerializer serializer = null) : base(restClientProvider, clientId, userAgent, serializer) { _socketUrl = socketUrl; SocketClient = socketClientProvider(); CacheClient = cacheClientProvider(100); SocketClient.TextMessage += async text => { var msg = ChatResponse.Parse(text); await _receivedChatEvent.InvokeAsync(msg).ConfigureAwait(false); }; SocketClient.Closed += async ex => { await DisconnectAsync().ConfigureAwait(false); await _disconnectedEvent.InvokeAsync(ex).ConfigureAwait(false); }; }