示例#1
0
        private static void Timer_Elapsed(object sender, ElapsedEventArgs e)
        {
            Timer.Interval = QuestionInterval;
            Timer.Stop();
            int          rand            = rnd.Next(0, Math.Max(0, Questions.Count - 1));
            TrivQuestion currentQuestion = Questions[rand];

            CurrentAnswer = currentQuestion.Answer;
            Program.client.SendMessage(Program.client.JoinedChannels[0], currentQuestion.Question);
            WaitingOnAnswer = true;
            for (int i = 0; i < 3; i++)
            {
                for (int x = 0; x < HintInterval; x++)
                {
                    if (!WaitingOnAnswer)
                    {
                        break;
                    }
                    Thread.Sleep(1000);
                }
                if (!WaitingOnAnswer)
                {
                    break;
                }
                switch (i)
                {
                case 0: break;

                case 1: break;

                case 2: break;

                default: break;
                }
            }
            if (!WaitingOnAnswer)
            {
                DatabaseHandler.ExecuteNonQuery($"INSERT IGNORE INTO Users (username,points) values ('{Winner}', {answerPoints}); UPDATE Users SET points = points + {answerPoints} WHERE username='******'");
                Program.client.SendMessage(Program.client.JoinedChannels[0], $"{Winner} answered first with the correct answer and has earned {answerPoints} points!");
            }
            else
            {
                Program.client.SendMessage(Program.client.JoinedChannels[0], $"Time has ended. The correct answer was {CurrentAnswer}");
            }
            Timer.Start();
        }
示例#2
0
 private static void onGiftedSubscription(object sender, OnGiftedSubscriptionArgs e)
 {
     client.SendMessage(client.JoinedChannels[0], $"Wow! {e.GiftedSubscription.Login} has gifted a subscription to {e.GiftedSubscription.MsgParamRecipientUserName}! Thank you so much for your generosity! You have been awarded 5000 points for being so kind :)");
     DatabaseHandler.ExecuteNonQuery($"INSERT IGNORE INTO users (username,points) values ('{e.GiftedSubscription.Login}', {5000}); UPDATE users SET points = points + {5000} WHERE username='******'");
 }