Exemplo n.º 1
0
 private void InstanceOnOnChatHandler(object sender, OnChatEvent onChatEvent)
 {
     //Logger.Debug("Fired Message Event:" + onChatEvent.Message, QuizBot.BotInstance.Name);
     if (onChatEvent.Message.Trim().Equals(_currentItem.Anwser))
     {
         //NoPost = true;
         Timer.Stop();
         //NoPost = false;
         SpiffCore.Instance.WriteOut.SendMessage(onChatEvent.User + " got the anwser correct!");
         _currentItem = getQuizItem();
         if(Timer != null)
             Timer.Start();
     }
 }
Exemplo n.º 2
0
        public QuizMaster(string file)
        {
            _file = file;

            _quizItems =
                Utils.DeserializeFromXml<List<QuizItem>>(
                    File.ReadAllText(Path.Combine(QuizBot.BotInstance.PluginDirectory, file)));

            Timer = new Timer {Interval = 60000};
            Timer.Elapsed += TimerOnTick;

            _currentItem = getQuizItem();

            SpiffCore.Instance.OnChatHandler += InstanceOnOnChatHandler;

            Timer.Start();
        }
Exemplo n.º 3
0
 private void TimerOnTick(object sender, EventArgs eventArgs)
 {
     if (_currentItem == null)
     {
         Logger.Error("Current Quiz item seems to be null", QuizBot.BotInstance.Name);
         return;
     }
     //if (NoPost) return;
     SpiffCore.Instance.WriteOut.SendMessage("The anwser for the question was: " + _currentItem.Anwser);
     _currentItem = getQuizItem();
     if(Timer != null)
         Timer.Start();
 }