private async Task CheckLiveStreamsStatusAsync(List <string> liveStreamsCheckList, int liveCheckInterval) { while (true) { var liveStreams = await TwitchApi.GetLiveStreamsInformationAsync(liveStreamsCheckList.ToArray()); Logger.Log("Running check live streams status..."); foreach (var live in liveStreams.StreamsInfo) { // Add stream to online streams list if it turns online if (StreamHelpers.IsLiveOnline(live) && !OnlineLiveStreams.Contains(live.Channel.Name)) { OnlineLiveStreams.Add(live.Channel.Name); } // Remove stream from online streams list if it turns offline if (OnlineLiveStreams.Contains(live.Channel.Name) && !StreamHelpers.IsLiveOnline(live)) { OnlineLiveStreams.Remove(live.Channel.Name); } } await Task.Delay(TimeSpan.FromSeconds(liveCheckInterval)); } }
private async Task CheckLiveStreamsStatusAsync(List <string> liveStreamsCheckList) { var liveStreams = await TwitchApi.GetLiveStreamsInformationAsync(liveStreamsCheckList.ToArray()); Logger.Log("Running check live streams status..."); foreach (var live in liveStreams.StreamsInfo) { if (StreamHelpers.IsLiveOnline(live) && !OnlineLiveStreams.Contains(live.Channel.Name)) { OnlineLiveStreams.Add(live.Channel.Name); } } }