Esempio n. 1
0
        /// <summary>
        /// Check PRIVMSG for specific commands.
        /// </summary>
        private void analyzeMessage()
        {
            MessageInfo privMsg;

            irc.botLogic(out privMsg); //returns true if botlogic did something to the message
            if (privMsg != null)
            {
                MessagestoPost.Enqueue(privMsg);

                if (privMsg.theUser.name == "akiraion")
                {
                    Match theMatch = Regex.Match(privMsg.message, $@"\A!track \w+");
                    if (theMatch.Success)
                    {
                        string theChannel = theMatch.ToString().Substring(7);
                        if (!channelArray.ContainsKey(theChannel))
                        {
                            channelArray.Add(theChannel, new ChannelBackBone(theChannel));
                        }
                        TimerCallback          TimerDelegate = new TimerCallback(OverwatchTask);
                        System.Threading.Timer TimerItem     =
                            new System.Threading.Timer(TimerDelegate, theChannel, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(10));
                        timers.Add(TimerItem);
                    }
                }
                Match theMatch2 = Regex.Match(privMsg.message, $@"\A!points\Z");
                if (theMatch2.Success)
                {
                    if (channelArray[privMsg.channel].containsUser(privMsg.theUser.name))
                    {
                        int thePoints = channelArray[privMsg.channel].returnUser(privMsg.theUser.name).points;
                        irc.sendQ.Enqueue(new string[2] {
                            privMsg.channel, $"@{privMsg.theUser.name} has {thePoints} points."
                        });
                    }
                }
            }
        }