Ejemplo n.º 1
0
        public void Game()
        {
            Streams stream = ConstVaribtls.GetRequest <Streams>("streams/95844270");

            if (stream.stream == null)
            {
                SendMessage($"{Context.Username}, стрим не запущен!");
                return;
            }

            SendMessage($"Мы играем в {stream.stream.game}");
        }
Ejemplo n.º 2
0
        public void UpTime()
        {
            Streams rez = ConstVaribtls.GetRequest <Streams>($"streams/95844270");//

            if (rez.stream == null)
            {
                SendMessage($"{Context.Username}, стрим не запущен!");
            }
            else
            {
                TimeSpan date = DateTime.UtcNow - rez.stream.created_at;
                SendMessage($"{Context.Username}, {date.Hours}:{date.Minutes}:{date.Seconds}");
            }
        }
Ejemplo n.º 3
0
        public void Test()
        {
            //Clip rez = ConstVaribtls.GetRequest<Clip>("clips/PluckySneakyAsteriskStinkyCheese");
            //Streams rez = ConstVaribtls.GetRequest<Streams>("streams/95844270");
            //string rez = ConstVaribtls.GetRequest($"channels/{Context.Channel}/subscriptions");
            string rez = ConstVaribtls.GetRequest($"oauth2/token");

            if (rez != null)
            {
                SendMessage($"ok");
            }
            else
            {
                SendMessage("noooo");
            }
        }
Ejemplo n.º 4
0
        private static void WorckBot(object obj)
        {
            while (!ConstVaribtls.Bot.client.IsConnected)
            {
                ;
            }

            while (true)
            {
                var res = ConstVaribtls.GetRequest <Streams>("streams/95844270");

                if (res.stream == null && ConstVaribtls.StartBot)
                {
                    ConstVaribtls.Bot.client.SendMessage(ConstVaribtls.Bot.client.JoinedChannels[0], "Стрим выключен, и я пойду спать");
                    ConstVaribtls.StartBot = false;
                    ConstVaribtls._logger.Info("Automatic; Выключение бота");

                    using (SqlConnection conect = new SqlConnection(ConstVaribtls.DateBase.ConnectionStringKey))
                    {
                        try
                        {
                            conect.Open();
                            using (SqlCommand command = new SqlCommand("sp_SetNotComeUsers", conect)
                            {
                                CommandType = System.Data.CommandType.StoredProcedure
                            })
                            {
                                command.ExecuteNonQuery();
                            }
                        }
                        catch (Exception e)
                        {
                            ConstVaribtls._logger.Error(e);
                        }
                    }
                }
                else if (res.stream != null && !ConstVaribtls.StartBot)
                {
                    ConstVaribtls.Bot.client.SendMessage(ConstVaribtls.Bot.client.JoinedChannels[0], "Стрим запущен, я иду работать!");
                    ConstVaribtls.StartBot = true;
                    ConstVaribtls._logger.Info("Automatic; Включение бота");
                    ConstVaribtls.ComeSayary = false;
                }

                Thread.Sleep(60000);
            }
        }