Ejemplo n.º 1
0
        /// <summary>
        /// Called when a user joins the channel
        /// </summary>
        /// <param name="join">JoinEventArgs</param>
        public void CheckJoin(JoinEventArgs join)
        {
            IrcClient irc = join.Data.Irc;

            if (join.Who == irc.Nickname)
            {
                /* Give it 2 seconds after initial channel join */
                Thread.Sleep(2000);
                irc.RfcMode(join.Channel, "+tn");
            }
            else
            {
                /* Check for Ops */
                string UserHost = join.Data.Ident + "@" + join.Data.Host;

                if (ops.GetOpLevel(UserHost) >= 300)
                {
                    irc.Op(join.Channel, join.Who);
                }

                /* Check for greet */
                if (ops.GetOpLevel(UserHost) >= 420 && GreetOn)
                {
                    greet.DoGreet(irc, join.Channel, join.Who);
                }

                /* Check for shitlist */
                if (shits.GetShitLevel(UserHost) >= 100)
                {
                    irc.Ban(join.Channel, UserHost);
                    irc.RfcKick(join.Channel, join.Who, "dId I eVeR sAy yA cAn bE heRe??");
                    irc.RfcNotice(join.Who, "Get The F**K OuT Of MY ChaNneL..");
                }
                else if (shits.GetShitLevel(UserHost) > 0)
                {
                    irc.Deop(join.Channel, join.Who);
                    irc.RfcPrivmsg(join.Channel, "No Ops for " + join.Who + "..");
                }
            }
        }
Ejemplo n.º 2
0
        public static void DoResponse(IrcClient irc, string Channel, string Nick, string Message)
        {
            Random rand     = new Random();
            string Response = "";

            Message = Message.ToLower();

            if (Message.IndexOf("beer") >= 0)
            {
                if (Message.IndexOf("beer for ") >= 0)
                {
                    string TargetNick = Message.Substring(Message.IndexOf("beer for ") + 9);
                    if (TargetNick.IndexOf(' ') >= 0)
                    {
                        TargetNick = TargetNick.Substring(0, TargetNick.IndexOf(' '));
                    }

                    if (TargetNick.ToLower() == "yaself" || TargetNick.ToLower() == "yourself" || TargetNick.ToLower() == irc.Nickname.ToLower())
                    {
                        Response = String.Format(BeerMe[rand.Next(0, BeerMe.Length - 1)], Nick);
                    }
                    else if (TargetNick.ToLower() == "me" || TargetNick.ToLower() == "myself" || TargetNick.ToLower() == Nick.ToLower())
                    {
                        Response = String.Format(Beer[rand.Next(0, Beer.Length - 1)], Nick);
                    }
                    else
                    {
                        IrcUser usr = irc.GetIrcUser(TargetNick);
                        if (usr != null)
                        {
                            Response = String.Format(BeerDelivery[rand.Next(0, BeerDelivery.Length - 1)], usr.Nick, Nick);
                        }
                        else
                        {
                            Response = String.Format("say Such person {0} does not exist, {1}!!", TargetNick, Nick);
                        }
                    }
                }
                else
                {
                    Response = String.Format(Beer[rand.Next(0, Beer.Length - 1)], Nick);
                }
            }
            else if (Message.IndexOf("stupid") >= 0 || Message.IndexOf("lame") >= 0 || Message.IndexOf("poke") >= 0 ||
                     Message.IndexOf("bonk") >= 0 || Message.IndexOf("hit") >= 0 || Message.IndexOf("kick") >= 0 ||
                     Message.IndexOf("dumb") >= 0 || Message.IndexOf("slap") >= 0)
            {
                Response = String.Format(Hit[rand.Next(0, Hit.Length - 1)], Nick);
            }
            else if (Message.IndexOf("kiss") >= 0 || Message.IndexOf("sweet") >= 0 || Message.IndexOf("awesome") >= 0 ||
                     Message.IndexOf("miss") >= 0 || Message.IndexOf("hug") >= 0 || Message.IndexOf("cool") >= 0 ||
                     Message.IndexOf("love") >= 0 || Message.IndexOf("bow") >= 0 || Message.IndexOf("kewl") >= 0 ||
                     Message.IndexOf("god") >= 0 || Message.IndexOf("best") >= 0 || Message.IndexOf("nice") >= 0)
            {
                Response = String.Format(Nice[rand.Next(0, Nice.Length - 1)], Nick);
            }
            else if (Message.IndexOf("thanx") >= 0 || Message.IndexOf("danke") >= 0 || Message.IndexOf("thank") >= 0)
            {
                Response = String.Format(Thanks[rand.Next(0, Thanks.Length - 1)], Nick);
            }
            else if (Message.IndexOf("shut") >= 0 && Message.IndexOf("up") >= 0)
            {
                Response = String.Format(Shutup[rand.Next(0, Shutup.Length - 1)], Nick);
            }
            else if (Message.IndexOf("sorry") >= 0)
            {
                Response = String.Format("say takE iT eaSy, {0}!", Nick);
            }
            else if (Message.IndexOf("f**k") >= 0 || Message.IndexOf("sux") >= 0 || Message.IndexOf("suck") >= 0)
            {
                IrcUser usr = irc.GetIrcUser(Nick);
                if (usr != null)
                {
                    oplist ops = new oplist();
                    ops.Load();
                    if (ops.GetOpLevel(usr.Ident + "@" + usr.Host) <= (int)pubcomm.OpLevel.Op)
                    {
                        irc.RfcKick(Channel, Nick, "nEvEr tRy iT aGaiN!!");
                        return;
                    }
                }

                Response = String.Format("say Plez dOn't Say thaT to mE, {0}!!", Nick);
            }
            else
            {
                Response = String.Format(Default[rand.Next(0, Default.Length - 1)], Nick);
            }

            if (Response.Split(' ')[0] == "say")
            {
                Response = Response.Substring(4);
            }
            else
            {
                Response = "ACTION " + Response.Substring(3) + "";
            }

            irc.RfcPrivmsg(Channel, Response);
        }