Пример #1
0
 private void button4_Click(object sender, EventArgs e)
 {
     AboutBox1 about = new AboutBox1();
     about.ShowDialog();
 }
Пример #2
0
 public override void control(bot ircbot, ref IRCConfig conf, int module_id, string[] line, string command, int nick_access, string nick, string channel, bool bot_command, string type)
 {
     string module_name = ircbot.conf.module_config[module_id][0];
     if (type.Equals("channel") || type.Equals("query") && bot_command == true)
     {
         foreach (List<string> tmp_command in conf.command_list)
         {
             if (module_name.Equals(tmp_command[0]))
             {
                 string[] triggers = tmp_command[3].Split('|');
                 int command_access = Convert.ToInt32(tmp_command[5]);
                 string[] blacklist = tmp_command[6].Split(',');
                 bool blocked = false;
                 bool cmd_found = false;
                 bool spam_check = Convert.ToBoolean(tmp_command[8]);
                 foreach (string bl_chan in blacklist)
                 {
                     if (bl_chan.Equals(channel))
                     {
                         blocked = true;
                         break;
                     }
                 }
                 if (spam_check == true)
                 {
                     blocked = ircbot.get_spam_status(channel, nick);
                 }
                 foreach (string trigger in triggers)
                 {
                     if (trigger.Equals(command))
                     {
                         cmd_found = true;
                         break;
                     }
                 }
                 if (blocked == true && cmd_found == true)
                 {
                     ircbot.sendData("NOTICE", nick + " :I am currently too busy to process that.");
                 }
                 if (blocked == false && cmd_found == true)
                 {
                     foreach (string trigger in triggers)
                     {
                         switch (trigger)
                         {
                             case "about":
                                 if (spam_check == true)
                                 {
                                     ircbot.add_spam_count(channel);
                                 }
                                 if (nick_access >= command_access)
                                 {
                                     AboutBox1 about = new AboutBox1();
                                     string[] owners = conf.owner.TrimStart(',').TrimEnd(',').Split(',');
                                     string owner_num = " is";
                                     if (owners.GetUpperBound(0) > 0)
                                     {
                                         owner_num = "s are";
                                     }
                                     string response = "IRCBot";
                                     if (conf.module_config[module_id][3].Equals("True"))
                                     {
                                         response += " v" + about.AssemblyVersion + ".";
                                     }
                                     if (conf.module_config[module_id][4].Equals("True"))
                                     {
                                         response += " Created by Uncled1023.";
                                     }
                                     if (conf.module_config[module_id][5].Equals("True"))
                                     {
                                         response += " My owner" + owner_num + " ";
                                         if (owners.GetUpperBound(0) > 1)
                                         {
                                             int index = 0;
                                             foreach (string owner in owners)
                                             {
                                                 response += owner;
                                                 if (index == owners.GetUpperBound(0) - 1)
                                                 {
                                                     response += ", and ";
                                                 }
                                                 else if(index < owners.GetUpperBound(0))
                                                 {
                                                     response += ", ";
                                                 }
                                                 index++;
                                             }
                                         }
                                         else
                                         {
                                             response += conf.owner.TrimStart(',').TrimEnd(',').Replace(",", " and ");
                                         }
                                     }
                                     if (type.Equals("channel"))
                                     {
                                         ircbot.sendData("PRIVMSG", channel + " :" + response);
                                     }
                                     else
                                     {
                                         ircbot.sendData("NOTICE", nick + " :" + response);
                                     }
                                 }
                                 else
                                 {
                                     ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                 }
                                 break;
                             case "uptime":
                                 if (spam_check == true)
                                 {
                                     ircbot.add_spam_count(channel);
                                 }
                                 if (nick_access >= command_access)
                                 {
                                     DateTime now = new DateTime();
                                     now = DateTime.Now;
                                     int days = now.Subtract(ircbot.start_time).Days;
                                     int hours = now.Subtract(ircbot.start_time).Hours;
                                     int minutes = now.Subtract(ircbot.start_time).Minutes;
                                     int seconds = now.Subtract(ircbot.start_time).Seconds;
                                     string uptime = "";
                                     if (days > 0)
                                     {
                                         uptime += days + " days, ";
                                     }
                                     if (hours > 0)
                                     {
                                         uptime += hours + " hours, ";
                                     }
                                     if (minutes > 0)
                                     {
                                         uptime += minutes + " minutes, ";
                                     }
                                     if (seconds > 0)
                                     {
                                         uptime += seconds + " seconds, ";
                                     }
                                     if (type.Equals("channel"))
                                     {
                                         ircbot.sendData("PRIVMSG", channel + " :I have been online for " + uptime.Trim().TrimEnd(','));
                                     }
                                     else
                                     {
                                         ircbot.sendData("NOTICE", nick + " :I have been online for " + uptime.Trim().TrimEnd(','));
                                     }
                                 }
                                 else
                                 {
                                     ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                 }
                                 break;
                         }
                     }
                 }
             }
         }
     }
 }
Пример #3
0
 private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
 {
     AboutBox1 AboutForm = new AboutBox1();
     AboutForm.ShowDialog();
     AboutForm.Dispose();
 }
Пример #4
0
 public override void control(bot ircbot, ref IRCConfig conf, int module_id, string[] line, string command, int nick_access, string nick, string channel, bool bot_command, string type)
 {
     string module_name = ircbot.conf.module_config[module_id][0];
     if (type.Equals("channel") && bot_command == true)
     {
         foreach (List<string> tmp_command in conf.command_list)
         {
             if (module_name.Equals(tmp_command[0]))
             {
                 string[] triggers = tmp_command[3].Split('|');
                 int command_access = Convert.ToInt32(tmp_command[5]);
                 string[] blacklist = tmp_command[6].Split(',');
                 bool blocked = false;
                 bool cmd_found = false;
                 bool spam_check = Convert.ToBoolean(tmp_command[8]);
                 foreach (string bl_chan in blacklist)
                 {
                     if (bl_chan.Equals(channel))
                     {
                         blocked = true;
                         break;
                     }
                 }
                 if (spam_check == true)
                 {
                     blocked = ircbot.get_spam_status(channel, nick);
                 }
                 foreach (string trigger in triggers)
                 {
                     if (trigger.Equals(command))
                     {
                         cmd_found = true;
                         break;
                     }
                 }
                 if (blocked == true && cmd_found == true)
                 {
                     ircbot.sendData("NOTICE", nick + " :I am currently too busy to process that.");
                 }
                 if (blocked == false && cmd_found == true)
                 {
                     foreach (string trigger in triggers)
                     {
                         switch (trigger)
                         {
                             case "stopchat":
                                 if (spam_check == true)
                                 {
                                     ircbot.add_spam_count(channel);
                                 }
                                 if (nick_access >= command_access)
                                 {
                                     foreach (string chat_nick in chatting_nick)
                                     {
                                         if (chat_nick.Equals(nick))
                                         {
                                             still_chatting = false;
                                             chatting_nick.Clear();
                                             chat_time.Enabled = false;
                                             chat_time.Stop();
                                             ircbot.sendData("PRIVMSG", channel + " :Ok, I will stop.");
                                             break;
                                         }
                                     }
                                     if (still_chatting == true)
                                     {
                                         ircbot.sendData("PRIVMSG", channel + " :You are not currently talking to me.");
                                     }
                                 }
                                 else
                                 {
                                     ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                 }
                                 break;
                         }
                     }
                 }
             }
         }
     }
     if (type.Equals("channel") && bot_command == false)
     {
         chat_time.Interval = Convert.ToInt32(conf.module_config[module_id][3]) * 1000;
         if (line.GetUpperBound(0) >= 3)
         {
             string msg = "";
             if (line.GetUpperBound(0) > 3)
             {
                 msg = line[3].TrimStart(':') + " " + line[4];
             }
             else
             {
                 msg = line[3].TrimStart(':');
             }
             string[] words = msg.Split(' ');
             bool me_in = false;
             foreach (string word in words)
             {
                 if (word.ToLower().Contains(conf.nick.ToLower()))
                 {
                     me_in = true;
                     break;
                 }
             }
             if (me_in == true || still_chatting == true)
             {
                 bool nick_found = false;
                 for (int x = 0; x < chatting_nick.Count(); x++)
                 {
                     if (chatting_nick[x].Equals(nick))
                     {
                         nick_found = true;
                     }
                 }
                 if (me_in == true && nick_found == false)
                 {
                     chatting_nick.Add(nick);
                     nick_found = true;
                 }
                 if (nick_found == true)
                 {
                     // Start Chatting
                     still_chatting = false;
                     chat_time.Stop();
                     Request r = new Request(msg, myUser, myBot);
                     Result res = myBot.Chat(r);
                     AboutBox1 about = new AboutBox1();
                     ircbot.sendData("PRIVMSG", channel + " :" + res.Output.Replace("[nick]", nick).Replace("[me]", conf.nick).Replace("[owner]", conf.owner.TrimStart(',').TrimEnd(',').Replace(",", " and ")).Replace("[version]", about.AssemblyVersion).Replace("\n", " "));
                     chat_time.Start();
                     still_chatting = true;
                 }
             }
         }
     }
 }
Пример #5
0
 private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
 {
     var tmpAbout = new AboutBox1();
     tmpAbout.ShowDialog();
 }
Пример #6
0
 private void label6_Click(object sender, EventArgs e)
 {
     AboutBox1 guanyu = new AboutBox1();
     guanyu.Show();
 }
Пример #7
0
 private void mnuAboutNotepad_Click(object sender, EventArgs e)
 {
     AboutBox1 abtBox = new AboutBox1();
     abtBox.Show();
 }
Пример #8
0
        private void oProgramieToolStripMenuItem_Click_1(object sender, EventArgs e)
        {
            AboutBox1 about = new AboutBox1();

            about.ShowDialog();
        }
Пример #9
0
        private void ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AboutBox1 ab = new AboutBox1();

            ab.ShowDialog();
        }
Пример #10
0
        public override void control(bot ircbot, ref IRCConfig conf, int module_id, string[] line, string command, int nick_access, string nick, string channel, bool bot_command, string type)
        {
            string module_name = ircbot.conf.module_config[module_id][0];

            if (type.Equals("channel") && bot_command == true)
            {
                foreach (List <string> tmp_command in conf.command_list)
                {
                    if (module_name.Equals(tmp_command[0]))
                    {
                        string[] triggers       = tmp_command[3].Split('|');
                        int      command_access = Convert.ToInt32(tmp_command[5]);
                        string[] blacklist      = tmp_command[6].Split(',');
                        bool     blocked        = false;
                        bool     cmd_found      = false;
                        bool     spam_check     = Convert.ToBoolean(tmp_command[8]);
                        foreach (string bl_chan in blacklist)
                        {
                            if (bl_chan.Equals(channel))
                            {
                                blocked = true;
                                break;
                            }
                        }
                        if (spam_check == true)
                        {
                            blocked = ircbot.get_spam_status(channel, nick);
                        }
                        foreach (string trigger in triggers)
                        {
                            if (trigger.Equals(command))
                            {
                                cmd_found = true;
                                break;
                            }
                        }
                        if (blocked == true && cmd_found == true)
                        {
                            ircbot.sendData("NOTICE", nick + " :I am currently too busy to process that.");
                        }
                        if (blocked == false && cmd_found == true)
                        {
                            foreach (string trigger in triggers)
                            {
                                switch (trigger)
                                {
                                case "stopchat":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= command_access)
                                    {
                                        foreach (string chat_nick in chatting_nick)
                                        {
                                            if (chat_nick.Equals(nick))
                                            {
                                                still_chatting = false;
                                                chatting_nick.Clear();
                                                chat_time.Enabled = false;
                                                chat_time.Stop();
                                                ircbot.sendData("PRIVMSG", channel + " :Ok, I will stop.");
                                                break;
                                            }
                                        }
                                        if (still_chatting == true)
                                        {
                                            ircbot.sendData("PRIVMSG", channel + " :You are not currently talking to me.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            if (type.Equals("channel") && bot_command == false)
            {
                chat_time.Interval = Convert.ToInt32(conf.module_config[module_id][3]) * 1000;
                if (line.GetUpperBound(0) >= 3)
                {
                    string msg = "";
                    if (line.GetUpperBound(0) > 3)
                    {
                        msg = line[3].TrimStart(':') + " " + line[4];
                    }
                    else
                    {
                        msg = line[3].TrimStart(':');
                    }
                    string[] words = msg.Split(' ');
                    bool     me_in = false;
                    foreach (string word in words)
                    {
                        if (word.ToLower().Contains(conf.nick.ToLower()))
                        {
                            me_in = true;
                            break;
                        }
                    }
                    if (me_in == true || still_chatting == true)
                    {
                        bool nick_found = false;
                        for (int x = 0; x < chatting_nick.Count(); x++)
                        {
                            if (chatting_nick[x].Equals(nick))
                            {
                                nick_found = true;
                            }
                        }
                        if (me_in == true && nick_found == false)
                        {
                            chatting_nick.Add(nick);
                            nick_found = true;
                        }
                        if (nick_found == true)
                        {
                            // Start Chatting
                            still_chatting = false;
                            chat_time.Stop();
                            Request   r     = new Request(msg, myUser, myBot);
                            Result    res   = myBot.Chat(r);
                            AboutBox1 about = new AboutBox1();
                            ircbot.sendData("PRIVMSG", channel + " :" + res.Output.Replace("[nick]", nick).Replace("[me]", conf.nick).Replace("[owner]", conf.owner.TrimStart(',').TrimEnd(',').Replace(",", " and ")).Replace("[version]", about.AssemblyVersion).Replace("\n", " "));
                            chat_time.Start();
                            still_chatting = true;
                        }
                    }
                }
            }
        }
Пример #11
0
 public override void control(bot ircbot, ref IRCConfig conf, int module_id, string[] line, string command, int nick_access, string nick, string channel, bool bot_command, string type)
 {
     string module_name = ircbot.conf.module_config[module_id][0];
     if (type.Equals("channel") && bot_command == true)
     {
         foreach (List<string> tmp_command in conf.command_list)
         {
             if (module_name.Equals(tmp_command[0]))
             {
                 string[] triggers = tmp_command[3].Split('|');
                 int command_access = Convert.ToInt32(tmp_command[5]);
                 string[] blacklist = tmp_command[6].Split(',');
                 bool blocked = false;
                 bool cmd_found = false;
                 bool spam_check = Convert.ToBoolean(tmp_command[8]);
                 foreach (string bl_chan in blacklist)
                 {
                     if (bl_chan.Equals(channel))
                     {
                         blocked = true;
                         break;
                     }
                 }
                 if (spam_check == true)
                 {
                     blocked = ircbot.get_spam_status(channel, nick);
                 }
                 foreach (string trigger in triggers)
                 {
                     if (trigger.Equals(command))
                     {
                         cmd_found = true;
                         break;
                     }
                 }
                 if (blocked == true && cmd_found == true)
                 {
                     ircbot.sendData("NOTICE", nick + " :I am currently too busy to process that.");
                 }
                 if (blocked == false && cmd_found == true)
                 {
                     foreach (string trigger in triggers)
                     {
                         switch (trigger)
                         {
                             case "ver":
                                 if (spam_check == true)
                                 {
                                     ircbot.add_spam_count(channel);
                                 }
                                 if (nick_access >= command_access)
                                 {
                                     if (line.GetUpperBound(0) > 3)
                                     {
                                         ircbot.sendData("PRIVMSG", line[4].Trim().ToLower() + " :\u0001VERSION\u0001");
                                         List<string> tmp_list = new List<string>();
                                         tmp_list.Add(line[4].Trim().ToLower());
                                         tmp_list.Add(channel);
                                         version_list.Add(tmp_list);
                                     }
                                     else
                                     {
                                         ircbot.sendData("NOTICE", nick + " :" + nick + ", you need to include more info.");
                                     }
                                 }
                                 else
                                 {
                                     ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                 }
                                 break;
                         }
                     }
                 }
             }
         }
     }
     if (type.Equals("query"))
     {
         string version = ":\u0001VERSION\u0001";
         if (line[3] == version)
         {
             AboutBox1 about = new AboutBox1();
             ircbot.sendData("NOTICE", nick + " :\u0001VERSION IRCBot v" + about.AssemblyVersion + " on " + conf.module_config[module_id][3] + "\u0001");
         }
     }
     if (type.Equals("line"))
     {
         string version_reply = ":\u0001VERSION";
         if (line.GetUpperBound(0) > 3)
         {
             if (line[3].Equals(version_reply))
             {
                 for (int x = 0; x < version_list.Count(); x++)
                 {
                     if (version_list[x][0].Equals(nick))
                     {
                         string response = "[" + nick + "] Using version: " + line[4].Replace("\u0001", "");
                         ircbot.sendData("PRIVMSG", version_list[x][1] + " :" + response);
                         version_list.RemoveAt(x);
                         break;
                     }
                 }
             }
         }
     }
 }
Пример #12
0
        public override void control(bot ircbot, ref IRCConfig conf, int module_id, string[] line, string command, int nick_access, string nick, string channel, bool bot_command, string type)
        {
            string module_name = ircbot.conf.module_config[module_id][0];

            if (type.Equals("channel") || type.Equals("query") && bot_command == true)
            {
                foreach (List <string> tmp_command in conf.command_list)
                {
                    if (module_name.Equals(tmp_command[0]))
                    {
                        string[] triggers       = tmp_command[3].Split('|');
                        int      command_access = Convert.ToInt32(tmp_command[5]);
                        string[] blacklist      = tmp_command[6].Split(',');
                        bool     blocked        = false;
                        bool     cmd_found      = false;
                        bool     spam_check     = Convert.ToBoolean(tmp_command[8]);
                        foreach (string bl_chan in blacklist)
                        {
                            if (bl_chan.Equals(channel))
                            {
                                blocked = true;
                                break;
                            }
                        }
                        if (spam_check == true)
                        {
                            blocked = ircbot.get_spam_status(channel, nick);
                        }
                        foreach (string trigger in triggers)
                        {
                            if (trigger.Equals(command))
                            {
                                cmd_found = true;
                                break;
                            }
                        }
                        if (blocked == true && cmd_found == true)
                        {
                            ircbot.sendData("NOTICE", nick + " :I am currently too busy to process that.");
                        }
                        if (blocked == false && cmd_found == true)
                        {
                            foreach (string trigger in triggers)
                            {
                                switch (trigger)
                                {
                                case "about":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= command_access)
                                    {
                                        AboutBox1 about     = new AboutBox1();
                                        string[]  owners    = conf.owner.TrimStart(',').TrimEnd(',').Split(',');
                                        string    owner_num = " is";
                                        if (owners.GetUpperBound(0) > 0)
                                        {
                                            owner_num = "s are";
                                        }
                                        string response = "IRCBot";
                                        if (conf.module_config[module_id][3].Equals("True"))
                                        {
                                            response += " v" + about.AssemblyVersion + ".";
                                        }
                                        if (conf.module_config[module_id][4].Equals("True"))
                                        {
                                            response += " Created by Uncled1023.";
                                        }
                                        if (conf.module_config[module_id][5].Equals("True"))
                                        {
                                            response += " My owner" + owner_num + " ";
                                            if (owners.GetUpperBound(0) > 1)
                                            {
                                                int index = 0;
                                                foreach (string owner in owners)
                                                {
                                                    response += owner;
                                                    if (index == owners.GetUpperBound(0) - 1)
                                                    {
                                                        response += ", and ";
                                                    }
                                                    else if (index < owners.GetUpperBound(0))
                                                    {
                                                        response += ", ";
                                                    }
                                                    index++;
                                                }
                                            }
                                            else
                                            {
                                                response += conf.owner.TrimStart(',').TrimEnd(',').Replace(",", " and ");
                                            }
                                        }
                                        if (type.Equals("channel"))
                                        {
                                            ircbot.sendData("PRIVMSG", channel + " :" + response);
                                        }
                                        else
                                        {
                                            ircbot.sendData("NOTICE", nick + " :" + response);
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;

                                case "uptime":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= command_access)
                                    {
                                        DateTime now = new DateTime();
                                        now = DateTime.Now;
                                        int    days    = now.Subtract(ircbot.start_time).Days;
                                        int    hours   = now.Subtract(ircbot.start_time).Hours;
                                        int    minutes = now.Subtract(ircbot.start_time).Minutes;
                                        int    seconds = now.Subtract(ircbot.start_time).Seconds;
                                        string uptime  = "";
                                        if (days > 0)
                                        {
                                            uptime += days + " days, ";
                                        }
                                        if (hours > 0)
                                        {
                                            uptime += hours + " hours, ";
                                        }
                                        if (minutes > 0)
                                        {
                                            uptime += minutes + " minutes, ";
                                        }
                                        if (seconds > 0)
                                        {
                                            uptime += seconds + " seconds, ";
                                        }
                                        if (type.Equals("channel"))
                                        {
                                            ircbot.sendData("PRIVMSG", channel + " :I have been online for " + uptime.Trim().TrimEnd(','));
                                        }
                                        else
                                        {
                                            ircbot.sendData("NOTICE", nick + " :I have been online for " + uptime.Trim().TrimEnd(','));
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                }
                            }
                        }
                    }
                }
            }
        }
Пример #13
0
        private void aboutToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            var ab = new AboutBox1();

            ab.Show();
        }
Пример #14
0
		private void tsmiHelp_Click(object sender, EventArgs e)
		{
			var about = new AboutBox1();
			about.ShowDialog(this);
		}
Пример #15
0
        private void toolStripButton16_Click(object sender, EventArgs e)
        {
            AboutBox1 frm = new AboutBox1();

            frm.ShowDialog();
        }
Пример #16
0
        private void оПрограммеToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AboutBox1 about = new AboutBox1();

            about.Show();
        }