コード例 #1
0
        private static async void OnStreamUp(object sender, OnStreamUpArgs e)
        {
            TwitchBotGlobalObjects.IsStreamOnline = true;
            TimeSpan?upTime = await TwitchApiController.GetStreamUpTime();

            if (upTime != null)
            {
                TwitchBotGlobalObjects.StreamUpTime = new TimeSpan(upTime.Value.Hours, upTime.Value.Minutes, upTime.Value.Seconds);
            }
            _streamOnlineTimer.Start();
        }
コード例 #2
0
        private static async void OnPubSubServiceConnected(object sender, EventArgs e)
        {
            // SendTopics accepts an oauth optionally, which is necessary for some topics
            client.SendTopics();
            bool isOnline = await TwitchApiController.CheckStreamOnline();

            if (isOnline)
            {
                TwitchBotGlobalObjects.IsStreamOnline = true;
                TimeSpan?upTime = await TwitchApiController.GetStreamUpTime();

                if (upTime != null)
                {
                    TwitchBotGlobalObjects.StreamUpTime = new TimeSpan(upTime.Value.Hours, upTime.Value.Minutes, upTime.Value.Seconds);
                }
                _streamOnlineTimer.Start();
            }
        }