コード例 #1
0
        public override void frame()
        {
            if (isActive)
            {
                lock (messageLastLock)
                {
                    if (m_Throttler.isReady)
                    {
                        string output = !string.IsNullOrEmpty(description) ? m_BotBrain.localizer.getString("pollAnnounceDescribed") : m_BotBrain.localizer.getString("pollAnnounce");
                        output += "  " + string.Format(m_BotBrain.localizer.getString("pollChoiceList"), getChoiceString()) + "  ";
                        output += m_BotBrain.localizer.getString("pollVoteHint") + "  ";
                        output += string.Format(m_BotBrain.localizer.getString("pollVotesCurrent"), userChoices.Count);

                        if (choicesNew > 0)
                        {
                            output += "  " + string.Format(m_BotBrain.localizer.getString("pollNewVoteCount"), choicesNew);
                        }

                        if (choicesUpdated > 0)
                        {
                            output += "  " + string.Format(m_BotBrain.localizer.getString("pollUpdatedVoteCount"), choicesUpdated);
                        }

                        m_BotBrain.sendDefaultChannelMessage(output);

                        choicesNew     = 0;
                        choicesUpdated = 0;

                        m_Throttler.trigger();
                    }
                }
            }
        }
コード例 #2
0
        public void start(userEntry commandUser, string argumentString)
        {
            if (!string.IsNullOrEmpty(argumentString))
            {
                List <string> tagList = new List <string>();

                if (argumentString == "all")
                {
                    foreach (triviaCategory curCategory in m_Categories)
                    {
                        tagList.Add(curCategory.code);
                    }
                }
                else
                {
                    tagList = argumentString.Split(' ').ToList();
                }


                List <triviaQuestion> newQuestions = getQuestionsForTags(tagList);
                string tagListString = string.Join(", ", tagList.ToArray());

                if (newQuestions.Count > 0)
                {
                    newQuestions.Sort(delegate(triviaQuestion a, triviaQuestion b)
                    {
                        return(m_BotBrain.randomizer.Next() - m_BotBrain.randomizer.Next());
                    });

                    m_Questions            = newQuestions.GetRange(0, Math.Min(m_TotalQuestions, newQuestions.Count));
                    m_CurrentQuestionIndex = 0;
                    m_Scores = new Dictionary <userEntry, int>();


                    m_BotBrain.sendDefaultChannelMessage(string.Format(m_BotBrain.localizer.getString("triviaQuestionCurrent"), tagListString, m_Questions.Count));
                    m_BotBrain.sendDefaultChannelMessage(string.Format(m_BotBrain.localizer.getString("triviaQuestionFirst"), getCurrentQuestion().getFormattedTitle()));

                    m_Throttler.trigger();
                    m_TimeSinceLastAnswer = m_BotBrain.actionTimer.ElapsedMilliseconds;
                    m_IsActive            = true;
                }
                else
                {
                    m_BotBrain.sendDefaultChannelMessage(string.Format(m_BotBrain.localizer.getString("triviaNoQuestionsFound"), tagListString));
                }
            }
            else
            {
                m_BotBrain.sendDefaultChannelMessage(m_BotBrain.localizer.getString("triviaStartNoTags"));
            }
        }
コード例 #3
0
 public override void frame()
 {
     if (m_Throttler.isReady)
     {
         m_Throttler.trigger();
         int curHoursPassed = getHoursPassed();
         if (curHoursPassed > m_LastHoursPassed)
         {
             m_LastHoursPassed = curHoursPassed;
             m_BotBrain.sendDefaultChannelMessage(getDrinkMessage(m_BotBrain.actionTimer.ElapsedMilliseconds));
         }
     }
 }
コード例 #4
0
ファイル: raffle.cs プロジェクト: jerpdoesgames/TwitchJerpBot
        public void open(userEntry commandUser, string argumentString)
        {
            bool rewardAlreadyExists;

            lock (messageLastLock)
            {
                if (
                    !m_UsePointRedemption ||
                    (
                        checkCreateChannelPointRedemptionReward(out rewardAlreadyExists) &&
                        (!rewardAlreadyExists || updateChannelPointRedemptionRewardEnabled(true))
                    )
                    )
                {
                    // TODO: Handle something like, if the reward exists but it's not required, disable the reward
                    resetEntries();
                    m_BotBrain.sendDefaultChannelMessage(m_BotBrain.localizer.getString("raffleOpenedCleared") + getJoinString());

                    m_Throttler.trigger();

                    m_IsActive = true;
                }
            }
        }
コード例 #5
0
        private void sendNextMessage()
        {
            string messageToSend = getNextMessage();

            if (!String.IsNullOrEmpty(messageToSend))
            {
                if (messageToSend.IndexOf('!') == 0)
                {
                    userEntry jerpUser = m_BotBrain.checkCreateUser(m_BotBrain.ownerUsername);

                    m_BotBrain.processUserCommand(jerpUser, messageToSend);
                }
                else
                {
                    m_BotBrain.sendDefaultChannelMessage(messageToSend);
                }
            }

            m_Throttler.trigger();
        }