Exemple #1
0
        override public void HandleMessage(Message message)
        {
            Channel channel = ModuleManager.channels.Find(x => x.Name == message.channel);

            string uptime  = "!" + channel.utilConfig.uptime;
            string viewers = "!" + channel.utilConfig.viewers;

            if (message.msg.StartsWith(uptime))
            {
                TimeSpan timeSpan = CheckStream.Uptime(message.channel);
                message.msg = (timeSpan.Hours - 2) + " hours " + timeSpan.Minutes + " minutes.";
                irc.SendResponse(message);
            }
            else if (message.msg.StartsWith(viewers))
            {
                List <string> chatters = Chatters.GetViewers(message.channel);
                if (chatters != null)
                {
                    if (chatters.Count > 20)
                    {
                        string response = "Widzowie: ";
                        for (int i = 0; i < 10; i++)
                        {
                            response += chatters[i] + ", ";
                        }
                        response   += "... jeszcze " + (chatters.Count - 10) + ".";
                        message.msg = response;
                        irc.SendResponse(message);
                    }
                    else
                    {
                        string response = "Widzowie: ";
                        for (int i = 0; i < chatters.Count; i++)
                        {
                            if (i != (chatters.Count - 1))
                            {
                                response += chatters[i] + ", ";
                            }
                            else
                            {
                                response += chatters[i] + ".";
                            }
                        }
                        message.msg = response;
                        irc.SendResponse(message);
                    }
                }
            }
        }
Exemple #2
0
 static public void AddPointsIfOnChannel(string channel)
 {
     if (CheckStream.isRunning(channel))
     {
         List <string> v = Chatters.GetViewers(channel);
         if (v != null)
         {
             for (int i = 0; i < v.Count; i++)
             {
                 addUserIfNotExist(channel, v[i]);
                 addPoints(channel, v[i], 1);
             }
         }
     }
 }