Example #1
0
        public void run_command(string server_name, string nick, string channel, string command, string[] args)
        {
            bool bot_command = true;

            char[] charSeparator = new char[] { ' ' };
            string type          = "channel";
            string msg           = "";

            if (!channel.StartsWith("#"))
            {
                type = "query";
            }
            bot bot = get_bot_instance(server_name);

            if (bot != null)
            {
                if (args != null)
                {
                    foreach (string arg in args)
                    {
                        msg += " " + arg;
                    }
                }
                string   line = ":" + nick + " PRIVMSG " + channel + " :" + bot.Conf.Command + command + msg;
                string[] ex   = line.Split(charSeparator, 5);
                //Run Enabled Modules
                foreach (Bot.Modules.Module module in bot.Conf.Modules)
                {
                    if (module.Loaded)
                    {
                        module.control(bot, bot.Conf, ex, command, bot.get_nick_access(nick, channel), nick, channel, bot_command, type);
                    }
                }
            }
        }
Example #2
0
        public override void control(bot ircbot, BotConfig Conf, string[] line, string command, int nick_access, string nick, string channel, bool bot_command, string type)
        {
            if (type.Equals("channel") && bot_command == true)
            {
                foreach (Command tmp_command in this.Commands)
                {
                    bool blocked = tmp_command.Blacklist.Contains(channel) || tmp_command.Blacklist.Contains(nick);
                    bool cmd_found = false;
                    bool spam_check = ircbot.get_spam_check(channel, nick, tmp_command.Spam_Check);
                    if (spam_check == true)
                    {
                        blocked = blocked || ircbot.get_spam_status(channel);
                    }
                    cmd_found = tmp_command.Triggers.Contains(command);
                    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 tmp_command.Triggers)
                        {
                            switch (trigger)
                            {
                                case "hbomb":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        Modules.idle idle = (Modules.idle)ircbot.get_module("idle");
                                        if (idle.check_idle(nick) == false)
                                        {
                                            bool hbomb_active = false;
                                            hbomb_info tmp_info = new hbomb_info();
                                            foreach (hbomb_info bomb in hbombs)
                                            {
                                                if (bomb.bomb_channel.Equals(channel))
                                                {
                                                    tmp_info = bomb;
                                                    hbomb_active = true;
                                                    break;
                                                }
                                            }
                                            if (hbomb_active == false)
                                            {
                                                tmp_info.bomb_locked = false;
                                                tmp_info.bomb_trigger = new System.Timers.Timer();
                                                tmp_info.wire_colors = this.Options["wire_colors"].Split(',');
                                                tmp_info.bomb_channel = channel;

                                                Random random_color = new Random();
                                                int color_index = random_color.Next(0, tmp_info.wire_colors.GetUpperBound(0) + 1);
                                                tmp_info.wire_color = tmp_info.wire_colors[color_index];

                                                Random random = new Random();
                                                int index = random.Next(10, 60);

                                                tmp_info.bomb_trigger.Elapsed += (System, EventArgs) => activate_bomb(channel);
                                                tmp_info.bomb_trigger.Interval = (index * 1000);
                                                tmp_info.bomb_trigger.Enabled = true;
                                                tmp_info.bomb_trigger.AutoReset = false;

                                                main = ircbot;

                                                tmp_info.previous_bomb_holder = nick;
                                                tmp_info.bomb_holder = nick;

                                                ircbot.sendData("PRIVMSG", channel + " :" + nick + " has started the timer!  If the bomb gets passed to you, type " + ircbot.Conf.Command + "pass <nick> to pass it to someone else, or type " + ircbot.Conf.Command + "defuse <color> to try to defuse it.");
                                                string colors = "";
                                                foreach (string wire in tmp_info.wire_colors)
                                                {
                                                    colors += wire + ",";
                                                }
                                                ircbot.sendData("NOTICE", nick + " :You need to hurry and pass the bomb before it blows up!  Or you can try to defuse it yourself.  The colors are: " + colors.TrimEnd(','));
                                                hbombs.Add(tmp_info);
                                            }
                                            else
                                            {
                                                if (tmp_info.bomb_channel.Equals(channel))
                                                {
                                                    ircbot.sendData("PRIVMSG", channel + " :There is already a bomb counting down.");
                                                }
                                                else
                                                {
                                                    ircbot.sendData("PRIVMSG", line[2] + " :There is already a bomb counting down in " + tmp_info.bomb_channel + ".");
                                                }
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", channel + " :You can not start a HBomb when you are idle.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "pass":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        int index = 0;
                                        bool hbomb_active = false;
                                        hbomb_info tmp_info = new hbomb_info();
                                        foreach (hbomb_info bomb in hbombs)
                                        {
                                            if (bomb.bomb_channel.Equals(channel))
                                            {
                                                tmp_info = bomb;
                                                hbomb_active = true;
                                                break;
                                            }
                                            index++;
                                        }
                                        if (hbomb_active == true)
                                        {
                                            if (!tmp_info.bomb_locked)
                                            {
                                                Modules.idle idle = (Modules.idle)ircbot.get_module("idle");
                                                if (idle.check_idle(nick) == false)
                                                {
                                                    if (tmp_info.bomb_holder.Equals(nick, StringComparison.InvariantCultureIgnoreCase))
                                                    {
                                                        if (line.GetUpperBound(0) > 3)
                                                        {
                                                            if (line[4].Trim().Equals(ircbot.Nick, StringComparison.InvariantCultureIgnoreCase))
                                                            {
                                                                ircbot.sendData("PRIVMSG", channel + " :" + nick + ", you can't pass it to me!");
                                                            }
                                                            else
                                                            {
                                                                int user_access = ircbot.get_nick_access(line[4].Trim(), channel);
                                                                if (user_access > 0 && idle.check_idle(line[4].Trim()) == false)
                                                                {
                                                                    pass_hbomb(line[4].Trim(), channel, nick, ircbot, Conf, ref tmp_info, index);
                                                                }
                                                                else
                                                                {
                                                                    ircbot.sendData("PRIVMSG", channel + " :" + nick + ", you can't pass to them!");
                                                                }
                                                            }
                                                        }
                                                        else
                                                        {
                                                            ircbot.sendData("PRIVMSG", channel + " :" + nick + ", you need to pass the bomb to someone.");
                                                        }
                                                    }
                                                    else
                                                    {
                                                        ircbot.sendData("PRIVMSG", channel + " :You don't have the bomb!");
                                                    }
                                                }
                                                else
                                                {
                                                    ircbot.sendData("PRIVMSG", channel + " :You can not pass the HBomb when you are idle.");
                                                }
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", channel + " :You can not pass a locked bomb.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", channel + " :There isn't a bomb to pass!");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "set_bomb":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        int index = 0;
                                        bool hbomb_active = false;
                                        hbomb_info tmp_info = new hbomb_info();
                                        foreach (hbomb_info bomb in hbombs)
                                        {
                                            if (bomb.bomb_channel.Equals(channel))
                                            {
                                                tmp_info = bomb;
                                                hbomb_active = true;
                                                break;
                                            }
                                            index++;
                                        }
                                        if (hbomb_active == true)
                                        {
                                            if (line.GetUpperBound(0) > 3)
                                            {
                                                if (line[4].Trim().Equals(ircbot.Nick, StringComparison.InvariantCultureIgnoreCase))
                                                {
                                                    ircbot.sendData("PRIVMSG", channel + " :" + nick + ", you can't pass it to me!");
                                                }
                                                else
                                                {
                                                    int user_access = ircbot.get_nick_access(line[4].Trim(), channel);
                                                    if (user_access > 0)
                                                    {
                                                        pass_hbomb(line[4].Trim(), channel, nick, ircbot, Conf, ref tmp_info, index);
                                                    }
                                                    else
                                                    {
                                                        ircbot.sendData("PRIVMSG", channel + " :" + nick + ", that user isn't online!");
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", channel + " :" + nick + ", you need to pass the bomb to someone.");
                                            }

                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", channel + " :There isn't a bomb to pass!");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "lock_bomb":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        int index = 0;
                                        bool hbomb_active = false;
                                        hbomb_info tmp_info = new hbomb_info();
                                        foreach (hbomb_info bomb in hbombs)
                                        {
                                            if (bomb.bomb_channel.Equals(channel))
                                            {
                                                tmp_info = bomb;
                                                hbomb_active = true;
                                                break;
                                            }
                                            index++;
                                        }
                                        if (hbomb_active == true)
                                        {
                                            if (line.GetUpperBound(0) > 3)
                                            {
                                                if (line[4].Trim().Equals(ircbot.Nick, StringComparison.InvariantCultureIgnoreCase))
                                                {
                                                    ircbot.sendData("PRIVMSG", channel + " :" + nick + ", you can't pass it to me!");
                                                }
                                                else
                                                {
                                                    int user_access = ircbot.get_nick_access(line[4].Trim(), channel);
                                                    if (user_access > 0)
                                                    {
                                                        pass_hbomb(line[4].Trim(), channel, nick, ircbot, Conf, ref tmp_info, index);
                                                        tmp_info.bomb_locked = true;
                                                    }
                                                    else
                                                    {
                                                        ircbot.sendData("PRIVMSG", channel + " :" + nick + ", that user isn't online!");
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                tmp_info.bomb_locked = true;
                                            }
                                            hbombs[index] = tmp_info;
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", channel + " :There isn't a bomb to lock!");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "unlock_bomb":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        int index = 0;
                                        bool hbomb_active = false;
                                        hbomb_info tmp_info = new hbomb_info();
                                        foreach (hbomb_info bomb in hbombs)
                                        {
                                            if (bomb.bomb_channel.Equals(channel))
                                            {
                                                tmp_info = bomb;
                                                hbomb_active = true;
                                                break;
                                            }
                                            index++;
                                        }
                                        if (hbomb_active == true)
                                        {
                                            tmp_info.bomb_locked = false;
                                            hbombs[index] = tmp_info;
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", channel + " :There isn't a bomb to unlock!");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "detonate":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        bool hbomb_active = false;
                                        foreach (hbomb_info bomb in hbombs)
                                        {
                                            if (bomb.bomb_channel.Equals(channel))
                                            {
                                                hbomb_active = true;
                                                break;
                                            }
                                        }
                                        if (hbomb_active == true)
                                        {
                                            main = ircbot;
                                            activate_bomb(channel);
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", channel + " :There isn't a bomb to blow up!");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "stop_bomb":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        int index = 0;
                                        bool hbomb_active = false;
                                        hbomb_info tmp_info = new hbomb_info();
                                        foreach (hbomb_info bomb in hbombs)
                                        {
                                            if (bomb.bomb_channel.Equals(channel))
                                            {
                                                tmp_info = bomb;
                                                hbomb_active = true;
                                                break;
                                            }
                                            index++;
                                        }
                                        if (hbomb_active == true)
                                        {
                                            hbombs.RemoveAt(index);
                                            ircbot.sendData("PRIVMSG", channel + " :Bomb has been defused and thrown away.");
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", channel + " :There isn't a bomb to stop!");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "defuse":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        int index = 0;
                                        bool hbomb_active = false;
                                        hbomb_info tmp_info = new hbomb_info();
                                        foreach (hbomb_info bomb in hbombs)
                                        {
                                            if (bomb.bomb_channel.Equals(channel))
                                            {
                                                tmp_info = bomb;
                                                hbomb_active = true;
                                                break;
                                            }
                                            index++;
                                        }
                                        if (hbomb_active == true)
                                        {
                                            if (!tmp_info.bomb_locked)
                                            {
                                                Modules.idle idle = (Modules.idle)ircbot.get_module("idle");
                                                if (idle.check_idle(nick) == false)
                                                {
                                                    if (tmp_info.bomb_holder.Equals(nick, StringComparison.InvariantCultureIgnoreCase))
                                                    {
                                                        if (line.GetUpperBound(0) > 3)
                                                        {
                                                            if (line[4].Trim().Equals(tmp_info.wire_color, StringComparison.InvariantCultureIgnoreCase))
                                                            {
                                                                ircbot.sendData("PRIVMSG", channel + " :You have successfully defused the bomb!");
                                                                if (tmp_info.previous_bomb_holder.Equals(tmp_info.bomb_holder))
                                                                {
                                                                }
                                                                else
                                                                {
                                                                    ircbot.sendData("KICK", tmp_info.bomb_channel + " " + tmp_info.previous_bomb_holder + " :BOOM!!!");
                                                                }
                                                                hbombs.RemoveAt(index);
                                                            }
                                                            else
                                                            {
                                                                main = ircbot;
                                                                activate_bomb(channel);
                                                            }
                                                        }
                                                        else
                                                        {
                                                            ircbot.sendData("PRIVMSG", channel + " :" + nick + ", you need to cut a wire.");
                                                        }
                                                    }
                                                    else
                                                    {
                                                        ircbot.sendData("PRIVMSG", channel + " :You don't have the bomb!");
                                                    }
                                                }
                                                else
                                                {
                                                    ircbot.sendData("PRIVMSG", channel + " :You can not defuse the HBomb when you are idle.");
                                                }
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", channel + " :You can not defuse the HBomb when it is locked.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", channel + " :There isn't a bomb to defuse!");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                            }
                        }
                    }
                }
            }
        }
Example #3
0
 public override void control(bot ircbot, BotConfig Conf, string[] line, string command, int nick_access, string nick, string channel, bool bot_command, string type)
 {
     if ((type.Equals("channel") || type.Equals("query")) && bot_command == true)
     {
         foreach (Command tmp_command in this.Commands)
         {
             bool blocked = tmp_command.Blacklist.Contains(channel) || tmp_command.Blacklist.Contains(nick);
             bool cmd_found = false;
             bool spam_check = ircbot.get_spam_check(channel, nick, tmp_command.Spam_Check);
             if (spam_check == true)
             {
                 blocked = blocked || ircbot.get_spam_status(channel);
             }
             cmd_found = tmp_command.Triggers.Contains(command);
             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 tmp_command.Triggers)
                 {
                     switch (trigger)
                     {
                         case "setaccess":
                             if (spam_check == true)
                             {
                                 ircbot.add_spam_count(channel);
                             }
                             if (nick_access >= tmp_command.Access)
                             {
                                 if (line.GetUpperBound(0) > 3)
                                 {
                                     string[] parse = line[4].Split(' ');
                                     if (type.Equals("query") && parse.GetUpperBound(0) > 1)
                                     {
                                         if (Convert.ToInt32(parse[2]) <= nick_access)
                                         {
                                             set_access_list(parse[0].Trim(), parse[1], parse[2], ircbot);
                                             ircbot.sendData("NOTICE", nick + " :" + parse[0].Trim() + " has been added to access level " + parse[2]);
                                         }
                                         else
                                         {
                                             ircbot.sendData("NOTICE", nick + " :You do not have permission to change their access.");
                                         }
                                     }
                                     else if (type.Equals("channel") && parse.GetUpperBound(0) > 0)
                                     {
                                         if (Convert.ToInt32(parse[1]) <= nick_access)
                                         {
                                             set_access_list(parse[0].Trim(), channel, parse[1], ircbot);
                                             ircbot.sendData("NOTICE", nick + " :" + parse[0].Trim() + " has been added to access level " + parse[1]);
                                         }
                                         else
                                         {
                                             ircbot.sendData("NOTICE", nick + " :You do not have permission to change their access.");
                                         }
                                     }
                                     else
                                     {
                                         ircbot.sendData("NOTICE", nick + " :" + nick + ", you need to include more info.");
                                     }
                                 }
                                 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;
                         case "delaccess":
                             if (spam_check == true)
                             {
                                 ircbot.add_spam_count(channel);
                             }
                             if (nick_access >= tmp_command.Access)
                             {
                                 if (line.GetUpperBound(0) > 3)
                                 {
                                     string[] parse = line[4].Split(' ');
                                     if (type.Equals("query") && parse.GetUpperBound(0) > 1)
                                     {
                                         if (Convert.ToInt32(parse[2]) <= nick_access)
                                         {
                                             del_access_list(parse[0].Trim(), parse[1], parse[2], ircbot);
                                             ircbot.sendData("NOTICE", nick + " :" + parse[0].Trim() + " has been removed from access level " + parse[2]);
                                         }
                                         else
                                         {
                                             ircbot.sendData("NOTICE", nick + " :You do not have permission to change their access.");
                                         }
                                     }
                                     else if (type.Equals("channel") && parse.GetUpperBound(0) > 0)
                                     {
                                         if (Convert.ToInt32(parse[1]) <= nick_access)
                                         {
                                             del_access_list(parse[0].Trim(), channel, parse[1], ircbot);
                                             ircbot.sendData("NOTICE", nick + " :" + parse[0].Trim() + " has been removed from access level " + parse[1]);
                                         }
                                         else
                                         {
                                             ircbot.sendData("NOTICE", nick + " :You do not have permission to change their access.");
                                         }
                                     }
                                     else
                                     {
                                         ircbot.sendData("NOTICE", nick + " :" + nick + ", you need to include more info.");
                                     }
                                 }
                                 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;
                         case "listaccess":
                             if (spam_check == true)
                             {
                                 ircbot.add_spam_count(channel);
                             }
                             if (nick_access >= tmp_command.Access)
                             {
                                 if (type.Equals("query") && line.GetUpperBound(0) > 3)
                                 {
                                     list_access_list(nick, line[4], ircbot);
                                 }
                                 else if (type.Equals("channel"))
                                 {
                                     list_access_list(nick, channel, ircbot);
                                 }
                                 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;
                         case "getaccess":
                             if (spam_check == true)
                             {
                                 ircbot.add_spam_count(channel);
                             }
                             if (nick_access >= tmp_command.Access)
                             {
                                 if (line.GetUpperBound(0) > 3)
                                 {
                                     string[] new_line = line[4].Split(' ');
                                     if (new_line.GetUpperBound(0) > 0 && new_line[0].StartsWith("#"))
                                     {
                                         int viewed_access = ircbot.get_nick_access(new_line[1].Trim(), new_line[0].Trim());
                                         ircbot.sendData("NOTICE", nick + " :" + new_line[1].Trim() + " has access level " + viewed_access.ToString());
                                     }
                                     else if (type.Equals("channel"))
                                     {
                                         int viewed_access = ircbot.get_nick_access(line[4].Trim(), channel);
                                         ircbot.sendData("NOTICE", nick + " :" + line[4].Trim() + " has access level " + viewed_access.ToString());
                                     }
                                     else
                                     {
                                         int viewed_access = Conf.Default_Level;
                                         foreach (Channel_Info chan in Conf.Channel_List)
                                         {
                                             int tmp_nick_access = ircbot.get_nick_access(line[4].Trim(), chan.Channel);
                                             if (tmp_nick_access > viewed_access)
                                             {
                                                 viewed_access = tmp_nick_access;
                                             }
                                         }
                                         ircbot.sendData("NOTICE", nick + " :" + line[4].Trim() + " has access level " + viewed_access.ToString());
                                     }
                                 }
                                 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;
                     }
                 }
             }
         }
     }
 }
Example #4
0
        public override void control(bot ircbot, BotConfig Conf, string[] line, string command, int nick_access, string nick, string channel, bool bot_command, string type)
        {
            if ((type.Equals("channel") || type.Equals("query")) && bot_command == true)
            {
                foreach (Command tmp_command in this.Commands)
                {
                    bool blocked    = tmp_command.Blacklist.Contains(channel) || tmp_command.Blacklist.Contains(nick);
                    bool cmd_found  = false;
                    bool spam_check = ircbot.get_spam_check(channel, nick, tmp_command.Spam_Check);
                    if (spam_check == true)
                    {
                        blocked = blocked || ircbot.get_spam_status(channel);
                    }
                    cmd_found = tmp_command.Triggers.Contains(command);
                    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 tmp_command.Triggers)
                        {
                            switch (trigger)
                            {
                            case "setaccess":
                                if (spam_check == true)
                                {
                                    ircbot.add_spam_count(channel);
                                }
                                if (nick_access >= tmp_command.Access)
                                {
                                    if (line.GetUpperBound(0) > 3)
                                    {
                                        string[] parse = line[4].Split(' ');
                                        if (type.Equals("query") && parse.GetUpperBound(0) > 1)
                                        {
                                            if (Convert.ToInt32(parse[2]) <= nick_access)
                                            {
                                                set_access_list(parse[0].Trim(), parse[1], parse[2], ircbot);
                                                ircbot.sendData("NOTICE", nick + " :" + parse[0].Trim() + " has been added to access level " + parse[2]);
                                            }
                                            else
                                            {
                                                ircbot.sendData("NOTICE", nick + " :You do not have permission to change their access.");
                                            }
                                        }
                                        else if (type.Equals("channel") && parse.GetUpperBound(0) > 0)
                                        {
                                            if (Convert.ToInt32(parse[1]) <= nick_access)
                                            {
                                                set_access_list(parse[0].Trim(), channel, parse[1], ircbot);
                                                ircbot.sendData("NOTICE", nick + " :" + parse[0].Trim() + " has been added to access level " + parse[1]);
                                            }
                                            else
                                            {
                                                ircbot.sendData("NOTICE", nick + " :You do not have permission to change their access.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("NOTICE", nick + " :" + nick + ", you need to include more info.");
                                        }
                                    }
                                    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;

                            case "delaccess":
                                if (spam_check == true)
                                {
                                    ircbot.add_spam_count(channel);
                                }
                                if (nick_access >= tmp_command.Access)
                                {
                                    if (line.GetUpperBound(0) > 3)
                                    {
                                        string[] parse = line[4].Split(' ');
                                        if (type.Equals("query") && parse.GetUpperBound(0) > 1)
                                        {
                                            if (Convert.ToInt32(parse[2]) <= nick_access)
                                            {
                                                del_access_list(parse[0].Trim(), parse[1], parse[2], ircbot);
                                                ircbot.sendData("NOTICE", nick + " :" + parse[0].Trim() + " has been removed from access level " + parse[2]);
                                            }
                                            else
                                            {
                                                ircbot.sendData("NOTICE", nick + " :You do not have permission to change their access.");
                                            }
                                        }
                                        else if (type.Equals("channel") && parse.GetUpperBound(0) > 0)
                                        {
                                            if (Convert.ToInt32(parse[1]) <= nick_access)
                                            {
                                                del_access_list(parse[0].Trim(), channel, parse[1], ircbot);
                                                ircbot.sendData("NOTICE", nick + " :" + parse[0].Trim() + " has been removed from access level " + parse[1]);
                                            }
                                            else
                                            {
                                                ircbot.sendData("NOTICE", nick + " :You do not have permission to change their access.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("NOTICE", nick + " :" + nick + ", you need to include more info.");
                                        }
                                    }
                                    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;

                            case "listaccess":
                                if (spam_check == true)
                                {
                                    ircbot.add_spam_count(channel);
                                }
                                if (nick_access >= tmp_command.Access)
                                {
                                    if (type.Equals("query") && line.GetUpperBound(0) > 3)
                                    {
                                        list_access_list(nick, line[4], ircbot);
                                    }
                                    else if (type.Equals("channel"))
                                    {
                                        list_access_list(nick, channel, ircbot);
                                    }
                                    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;

                            case "getaccess":
                                if (spam_check == true)
                                {
                                    ircbot.add_spam_count(channel);
                                }
                                if (nick_access >= tmp_command.Access)
                                {
                                    if (line.GetUpperBound(0) > 3)
                                    {
                                        string[] new_line = line[4].Split(' ');
                                        if (new_line.GetUpperBound(0) > 0 && new_line[0].StartsWith("#"))
                                        {
                                            int viewed_access = ircbot.get_nick_access(new_line[1].Trim(), new_line[0].Trim());
                                            ircbot.sendData("NOTICE", nick + " :" + new_line[1].Trim() + " has access level " + viewed_access.ToString());
                                        }
                                        else if (type.Equals("channel"))
                                        {
                                            int viewed_access = ircbot.get_nick_access(line[4].Trim(), channel);
                                            ircbot.sendData("NOTICE", nick + " :" + line[4].Trim() + " has access level " + viewed_access.ToString());
                                        }
                                        else
                                        {
                                            int viewed_access = Conf.Default_Level;
                                            foreach (Channel_Info chan in Conf.Channel_List)
                                            {
                                                int tmp_nick_access = ircbot.get_nick_access(line[4].Trim(), chan.Channel);
                                                if (tmp_nick_access > viewed_access)
                                                {
                                                    viewed_access = tmp_nick_access;
                                                }
                                            }
                                            ircbot.sendData("NOTICE", nick + " :" + line[4].Trim() + " has access level " + viewed_access.ToString());
                                        }
                                    }
                                    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;
                            }
                        }
                    }
                }
            }
        }
Example #5
0
        public override void control(bot ircbot, BotConfig Conf, string[] line, string command, int nick_access, string nick, string channel, bool bot_command, string type)
        {
            if (type.Equals("channel") && bot_command == true)
            {
                foreach (Command tmp_command in this.Commands)
                {
                    bool blocked    = tmp_command.Blacklist.Contains(channel) || tmp_command.Blacklist.Contains(nick);
                    bool cmd_found  = false;
                    bool spam_check = ircbot.get_spam_check(channel, nick, tmp_command.Spam_Check);
                    if (spam_check == true)
                    {
                        blocked = blocked || ircbot.get_spam_status(channel);
                    }
                    cmd_found = tmp_command.Triggers.Contains(command);
                    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 tmp_command.Triggers)
                        {
                            switch (trigger)
                            {
                            case "hbomb":
                                if (spam_check == true)
                                {
                                    ircbot.add_spam_count(channel);
                                }
                                if (nick_access >= tmp_command.Access)
                                {
                                    Modules.idle idle = (Modules.idle)ircbot.get_module("idle");
                                    if (idle.check_idle(nick) == false)
                                    {
                                        bool       hbomb_active = false;
                                        hbomb_info tmp_info     = new hbomb_info();
                                        foreach (hbomb_info bomb in hbombs)
                                        {
                                            if (bomb.bomb_channel.Equals(channel))
                                            {
                                                tmp_info     = bomb;
                                                hbomb_active = true;
                                                break;
                                            }
                                        }
                                        if (hbomb_active == false)
                                        {
                                            tmp_info.bomb_locked  = false;
                                            tmp_info.bomb_trigger = new System.Timers.Timer();
                                            tmp_info.wire_colors  = this.Options["wire_colors"].Split(',');
                                            tmp_info.bomb_channel = channel;

                                            Random random_color = new Random();
                                            int    color_index  = random_color.Next(0, tmp_info.wire_colors.GetUpperBound(0) + 1);
                                            tmp_info.wire_color = tmp_info.wire_colors[color_index];

                                            Random random = new Random();
                                            int    index  = random.Next(10, 60);

                                            tmp_info.bomb_trigger.Elapsed  += (System, EventArgs) => activate_bomb(channel);
                                            tmp_info.bomb_trigger.Interval  = (index * 1000);
                                            tmp_info.bomb_trigger.Enabled   = true;
                                            tmp_info.bomb_trigger.AutoReset = false;

                                            main = ircbot;

                                            tmp_info.previous_bomb_holder = nick;
                                            tmp_info.bomb_holder          = nick;

                                            ircbot.sendData("PRIVMSG", channel + " :" + nick + " has started the timer!  If the bomb gets passed to you, type " + ircbot.Conf.Command + "pass <nick> to pass it to someone else, or type " + ircbot.Conf.Command + "defuse <color> to try to defuse it.");
                                            string colors = "";
                                            foreach (string wire in tmp_info.wire_colors)
                                            {
                                                colors += wire + ",";
                                            }
                                            ircbot.sendData("NOTICE", nick + " :You need to hurry and pass the bomb before it blows up!  Or you can try to defuse it yourself.  The colors are: " + colors.TrimEnd(','));
                                            hbombs.Add(tmp_info);
                                        }
                                        else
                                        {
                                            if (tmp_info.bomb_channel.Equals(channel))
                                            {
                                                ircbot.sendData("PRIVMSG", channel + " :There is already a bomb counting down.");
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :There is already a bomb counting down in " + tmp_info.bomb_channel + ".");
                                            }
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("PRIVMSG", channel + " :You can not start a HBomb when you are idle.");
                                    }
                                }
                                else
                                {
                                    ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                }
                                break;

                            case "pass":
                                if (spam_check == true)
                                {
                                    ircbot.add_spam_count(channel);
                                }
                                if (nick_access >= tmp_command.Access)
                                {
                                    int        index        = 0;
                                    bool       hbomb_active = false;
                                    hbomb_info tmp_info     = new hbomb_info();
                                    foreach (hbomb_info bomb in hbombs)
                                    {
                                        if (bomb.bomb_channel.Equals(channel))
                                        {
                                            tmp_info     = bomb;
                                            hbomb_active = true;
                                            break;
                                        }
                                        index++;
                                    }
                                    if (hbomb_active == true)
                                    {
                                        if (!tmp_info.bomb_locked)
                                        {
                                            Modules.idle idle = (Modules.idle)ircbot.get_module("idle");
                                            if (idle.check_idle(nick) == false)
                                            {
                                                if (tmp_info.bomb_holder.Equals(nick, StringComparison.InvariantCultureIgnoreCase))
                                                {
                                                    if (line.GetUpperBound(0) > 3)
                                                    {
                                                        if (line[4].Trim().Equals(ircbot.Nick, StringComparison.InvariantCultureIgnoreCase))
                                                        {
                                                            ircbot.sendData("PRIVMSG", channel + " :" + nick + ", you can't pass it to me!");
                                                        }
                                                        else
                                                        {
                                                            int user_access = ircbot.get_nick_access(line[4].Trim(), channel);
                                                            if (user_access > 0 && idle.check_idle(line[4].Trim()) == false)
                                                            {
                                                                pass_hbomb(line[4].Trim(), channel, nick, ircbot, Conf, ref tmp_info, index);
                                                            }
                                                            else
                                                            {
                                                                ircbot.sendData("PRIVMSG", channel + " :" + nick + ", you can't pass to them!");
                                                            }
                                                        }
                                                    }
                                                    else
                                                    {
                                                        ircbot.sendData("PRIVMSG", channel + " :" + nick + ", you need to pass the bomb to someone.");
                                                    }
                                                }
                                                else
                                                {
                                                    ircbot.sendData("PRIVMSG", channel + " :You don't have the bomb!");
                                                }
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", channel + " :You can not pass the HBomb when you are idle.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", channel + " :You can not pass a locked bomb.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("PRIVMSG", channel + " :There isn't a bomb to pass!");
                                    }
                                }
                                else
                                {
                                    ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                }
                                break;

                            case "set_bomb":
                                if (spam_check == true)
                                {
                                    ircbot.add_spam_count(channel);
                                }
                                if (nick_access >= tmp_command.Access)
                                {
                                    int        index        = 0;
                                    bool       hbomb_active = false;
                                    hbomb_info tmp_info     = new hbomb_info();
                                    foreach (hbomb_info bomb in hbombs)
                                    {
                                        if (bomb.bomb_channel.Equals(channel))
                                        {
                                            tmp_info     = bomb;
                                            hbomb_active = true;
                                            break;
                                        }
                                        index++;
                                    }
                                    if (hbomb_active == true)
                                    {
                                        if (line.GetUpperBound(0) > 3)
                                        {
                                            if (line[4].Trim().Equals(ircbot.Nick, StringComparison.InvariantCultureIgnoreCase))
                                            {
                                                ircbot.sendData("PRIVMSG", channel + " :" + nick + ", you can't pass it to me!");
                                            }
                                            else
                                            {
                                                int user_access = ircbot.get_nick_access(line[4].Trim(), channel);
                                                if (user_access > 0)
                                                {
                                                    pass_hbomb(line[4].Trim(), channel, nick, ircbot, Conf, ref tmp_info, index);
                                                }
                                                else
                                                {
                                                    ircbot.sendData("PRIVMSG", channel + " :" + nick + ", that user isn't online!");
                                                }
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", channel + " :" + nick + ", you need to pass the bomb to someone.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("PRIVMSG", channel + " :There isn't a bomb to pass!");
                                    }
                                }
                                else
                                {
                                    ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                }
                                break;

                            case "lock_bomb":
                                if (spam_check == true)
                                {
                                    ircbot.add_spam_count(channel);
                                }
                                if (nick_access >= tmp_command.Access)
                                {
                                    int        index        = 0;
                                    bool       hbomb_active = false;
                                    hbomb_info tmp_info     = new hbomb_info();
                                    foreach (hbomb_info bomb in hbombs)
                                    {
                                        if (bomb.bomb_channel.Equals(channel))
                                        {
                                            tmp_info     = bomb;
                                            hbomb_active = true;
                                            break;
                                        }
                                        index++;
                                    }
                                    if (hbomb_active == true)
                                    {
                                        if (line.GetUpperBound(0) > 3)
                                        {
                                            if (line[4].Trim().Equals(ircbot.Nick, StringComparison.InvariantCultureIgnoreCase))
                                            {
                                                ircbot.sendData("PRIVMSG", channel + " :" + nick + ", you can't pass it to me!");
                                            }
                                            else
                                            {
                                                int user_access = ircbot.get_nick_access(line[4].Trim(), channel);
                                                if (user_access > 0)
                                                {
                                                    pass_hbomb(line[4].Trim(), channel, nick, ircbot, Conf, ref tmp_info, index);
                                                    tmp_info.bomb_locked = true;
                                                }
                                                else
                                                {
                                                    ircbot.sendData("PRIVMSG", channel + " :" + nick + ", that user isn't online!");
                                                }
                                            }
                                        }
                                        else
                                        {
                                            tmp_info.bomb_locked = true;
                                        }
                                        hbombs[index] = tmp_info;
                                    }
                                    else
                                    {
                                        ircbot.sendData("PRIVMSG", channel + " :There isn't a bomb to lock!");
                                    }
                                }
                                else
                                {
                                    ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                }
                                break;

                            case "unlock_bomb":
                                if (spam_check == true)
                                {
                                    ircbot.add_spam_count(channel);
                                }
                                if (nick_access >= tmp_command.Access)
                                {
                                    int        index        = 0;
                                    bool       hbomb_active = false;
                                    hbomb_info tmp_info     = new hbomb_info();
                                    foreach (hbomb_info bomb in hbombs)
                                    {
                                        if (bomb.bomb_channel.Equals(channel))
                                        {
                                            tmp_info     = bomb;
                                            hbomb_active = true;
                                            break;
                                        }
                                        index++;
                                    }
                                    if (hbomb_active == true)
                                    {
                                        tmp_info.bomb_locked = false;
                                        hbombs[index]        = tmp_info;
                                    }
                                    else
                                    {
                                        ircbot.sendData("PRIVMSG", channel + " :There isn't a bomb to unlock!");
                                    }
                                }
                                else
                                {
                                    ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                }
                                break;

                            case "detonate":
                                if (spam_check == true)
                                {
                                    ircbot.add_spam_count(channel);
                                }
                                if (nick_access >= tmp_command.Access)
                                {
                                    bool hbomb_active = false;
                                    foreach (hbomb_info bomb in hbombs)
                                    {
                                        if (bomb.bomb_channel.Equals(channel))
                                        {
                                            hbomb_active = true;
                                            break;
                                        }
                                    }
                                    if (hbomb_active == true)
                                    {
                                        main = ircbot;
                                        activate_bomb(channel);
                                    }
                                    else
                                    {
                                        ircbot.sendData("PRIVMSG", channel + " :There isn't a bomb to blow up!");
                                    }
                                }
                                else
                                {
                                    ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                }
                                break;

                            case "stop_bomb":
                                if (spam_check == true)
                                {
                                    ircbot.add_spam_count(channel);
                                }
                                if (nick_access >= tmp_command.Access)
                                {
                                    int        index        = 0;
                                    bool       hbomb_active = false;
                                    hbomb_info tmp_info     = new hbomb_info();
                                    foreach (hbomb_info bomb in hbombs)
                                    {
                                        if (bomb.bomb_channel.Equals(channel))
                                        {
                                            tmp_info     = bomb;
                                            hbomb_active = true;
                                            break;
                                        }
                                        index++;
                                    }
                                    if (hbomb_active == true)
                                    {
                                        hbombs.RemoveAt(index);
                                        ircbot.sendData("PRIVMSG", channel + " :Bomb has been defused and thrown away.");
                                    }
                                    else
                                    {
                                        ircbot.sendData("PRIVMSG", channel + " :There isn't a bomb to stop!");
                                    }
                                }
                                else
                                {
                                    ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                }
                                break;

                            case "defuse":
                                if (spam_check == true)
                                {
                                    ircbot.add_spam_count(channel);
                                }
                                if (nick_access >= tmp_command.Access)
                                {
                                    int        index        = 0;
                                    bool       hbomb_active = false;
                                    hbomb_info tmp_info     = new hbomb_info();
                                    foreach (hbomb_info bomb in hbombs)
                                    {
                                        if (bomb.bomb_channel.Equals(channel))
                                        {
                                            tmp_info     = bomb;
                                            hbomb_active = true;
                                            break;
                                        }
                                        index++;
                                    }
                                    if (hbomb_active == true)
                                    {
                                        if (!tmp_info.bomb_locked)
                                        {
                                            Modules.idle idle = (Modules.idle)ircbot.get_module("idle");
                                            if (idle.check_idle(nick) == false)
                                            {
                                                if (tmp_info.bomb_holder.Equals(nick, StringComparison.InvariantCultureIgnoreCase))
                                                {
                                                    if (line.GetUpperBound(0) > 3)
                                                    {
                                                        if (line[4].Trim().Equals(tmp_info.wire_color, StringComparison.InvariantCultureIgnoreCase))
                                                        {
                                                            ircbot.sendData("PRIVMSG", channel + " :You have successfully defused the bomb!");
                                                            if (tmp_info.previous_bomb_holder.Equals(tmp_info.bomb_holder))
                                                            {
                                                            }
                                                            else
                                                            {
                                                                ircbot.sendData("KICK", tmp_info.bomb_channel + " " + tmp_info.previous_bomb_holder + " :BOOM!!!");
                                                            }
                                                            hbombs.RemoveAt(index);
                                                        }
                                                        else
                                                        {
                                                            main = ircbot;
                                                            activate_bomb(channel);
                                                        }
                                                    }
                                                    else
                                                    {
                                                        ircbot.sendData("PRIVMSG", channel + " :" + nick + ", you need to cut a wire.");
                                                    }
                                                }
                                                else
                                                {
                                                    ircbot.sendData("PRIVMSG", channel + " :You don't have the bomb!");
                                                }
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", channel + " :You can not defuse the HBomb when you are idle.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", channel + " :You can not defuse the HBomb when it is locked.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("PRIVMSG", channel + " :There isn't a bomb to defuse!");
                                    }
                                }
                                else
                                {
                                    ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                }
                                break;
                            }
                        }
                    }
                }
            }
        }
Example #6
0
        public override void control(bot ircbot, BotConfig Conf, string[] line, string command, int nick_access, string nick, string channel, bool bot_command, string type)
        {
            if (type.Equals("channel") && bot_command == true)
            {
                foreach (Command tmp_command in this.Commands)
                {
                    bool blocked    = tmp_command.Blacklist.Contains(channel) || tmp_command.Blacklist.Contains(nick);
                    bool cmd_found  = false;
                    bool spam_check = ircbot.get_spam_check(channel, nick, tmp_command.Spam_Check);
                    if (spam_check == true)
                    {
                        blocked = blocked || ircbot.get_spam_status(channel);
                    }
                    cmd_found = tmp_command.Triggers.Contains(command);
                    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 tmp_command.Triggers)
                        {
                            switch (trigger)
                            {
                            case "poll":
                                if (spam_check == true)
                                {
                                    ircbot.add_spam_count(channel);
                                }
                                if (nick_access >= tmp_command.Access)
                                {
                                    bool poll_active = false;
                                    foreach (poll_info tmp_poll in poll_list)
                                    {
                                        if (tmp_poll.channel.Equals(channel))
                                        {
                                            poll_active = true;
                                            break;
                                        }
                                    }
                                    if (poll_active == false)
                                    {
                                        if (line.GetUpperBound(0) > 3)
                                        {
                                            string[] lines = line[4].Split('|');
                                            if (lines.GetUpperBound(0) > 0)
                                            {
                                                poll_info temp_poll = new poll_info();
                                                poll_active              = true;
                                                temp_poll.question       = lines[0];
                                                temp_poll.owner          = nick;
                                                temp_poll.channel        = channel;
                                                temp_poll.answers        = new List <List <string> >();
                                                temp_poll.nick_responses = new List <List <string> >();
                                                for (int x = 1; x <= lines.GetUpperBound(0); x++)
                                                {
                                                    List <string> tmp_list = new List <string>();
                                                    tmp_list.Add(lines[x]);
                                                    tmp_list.Add("0");
                                                    temp_poll.answers.Add(tmp_list);
                                                }
                                                ircbot.sendData("PRIVMSG", channel + " :Poll has been started by " + temp_poll.owner + ": " + temp_poll.question);
                                                for (int x = 0; x < temp_poll.answers.Count(); x++)
                                                {
                                                    ircbot.sendData("PRIVMSG", channel + " :" + (x + 1).ToString() + ") " + temp_poll.answers[x][0]);
                                                }
                                                ircbot.sendData("PRIVMSG", channel + " :To Vote, type " + ircbot.Conf.Command + "vote <answer_number>.  You may only vote once per poll.  You can change your vote by voting for a different answer.");
                                                poll_list.Add(temp_poll);
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("PRIVMSG", channel + " :There is currently a poll active right now.  To view the current results, type " + ircbot.Conf.Command + "results");
                                    }
                                }
                                else
                                {
                                    ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                }
                                break;

                            case "addanswer":
                                if (spam_check == true)
                                {
                                    ircbot.add_spam_count(channel);
                                }
                                if (nick_access >= tmp_command.Access)
                                {
                                    bool      poll_active = false;
                                    poll_info cur_poll    = new poll_info();
                                    foreach (poll_info tmp_poll in poll_list)
                                    {
                                        if (tmp_poll.channel.Equals(channel))
                                        {
                                            cur_poll    = tmp_poll;
                                            poll_active = true;
                                            break;
                                        }
                                    }
                                    if (poll_active == true)
                                    {
                                        if (cur_poll.owner.Equals(nick, StringComparison.InvariantCultureIgnoreCase))
                                        {
                                            if (line.GetUpperBound(0) > 3)
                                            {
                                                List <string> tmp_list = new List <string>();
                                                tmp_list.Add(line[4]);
                                                tmp_list.Add("0");
                                                cur_poll.answers.Add(tmp_list);
                                                ircbot.sendData("PRIVMSG", channel + " :An Answer has been added to the poll.");
                                                ircbot.sendData("PRIVMSG", channel + " :" + cur_poll.answers.Count().ToString() + ")" + line[4]);
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", channel + " :You are not the poll owner.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("PRIVMSG", channel + " :There is currently no poll active right now");
                                    }
                                }
                                else
                                {
                                    ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                }
                                break;

                            case "delanswer":
                                if (spam_check == true)
                                {
                                    ircbot.add_spam_count(channel);
                                }
                                if (nick_access >= tmp_command.Access)
                                {
                                    bool      poll_active = false;
                                    poll_info cur_poll    = new poll_info();
                                    foreach (poll_info tmp_poll in poll_list)
                                    {
                                        if (tmp_poll.channel.Equals(channel))
                                        {
                                            cur_poll    = tmp_poll;
                                            poll_active = true;
                                            break;
                                        }
                                    }
                                    if (poll_active == true)
                                    {
                                        if (cur_poll.owner.Equals(nick, StringComparison.InvariantCultureIgnoreCase))
                                        {
                                            if (line.GetUpperBound(0) > 3)
                                            {
                                                for (int x = 0; x < cur_poll.answers.Count(); x++)
                                                {
                                                    if (x == (Convert.ToInt32(line[4]) - 1))
                                                    {
                                                        ircbot.sendData("PRIVMSG", channel + " :Answer " + x.ToString() + " has been removed.");
                                                        cur_poll.answers.RemoveAt(x);
                                                        break;
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", channel + " :You are not the poll owner.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("PRIVMSG", channel + " :There is currently no poll active right now");
                                    }
                                }
                                else
                                {
                                    ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                }
                                break;

                            case "stoppoll":
                                if (spam_check == true)
                                {
                                    ircbot.add_spam_count(channel);
                                }
                                if (nick_access >= tmp_command.Access)
                                {
                                    bool      poll_active = false;
                                    int       index       = 0;
                                    poll_info cur_poll    = new poll_info();
                                    foreach (poll_info tmp_poll in poll_list)
                                    {
                                        if (tmp_poll.channel.Equals(channel))
                                        {
                                            cur_poll    = tmp_poll;
                                            poll_active = true;
                                            break;
                                        }
                                        index++;
                                    }
                                    if (poll_active == true)
                                    {
                                        if (cur_poll.owner.Equals(nick, StringComparison.InvariantCultureIgnoreCase) || nick_access > Convert.ToInt32(ircbot.get_nick_access(cur_poll.owner, channel)))
                                        {
                                            poll_active = false;

                                            ircbot.sendData("PRIVMSG", channel + " :Results of poll by " + cur_poll.owner + ": " + cur_poll.question);
                                            for (int x = 0; x < cur_poll.answers.Count(); x++)
                                            {
                                                ircbot.sendData("PRIVMSG", channel + " :" + (x + 1).ToString() + ") " + cur_poll.answers[x][0] + " | " + cur_poll.answers[x][1] + " votes");
                                            }
                                            poll_list.RemoveAt(index);
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", channel + " :You are not the poll owner.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("PRIVMSG", channel + " :There is currently no poll active right now");
                                    }
                                }
                                else
                                {
                                    ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                }
                                break;

                            case "results":
                                if (spam_check == true)
                                {
                                    ircbot.add_spam_count(channel);
                                }
                                if (nick_access >= tmp_command.Access)
                                {
                                    bool      poll_active = false;
                                    poll_info cur_poll    = new poll_info();
                                    foreach (poll_info tmp_poll in poll_list)
                                    {
                                        if (tmp_poll.channel.Equals(channel))
                                        {
                                            cur_poll    = tmp_poll;
                                            poll_active = true;
                                            break;
                                        }
                                    }
                                    if (poll_active == true)
                                    {
                                        ircbot.sendData("NOTICE", nick + " :Poll by " + cur_poll.owner + ": " + cur_poll.question);
                                        for (int x = 0; x < cur_poll.answers.Count(); x++)
                                        {
                                            ircbot.sendData("NOTICE", nick + " :" + (x + 1).ToString() + ") " + cur_poll.answers[x][0] + " | " + cur_poll.answers[x][1] + " votes");
                                        }
                                        ircbot.sendData("NOTICE", nick + " :To Vote, type .vote <answer_number>.  You may only vote once per poll.  You can change your vote by voting for a different answer.");
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :There is currently no poll active right now");
                                    }
                                }
                                else
                                {
                                    ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                }
                                break;

                            case "vote":
                                if (spam_check == true)
                                {
                                    ircbot.add_spam_count(channel);
                                }
                                if (nick_access >= tmp_command.Access)
                                {
                                    if (line.GetUpperBound(0) > 3)
                                    {
                                        bool      poll_active = false;
                                        poll_info cur_poll    = new poll_info();
                                        foreach (poll_info tmp_poll in poll_list)
                                        {
                                            if (tmp_poll.channel.Equals(channel))
                                            {
                                                cur_poll    = tmp_poll;
                                                poll_active = true;
                                                break;
                                            }
                                        }
                                        if (poll_active == true)
                                        {
                                            try
                                            {
                                                int vote = Convert.ToInt32(line[4]);
                                                if (vote > 0 && vote <= cur_poll.answers.Count())
                                                {
                                                    bool   nick_voted = false;
                                                    int    index      = 0;
                                                    string nick_host  = ircbot.get_nick_host(nick);
                                                    if (String.IsNullOrEmpty(nick_host))
                                                    {
                                                        nick_host = nick;
                                                    }
                                                    for (int x = 0; x < cur_poll.nick_responses.Count(); x++)
                                                    {
                                                        if (cur_poll.nick_responses[x][0].Equals(nick_host))
                                                        {
                                                            nick_voted = true;
                                                            index      = Convert.ToInt32(cur_poll.nick_responses[x][1]);
                                                            cur_poll.nick_responses[x][1]  = vote.ToString();
                                                            cur_poll.answers[index - 1][1] = (Convert.ToInt32(cur_poll.answers[index - 1][1]) - 1).ToString();
                                                            cur_poll.answers[vote - 1][1]  = (Convert.ToInt32(cur_poll.answers[vote - 1][1]) + 1).ToString();
                                                            break;
                                                        }
                                                    }
                                                    if (nick_voted == false)
                                                    {
                                                        List <string> tmp_list = new List <string>();
                                                        tmp_list.Add(nick_host);
                                                        tmp_list.Add(vote.ToString());
                                                        cur_poll.nick_responses.Add(tmp_list);
                                                        cur_poll.answers[vote - 1][1] = (Convert.ToInt32(cur_poll.answers[vote - 1][1]) + 1).ToString();
                                                    }
                                                    ircbot.sendData("PRIVMSG", channel + " :Thank you for voting for " + vote.ToString());
                                                }
                                                else
                                                {
                                                    ircbot.sendData("PRIVMSG", channel + " :You need to vote for a valid answer.");
                                                }
                                            }
                                            catch
                                            {
                                                ircbot.sendData("PRIVMSG", channel + " :You need to vote for a valid answer.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", channel + " :There is currently no poll active right now");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                    }
                                }
                                else
                                {
                                    ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                }
                                break;
                            }
                        }
                    }
                }
            }
        }
Example #7
0
        public override void control(bot ircbot, BotConfig Conf, string[] line, string command, int nick_access, string nick, string channel, bool bot_command, string type)
        {
            access access = new access();

            char[] charS = new char[] { ' ' };
            string disallowed_modes = this.Options["disallowed_modes"];
            if (type.Equals("channel") && bot_command == true)
            {
                foreach (Command tmp_command in this.Commands)
                {
                    bool blocked = tmp_command.Blacklist.Contains(channel) || tmp_command.Blacklist.Contains(nick);
                    bool cmd_found = false;
                    bool spam_check = ircbot.get_spam_check(channel, nick, tmp_command.Spam_Check);
                    if (spam_check == true)
                    {
                        blocked = blocked || ircbot.get_spam_status(channel);
                    }
                    cmd_found = tmp_command.Triggers.Contains(command);
                    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 tmp_command.Triggers)
                        {
                            switch (trigger)
                            {
                                case "founder":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        if (line.GetUpperBound(0) > 3)
                                        {
                                            ircbot.sendData("MODE", line[2] + " +q " + line[4]);
                                            access.set_access_list(line[4], line[2], Conf.Founder_Level.ToString(), ircbot);
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "defounder":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        if (line.GetUpperBound(0) > 3)
                                        {
                                            ircbot.sendData("MODE", line[2] + " -q " + line[4]);
                                            access.del_access_list(line[4], line[2], Conf.Founder_Level.ToString(), ircbot);
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "sop":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        if (line.GetUpperBound(0) > 3)
                                        {
                                            ircbot.sendData("MODE", line[2] + " +a " + line[4]);
                                            access.set_access_list(line[4], line[2], Conf.Sop_Level.ToString(), ircbot);
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "asop":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        if (line.GetUpperBound(0) > 3)
                                        {
                                            ircbot.sendData("MODE", line[2] + " +a " + line[4]);
                                            ircbot.sendData("PRIVMSG", "chanserv :SOP " + line[2] + " add " + line[4]);
                                            access.set_access_list(line[4], line[2], Conf.Sop_Level.ToString(), ircbot);
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "deasop":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        if (line.GetUpperBound(0) > 3)
                                        {
                                            ircbot.sendData("MODE", line[2] + " -a " + line[4]);
                                            ircbot.sendData("PRIVMSG", "chanserv :SOP " + line[2] + " del " + line[4]);
                                            access.del_access_list(line[4], line[2], Conf.Sop_Level.ToString(), ircbot);
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "desop":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        if (line.GetUpperBound(0) > 3)
                                        {
                                            ircbot.sendData("MODE", line[2] + " -a " + line[4]);
                                            access.del_access_list(line[4], line[2], Conf.Sop_Level.ToString(), ircbot);
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "op":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        if (line.GetUpperBound(0) > 3)
                                        {
                                            ircbot.sendData("MODE", line[2] + " +o " + line[4]);
                                            access.set_access_list(line[4], line[2], Conf.Op_Level.ToString(), ircbot);
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "aop":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        if (line.GetUpperBound(0) > 3)
                                        {
                                            ircbot.sendData("MODE", line[2] + " +o " + line[4]);
                                            if (!ircbot.get_nick_auto("SOP", line[2], line[4]))
                                            {
                                                ircbot.sendData("PRIVMSG", "chanserv :AOP " + line[2] + " add " + line[4]);
                                            }
                                            access.set_access_list(line[4], line[2], Conf.Op_Level.ToString(), ircbot);
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "deaop":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        if (line.GetUpperBound(0) > 3)
                                        {
                                            ircbot.sendData("MODE", line[2] + " -o " + line[4]);
                                            ircbot.sendData("PRIVMSG", "chanserv :AOP " + line[2] + " del " + line[4]);
                                            access.del_access_list(line[4], line[2], Conf.Op_Level.ToString(), ircbot);
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "deop":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        if (line.GetUpperBound(0) > 3)
                                        {
                                            ircbot.sendData("MODE", line[2] + " -o " + line[4]);
                                            access.del_access_list(line[4], line[2], Conf.Op_Level.ToString(), ircbot);
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "ahop":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        if (line.GetUpperBound(0) > 3)
                                        {
                                            ircbot.sendData("MODE", line[2] + " +h " + line[4]);
                                            if (!ircbot.get_nick_auto("AOP", line[2], line[4]) && !ircbot.get_nick_auto("SOP", line[2], line[4]))
                                            {
                                                ircbot.sendData("PRIVMSG", "chanserv :HOP " + line[2] + " add " + line[4]);
                                            }
                                            access.set_access_list(line[4], line[2], Conf.Hop_Level.ToString(), ircbot);
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "deahop":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        if (line.GetUpperBound(0) > 3)
                                        {
                                            ircbot.sendData("MODE", line[2] + " -h " + line[4]);
                                            ircbot.sendData("PRIVMSG", "chanserv :HOP " + line[2] + " del " + line[4]);
                                            access.del_access_list(line[4], line[2], Conf.Hop_Level.ToString(), ircbot);
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "hop":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        if (line.GetUpperBound(0) > 3)
                                        {
                                            ircbot.sendData("MODE", line[2] + " +h " + line[4]);
                                            access.set_access_list(line[4], line[2], Conf.Hop_Level.ToString(), ircbot);
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "dehop":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        if (line.GetUpperBound(0) > 3)
                                        {
                                            ircbot.sendData("MODE", line[2] + " -h " + line[4]);
                                            access.del_access_list(line[4], line[2], Conf.Hop_Level.ToString(), ircbot);
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "avoice":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        if (line.GetUpperBound(0) > 3)
                                        {
                                            ircbot.sendData("MODE", line[2] + " +v " + line[4]);
                                            if (!ircbot.get_nick_auto("AOP", line[2], line[4]) && !ircbot.get_nick_auto("SOP", line[2], line[4]) && !ircbot.get_nick_auto("VOP", line[2], line[4]))
                                            {
                                                ircbot.sendData("PRIVMSG", "chanserv :VOP " + line[2] + " add " + line[4]);
                                            }
                                            access.set_access_list(line[4], line[2], Conf.Voice_Level.ToString(), ircbot);
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "deavoice":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        if (line.GetUpperBound(0) > 3)
                                        {
                                            ircbot.sendData("MODE", line[2] + " -v " + line[4]);
                                            ircbot.sendData("PRIVMSG", "chanserv :VOP " + line[2] + " del " + line[4]);
                                            access.del_access_list(line[4], line[2], Conf.Voice_Level.ToString(), ircbot);
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "voice":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        if (line.GetUpperBound(0) > 3)
                                        {
                                            ircbot.sendData("MODE", line[2] + " +v " + line[4]);
                                            access.set_access_list(line[4], line[2], Conf.Voice_Level.ToString(), ircbot);
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "devoice":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        if (line.GetUpperBound(0) > 3)
                                        {
                                            ircbot.sendData("MODE", line[2] + " -v " + line[4]);
                                            access.del_access_list(line[4], line[2], Conf.Voice_Level.ToString(), ircbot);
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "mode":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        if (line.GetUpperBound(0) > 3)
                                        {
                                            string[] new_line = line[4].Split(charS, 2);
                                            char[] arr = new_line[0].ToCharArray();

                                            bool mode_allowed = true;
                                            bool positive = true;
                                            int mode_index = 0;
                                            foreach (char c in arr)
                                            {
                                                if (!c.Equals('+') && !c.Equals('-'))
                                                {
                                                    char[] modes_disallowed = disallowed_modes.ToCharArray();
                                                    foreach (char m in modes_disallowed)
                                                    {
                                                        if (m.Equals(c))
                                                        {
                                                            mode_allowed = false;
                                                            break;
                                                        }
                                                    }
                                                    if (mode_allowed == true)
                                                    {
                                                        if (c.Equals('q') || c.Equals('a') || c.Equals('o') || c.Equals('h') || c.Equals('v'))
                                                        {
                                                            int mode_access = ircbot.get_access_num(c.ToString(), true);
                                                            if (nick_access < mode_access)
                                                            {
                                                                mode_allowed = false;
                                                                break;
                                                            }
                                                        }
                                                    }
                                                    if (mode_allowed)
                                                    {
                                                        string leading_cmd = "";
                                                        if (positive)
                                                        {
                                                            leading_cmd = "+";
                                                        }
                                                        else
                                                        {
                                                            leading_cmd = "-";
                                                        }
                                                        bool nick_needed = false;
                                                        if (new_line.GetUpperBound(0) > 0)
                                                        {
                                                            string[] nicks = new_line[1].Split(charS);
                                                            if (nicks.GetUpperBound(0) >= mode_index)
                                                            {
                                                                nick_needed = true;
                                                            }
                                                        }
                                                        if (nick_needed)
                                                        {
                                                            string[] nicks = new_line[1].Split(charS);
                                                            ircbot.sendData("MODE", line[2] + " " + leading_cmd + c.ToString() + " :" + nicks[mode_index]);
                                                        }
                                                        else
                                                        {
                                                            ircbot.sendData("MODE", line[2] + " " + leading_cmd + c.ToString());
                                                        }
                                                    }
                                                    mode_index++;
                                                }
                                                else if (c.Equals('+'))
                                                {
                                                    positive = true;
                                                }
                                                else if (c.Equals('-'))
                                                {
                                                    positive = false;
                                                }
                                            }
                                            if (!mode_allowed)
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :You do not have permission to use that command.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "topic":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        if (line.GetUpperBound(0) > 3)
                                        {
                                            string[] new_line = line[4].Split(charS, 2);
                                            if (new_line.GetUpperBound(0) > 0)
                                            {
                                                ircbot.sendData("TOPIC", line[2] + " :" + new_line[0] + " " + new_line[1]);
                                            }
                                            else
                                            {
                                                ircbot.sendData("TOPIC", line[2] + " :" + new_line[0]);
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "invite":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        if (line.GetUpperBound(0) > 3)
                                        {
                                            string[] new_line = line[4].Split(charS, 2);
                                            if (new_line.GetUpperBound(0) > 0)
                                            {
                                                ircbot.sendData("INVITE", new_line[0] + " " + new_line[1]);
                                            }
                                            else
                                            {
                                                ircbot.sendData("INVITE", new_line[0] + " " + line[2]);
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "b":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        if (line.GetUpperBound(0) > 3)
                                        {
                                            string[] new_line = line[4].Split(charS, 2);
                                            string nicks = new_line[0].TrimStart(':');
                                            char[] charSep = new char[] { ',' };
                                            string[] total_nicks = new_line[0].Split(charSep, StringSplitOptions.RemoveEmptyEntries);
                                            int sent_nick_access = ircbot.get_nick_access(total_nicks[0], line[2]);

                                            bool tmp_me = false;
                                            for (int y = 0; y <= total_nicks.GetUpperBound(0); y++)
                                            {
                                                if (total_nicks[y].Equals(Conf.Name, StringComparison.OrdinalIgnoreCase))
                                                {
                                                    tmp_me = true;
                                                }
                                            }
                                            if (sent_nick_access == Conf.Owner_Level)
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :You can't ban my owner!");
                                            }
                                            else if (tmp_me == true)
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :You can't ban me!");
                                            }
                                            else
                                            {
                                                if (nick_access >= sent_nick_access)
                                                {
                                                    string target_host = ircbot.get_nick_host(total_nicks[0]);
                                                    string ban = "*!*@" + target_host;
                                                    if (String.IsNullOrEmpty(target_host))
                                                    {
                                                        ban = new_line[0] + "!*@*";
                                                    }
                                                    if (new_line.GetUpperBound(0) > 0)
                                                    {
                                                        ircbot.sendData("MODE", line[2] + " +b " + ban + " :" + new_line[1]);
                                                    }
                                                    else
                                                    {
                                                        ircbot.sendData("MODE", line[2] + " +b " + ban + " :No Reason");
                                                    }
                                                }
                                                else
                                                {
                                                    ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                                }
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "ub":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        if (line.GetUpperBound(0) > 3)
                                        {
                                            string[] new_line = line[4].Split(charS, 2);
                                            char[] charSep = new char[] { ',' };
                                            string[] total_nicks = new_line[0].Split(charSep, StringSplitOptions.RemoveEmptyEntries);
                                            int sent_nick_access = ircbot.get_nick_access(total_nicks[0].TrimStart(':'), line[2]);

                                            if (nick_access >= sent_nick_access)
                                            {
                                                string target_host = ircbot.get_nick_host(total_nicks[0]);
                                                string ban = "*!*@" + target_host;
                                                if (String.IsNullOrEmpty(target_host))
                                                {
                                                    ban = new_line[0] + "!*@*";
                                                }
                                                if (new_line.GetUpperBound(0) > 0)
                                                {
                                                    ircbot.sendData("MODE", line[2] + " -b " + ban + " :" + new_line[1]);
                                                }
                                                else
                                                {
                                                    ircbot.sendData("MODE", line[2] + " -b " + ban + " :No Reason");
                                                }
                                            }
                                            else
                                            {
                                                ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "clearban":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        ircbot.sendData("PRIVMSG", "chanserv :clear " + channel + " bans");
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "kb":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        if (line.GetUpperBound(0) > 3)
                                        {
                                            string[] new_line = line[4].Split(charS, 2);
                                            string nicks = new_line[0].TrimStart(':');
                                            char[] charSep = new char[] { ',' };
                                            string[] total_nicks = nicks.Split(charSep, StringSplitOptions.RemoveEmptyEntries);
                                            int sent_nick_access = ircbot.get_nick_access(total_nicks[0], line[2]);

                                            bool tmp_me = false;
                                            for (int y = 0; y <= total_nicks.GetUpperBound(0); y++)
                                            {
                                                if (total_nicks[y].Equals(Conf.Name, StringComparison.InvariantCultureIgnoreCase))
                                                {
                                                    tmp_me = true;
                                                }
                                            }
                                            if (sent_nick_access == Conf.Owner_Level)
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :You can't kick-ban my owner!");
                                            }
                                            else if (tmp_me == true)
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :You can't kick-ban me!");
                                            }
                                            else
                                            {
                                                if (nick_access >= sent_nick_access)
                                                {
                                                    string target_host = ircbot.get_nick_host(total_nicks[0]);
                                                    string ban = "*!*@" + target_host;
                                                    if (String.IsNullOrEmpty(target_host))
                                                    {
                                                        ban = new_line[0] + "!*@*";
                                                    }
                                                    if (new_line.GetUpperBound(0) > 0)
                                                    {
                                                        ircbot.sendData("MODE", line[2] + " +b " + ban + " :" + new_line[1]);
                                                        ircbot.sendData("KICK", line[2] + " " + total_nicks[0] + " :" + new_line[1]);
                                                    }
                                                    else
                                                    {
                                                        ircbot.sendData("MODE", line[2] + " +b " + ban + " :No Reason");
                                                        ircbot.sendData("KICK", line[2] + " " + total_nicks[0] + " :No Reason");
                                                    }
                                                }
                                                else
                                                {
                                                    ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                                }
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "tb":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        if (line.GetUpperBound(0) > 3)
                                        {
                                            string[] new_line = line[4].Split(charS, 3, StringSplitOptions.RemoveEmptyEntries);
                                            if (new_line.GetUpperBound(0) > 0)
                                            {
                                                string nicks = new_line[1];
                                                char[] charSep = new char[] { ',' };
                                                string[] total_nicks = nicks.Split(charSep, StringSplitOptions.RemoveEmptyEntries);
                                                string target_host = ircbot.get_nick_host(total_nicks[0]);
                                                int sent_nick_access = ircbot.get_nick_access(total_nicks[0], line[2]);

                                                bool tmp_me = false;
                                                for (int y = 0; y <= total_nicks.GetUpperBound(0); y++)
                                                {
                                                    if (total_nicks[y].Equals(Conf.Name, StringComparison.InvariantCultureIgnoreCase))
                                                    {
                                                        tmp_me = true;
                                                    }
                                                }
                                                if (sent_nick_access == Conf.Owner_Level)
                                                {
                                                    ircbot.sendData("PRIVMSG", line[2] + " :You can't ban my owner!");
                                                }
                                                else if (tmp_me == true)
                                                {
                                                    ircbot.sendData("PRIVMSG", line[2] + " :You can't ban me!");
                                                }
                                                else
                                                {
                                                    if (nick_access >= sent_nick_access)
                                                    {
                                                        string ban = "*!*@" + target_host;
                                                        if (String.IsNullOrEmpty(target_host))
                                                        {
                                                            ban = total_nicks[0] + "!*@*";
                                                        }
                                                        if (new_line.GetUpperBound(0) > 1)
                                                        {
                                                            ircbot.sendData("MODE", line[2] + " +b " + ban + " :" + new_line[2]);
                                                        }
                                                        else
                                                        {
                                                            ircbot.sendData("MODE", line[2] + " +b " + ban + " :No Reason");
                                                        }
                                                        Timer unban_trigger = new Timer();
                                                        unban_trigger.Interval = (Convert.ToInt32(new_line[0]) * 1000);
                                                        unban_trigger.Enabled = true;
                                                        unban_trigger.AutoReset = false;
                                                        unban_trigger.Elapsed += (sender, e) => unban_nick(sender, e, total_nicks[0], target_host, line[2]);
                                                        unban_triggers.Add(unban_trigger);
                                                        main = ircbot;
                                                    }
                                                    else
                                                    {
                                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "tkb":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        if (line.GetUpperBound(0) > 3)
                                        {
                                            string[] new_line = line[4].Split(charS, 3, StringSplitOptions.RemoveEmptyEntries);
                                            if (new_line.GetUpperBound(0) > 0)
                                            {
                                                int time = Convert.ToInt32(new_line[0].TrimStart(':'));
                                                string nicks = new_line[1];
                                                char[] charSep = new char[] { ',' };
                                                string[] total_nicks = nicks.Split(charSep, StringSplitOptions.RemoveEmptyEntries);
                                                int sent_nick_access = ircbot.get_nick_access(total_nicks[0], line[2]);
                                                string target_host = ircbot.get_nick_host(total_nicks[0]);

                                                bool tmp_me = false;
                                                for (int y = 0; y <= total_nicks.GetUpperBound(0); y++)
                                                {
                                                    if (total_nicks[y].Trim().Equals(Conf.Name, StringComparison.InvariantCultureIgnoreCase))
                                                    {
                                                        tmp_me = true;
                                                    }
                                                }
                                                if (sent_nick_access == Conf.Owner_Level)
                                                {
                                                    ircbot.sendData("PRIVMSG", line[2] + " :You can't kick-ban my owner!");
                                                }
                                                else if (tmp_me == true)
                                                {
                                                    ircbot.sendData("PRIVMSG", line[2] + " :You can't kick-ban me!");
                                                }
                                                else
                                                {
                                                    if (nick_access >= sent_nick_access)
                                                    {
                                                        string ban = "*!*@" + target_host;
                                                        if (String.IsNullOrEmpty(target_host))
                                                        {
                                                            ban = new_line[1] + "!*@*";
                                                        }
                                                        if (new_line.GetUpperBound(0) > 1)
                                                        {
                                                            ircbot.sendData("MODE", line[2] + " +b " + ban + " :" + new_line[2]);
                                                            ircbot.sendData("KICK", line[2] + " " + total_nicks[0] + " :" + new_line[2]);
                                                        }
                                                        else
                                                        {
                                                            ircbot.sendData("MODE", line[2] + " +b " + ban + " :No Reason");
                                                            ircbot.sendData("KICK", line[2] + " " + total_nicks[0] + " :No Reason");
                                                        }
                                                        System.Timers.Timer unban_trigger = new System.Timers.Timer();
                                                        unban_trigger.Interval = (Convert.ToInt32(new_line[0]) * 1000);
                                                        unban_trigger.Enabled = true;
                                                        unban_trigger.AutoReset = false;
                                                        unban_trigger.Elapsed += (sender, e) => unban_nick(sender, e, total_nicks[0], target_host, line[2]);
                                                        unban_triggers.Add(unban_trigger);
                                                        main = ircbot;
                                                    }
                                                    else
                                                    {
                                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "ak":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        if (line.GetUpperBound(0) > 3)
                                        {
                                            string[] new_line = line[4].Split(charS, 2);
                                            string nicks = new_line[0].TrimStart(':');
                                            char[] charSep = new char[] { ',' };
                                            string[] total_nicks = nicks.Split(charSep, StringSplitOptions.RemoveEmptyEntries);
                                            int sent_nick_access = ircbot.get_nick_access(total_nicks[0], line[2]);
                                            bool tmp_me = false;
                                            for (int y = 0; y <= total_nicks.GetUpperBound(0); y++)
                                            {
                                                if (total_nicks[y].Trim().Equals(Conf.Name, StringComparison.InvariantCultureIgnoreCase))
                                                {
                                                    tmp_me = true;
                                                }
                                            }
                                            if (sent_nick_access == Conf.Owner_Level)
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :You can't kick my owner!");
                                            }
                                            else if (tmp_me == true)
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :You can't kick me!");
                                            }
                                            else
                                            {
                                                if (nick_access >= sent_nick_access)
                                                {
                                                    string target_host = ircbot.get_nick_host(total_nicks[0]);
                                                    if (new_line.GetUpperBound(0) > 0)
                                                    {
                                                        add_auto(total_nicks[0], line[2], target_host, "k", new_line[1], ircbot);
                                                    }
                                                    else
                                                    {
                                                        add_auto(total_nicks[0], line[2], target_host, "k", "No Reason", ircbot);
                                                    }
                                                }
                                                else
                                                {
                                                    ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                                }
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "ab":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        if (line.GetUpperBound(0) > 3)
                                        {
                                            string[] new_line = line[4].Split(charS, 2);
                                            string target_host = ircbot.get_nick_host(new_line[0]);
                                            string nicks = new_line[0].TrimStart(':');
                                            char[] charSep = new char[] { ',' };
                                            string[] total_nicks = nicks.Split(charSep, StringSplitOptions.RemoveEmptyEntries);
                                            int sent_nick_access = ircbot.get_nick_access(total_nicks[0], line[2]);
                                            bool tmp_me = false;
                                            for (int y = 0; y <= total_nicks.GetUpperBound(0); y++)
                                            {
                                                if (total_nicks[y].Trim().Equals(Conf.Name, StringComparison.InvariantCultureIgnoreCase))
                                                {
                                                    tmp_me = true;
                                                }
                                            }
                                            if (sent_nick_access == Conf.Owner_Level)
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :You can't ban my owner!");
                                            }
                                            else if (tmp_me == true)
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :You can't ban me!");
                                            }
                                            else
                                            {
                                                if (nick_access >= sent_nick_access)
                                                {
                                                    if (new_line.GetUpperBound(0) > 0)
                                                    {
                                                        add_auto(total_nicks[0], line[2], target_host, "b", new_line[1], ircbot);
                                                    }
                                                    else
                                                    {
                                                        add_auto(total_nicks[0], line[2], target_host, "b", "No Reason", ircbot);
                                                    }
                                                }
                                                else
                                                {
                                                    ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                                }
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "akb":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        if (line.GetUpperBound(0) > 3)
                                        {
                                            string[] new_line = line[4].Split(charS, 2);
                                            string target_host = ircbot.get_nick_host(new_line[0]);
                                            string nicks = new_line[0].TrimStart(':');
                                            char[] charSep = new char[] { ',' };
                                            string[] total_nicks = nicks.Split(charSep, StringSplitOptions.RemoveEmptyEntries);
                                            int sent_nick_access = ircbot.get_nick_access(total_nicks[0], line[2]);
                                            bool tmp_me = false;
                                            for (int y = 0; y <= total_nicks.GetUpperBound(0); y++)
                                            {
                                                if (total_nicks[y].Trim().Equals(Conf.Name, StringComparison.InvariantCultureIgnoreCase))
                                                {
                                                    tmp_me = true;
                                                }
                                            }
                                            if (sent_nick_access == Conf.Owner_Level)
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :You can't kick-ban my owner!");
                                            }
                                            else if (tmp_me == true)
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :You can't kick-ban me!");
                                            }
                                            else
                                            {
                                                if (nick_access >= sent_nick_access)
                                                {
                                                    if (new_line.GetUpperBound(0) > 0)
                                                    {
                                                        add_auto(total_nicks[0], line[2], target_host, "kb", new_line[1], ircbot);
                                                    }
                                                    else
                                                    {
                                                        add_auto(total_nicks[0], line[2], target_host, "kb", "No Reason", ircbot);
                                                    }
                                                }
                                                else
                                                {
                                                    ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                                }
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "deak":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        if (line.GetUpperBound(0) > 3)
                                        {
                                            string target_host = ircbot.get_nick_host(line[4]);
                                            del_auto(line[4], line[2], target_host, "k", ircbot);
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "deab":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        if (line.GetUpperBound(0) > 3)
                                        {
                                            string target_host = ircbot.get_nick_host(line[4]);
                                            del_auto(line[4], line[2], target_host, "b", ircbot);
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "deakb":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        if (line.GetUpperBound(0) > 3)
                                        {
                                            string target_host = ircbot.get_nick_host(line[4]);
                                            del_auto(line[4], line[2], target_host, "kb", ircbot);
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "k":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        if (line.GetUpperBound(0) > 3)
                                        {
                                            string[] new_line = line[4].Split(charS, 2);
                                            string nicks = new_line[0].TrimStart(':');
                                            char[] charSep = new char[] { ',' };
                                            string[] total_nicks = nicks.Split(charSep, StringSplitOptions.RemoveEmptyEntries);
                                            int sent_nick_access = ircbot.get_nick_access(total_nicks[0], line[2]);
                                            bool tmp_me = false;
                                            for (int y = 0; y <= total_nicks.GetUpperBound(0); y++)
                                            {
                                                if (total_nicks[y].Trim().Equals(Conf.Name, StringComparison.InvariantCultureIgnoreCase))
                                                {
                                                    tmp_me = true;
                                                }
                                            }
                                            if (sent_nick_access == Conf.Owner_Level)
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :You can't kick my owner!");
                                            }
                                            else if (tmp_me == true)
                                            {
                                                ircbot.sendData("PRIVMSG", line[2] + " :You can't kick me!");
                                            }
                                            else
                                            {
                                                if (nick_access >= sent_nick_access)
                                                {
                                                    if (new_line.GetUpperBound(0) > 0)
                                                    {
                                                        ircbot.sendData("KICK", line[2] + " " + total_nicks[0] + " :" + new_line[1]);
                                                    }
                                                    else
                                                    {
                                                        ircbot.sendData("KICK", line[2] + " " + total_nicks[0] + " :No Reason");
                                                    }
                                                }
                                                else
                                                {
                                                    ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                                }
                                            }
                                        }
                                        else
                                        {
                                            ircbot.sendData("PRIVMSG", line[2] + " :" + nick + ", you need to include more info.");
                                        }
                                    }
                                    else
                                    {
                                        ircbot.sendData("NOTICE", nick + " :You do not have permission to use that command.");
                                    }
                                    break;
                                case "kme":
                                    if (spam_check == true)
                                    {
                                        ircbot.add_spam_count(channel);
                                    }
                                    if (nick_access >= tmp_command.Access)
                                    {
                                        if (line.GetUpperBound(0) > 3)
                                        {
                                            ircbot.sendData("KICK", line[2] + " " + nick + " :" + line[4]);
                                        }
                                        else
                                        {
                                            ircbot.sendData("KICK", line[2] + " " + nick + " :No Reason");
                                        }
                                    }
                                    break;
                            }
                        }
                    }
                }
            }
            if (type.Equals("join"))
            {
                string[] user_info = line[0].Split('@');
                string nick_host = user_info[1];
                check_auto(nick, channel.TrimStart(':'), nick_host, ircbot);
            }
        }