コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        public pubcomm(bool SafeMode)
        {
            this.SafeMode = SafeMode;

            ops = new oplist();
            ops.Load();
            shits = new shitlist();
            shits.Load();
            topics = new topic();
            topics.Load();
            songs = new album();
            songs.Load();
            insults = new insult();
            insults.Load();
        }
コード例 #2
0
ファイル: response.cs プロジェクト: jsh139/PowEr
        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);
        }