예제 #1
0
 static void Main(string[] args)
 {
     string channel = args[0];
     string rnick = args[1];
     string rmsg = args[2];
     try
     {
         string query = rmsg.Remove(0, 7);
         int queryindex = System.Int32.Parse(query);
         FervorLibrary.Library Greeting = new FervorLibrary.Library();
         string returngreet = Greeting.greet(queryindex);
         string response = "PRIVMSG " + channel + " :" + returngreet;
         System.Console.WriteLine(response);
     }
     catch (Exception ex)
     {
         System.Console.WriteLine(ex);
     }
 }
예제 #2
0
 static void Main(string[] args)
 {
     string channel = args[0];
     string rnick = args[1];
     string rmsg = args[2];
     try
     {
         string query = rmsg.Remove(0, 10);
         int queryindex = Int32.Parse(query);
         FervorLibrary.Library Farewell = new FervorLibrary.Library();
         string returnfarewell = Farewell.farewell(queryindex);
         string response = "PRIVMSG " + channel + " :" + returnfarewell;
         Console.WriteLine(response);
     }
     catch (Exception ex)
     {
         Console.WriteLine("PRIVMSG " + channel + " :" + ex.ToString());
     }
 }
예제 #3
0
        static void Main(string[] args)
        {
            string channel = args[0];
            string rnick   = args[1];
            string rmsg    = args[2];

            try
            {
                string query      = rmsg.Remove(0, 10);
                int    queryindex = Int32.Parse(query);
                FervorLibrary.Library Farewell = new FervorLibrary.Library();
                string returnfarewell          = Farewell.farewell(queryindex);
                string response = "PRIVMSG " + channel + " :" + returnfarewell;
                Console.WriteLine(response);
            }
            catch (Exception ex)
            {
                Console.WriteLine("PRIVMSG " + channel + " :" + ex.ToString());
            }
        }
예제 #4
0
        static void Main(string[] args)
        {
            string channel = args[0];
            string rnick   = args[1];
            string rmsg    = args[2];

            try
            {
                string query      = rmsg.Remove(0, 7);
                int    queryindex = System.Int32.Parse(query);
                FervorLibrary.Library Greeting = new FervorLibrary.Library();
                string returngreet             = Greeting.greet(queryindex);
                string response = "PRIVMSG " + channel + " :" + returngreet;
                System.Console.WriteLine(response);
            }
            catch (Exception ex)
            {
                System.Console.WriteLine(ex);
            }
        }
예제 #5
0
        static void Main(string[] args)
        {
            string channel = args[0];
            string rnick   = args[1];
            string rmsg    = args[2];

            try
            {
                ObsidianFunctions.Functions ObsidFunc = new ObsidianFunctions.Functions();
                bool nickuser = ObsidFunc.isActiveUser(rnick);
                if (nickuser == true)
                {
                    FervorLibrary.Library FervLib = new FervorLibrary.Library();
                    string query = rmsg.Remove(0, 10);
                    if (query == "true")
                    {
                        FervLib.greetTrue();
                        Console.WriteLine("PRIVMSG " + channel + " :Success!");
                    }
                    else if (query == "false")
                    {
                        FervLib.greetFalse();
                        Console.WriteLine("PRIVMSG " + channel + " :Success!");
                    }
                    else
                    {
                        Console.WriteLine("PRIVMSG " + channel + " :Invalid Input");
                    }
                }
                else
                {
                    Console.WriteLine("PRIVMSG " + channel + " :Insufficient permissions!");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("PRIVMSG " + channel + " :" + ex.ToString());
            }
        }
예제 #6
0
 static void Main(string[] args)
 {
     string channel = args[0];
     string rnick = args[1];
     string rmsg = args[2];
     try
     {
         ObsidianFunctions.Functions ObsidFunc = new ObsidianFunctions.Functions();
         bool nickuser = ObsidFunc.isActiveUser(rnick);
         if (nickuser == true)
         {
             FervorLibrary.Library FervLib = new FervorLibrary.Library();
             string query = rmsg.Remove(0, 10);
             if (query == "true")
             {
                 FervLib.greetTrue();
                 Console.WriteLine("PRIVMSG " + channel + " :Success!");
             }
             else if (query == "false")
             {
                 FervLib.greetFalse();
                 Console.WriteLine("PRIVMSG " + channel + " :Success!");
             }
             else
             {
                 Console.WriteLine("PRIVMSG " + channel + " :Invalid Input");
             }
         }
         else
         {
             Console.WriteLine("PRIVMSG " + channel + " :Insufficient permissions!");
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("PRIVMSG " + channel + " :" + ex.ToString());
     }
 }
예제 #7
0
파일: Form1.cs 프로젝트: ArkaneCow/Obsidian
        public string recv()
        {
            byte[] data = new byte[2048];
            sock.Receive(data, 2048, System.Net.Sockets.SocketFlags.None);
            mail = System.Text.ASCIIEncoding.UTF8.GetString(data).Replace("\0", "");
            if (mail.Contains(" "))
            {
                if (mail.Substring(0, 4) == "PING")
                {
                    string pserv = mail.Substring(mail.IndexOf(":"), mail.Length - mail.IndexOf(":"));
                    pserv = pserv.TrimEnd((char)0);
                    mail = "PING from " + pserv + "\r" + "PONG to " + pserv;
                    send("PONG " + pserv);
                }
                else if (mail.Substring(mail.IndexOf(" ") + 1, 7) == "PRIVMSG")
                {
                    string[] tmparr = null;
                    mail = mail.Remove(0, 1);
                    tmparr = mail.Split('!');
                    rnick = tmparr[0];
                    tmparr = mail.Split(':');
                    rmsg = tmparr[1].Trim() ;
                    string sayingto = Regex.Split(mail, "PRIVMSG ")[1].Split(':')[0].Substring(0, Regex.Split(mail, "PRIVMSG ")[1].Split(':')[0].Length - 1);
                    string commandName;
                    if (rmsg.Contains(" "))
                    {
                        commandName = rmsg.Substring(0, rmsg.IndexOf(' '));
                    }
                    else
                    {
                        commandName = rmsg;
                    }
                    bool nickblacklisted = isBlacklisted(rnick);
                    ObsidianFunctions.Functions ObsidBot = new ObsidianFunctions.Functions();
                    //MessageBox.Show("privmsg");
                    if (nickblacklisted == false)
                    {
                        foreach (string command in executableCommands)
                        {
                            if (commandName == "!" + command)
                            {
                                ObsidianFunctions.Functions ObsidFunc = new ObsidianFunctions.Functions();
                                send(ObsidFunc.exeExec(command + ".exe", channel, rnick, rmsg));
                            }
                        }
                        foreach (string command in jarCommands)
                        {
                            if (commandName == "!" + command.Replace(".jar", ""))
                            {
                                ObsidianFunctions.Functions ObsidFunc = new ObsidianFunctions.Functions();
                                send(ObsidFunc.jarExec(command, channel, rnick, rmsg));
                            }
                        }
                        foreach (string command in classCommands)
                        {
                            if (rmsg.StartsWith("!" + command))
                            {
                                ObsidianFunctions.Functions ObsidFunc = new ObsidianFunctions.Functions();
                                send(ObsidFunc.classExec(command, channel, rnick, rmsg));
                            }
                        }
                        foreach (string command in compileCommands)
                        {
                            if (commandName == "!" + command.Replace(".cs", ""))
                            {
                                ObsidianFunctions.Functions ObsidFunc = new ObsidianFunctions.Functions();
                                send(ObsidFunc.CSCompileRun(command, channel, rnick, rmsg));
                                configHashSet();
                            }
                        }
                        foreach (string command in javaCommands)
                        {
                            if (commandName == "!" + command.Replace(".java", ""))
                            {
                                ObsidianFunctions.Functions ObsidFunc = new ObsidianFunctions.Functions();
                                send(ObsidFunc.JavaCompileRun(command, channel, rnick, rmsg));
                                configHashSet();
                            }
                        }
                        //add AIML
                        if (sayingto == nick && rnick != nick && rmsg.StartsWith("!") == false)
                        {
                            ObsidianFunctions.Functions ObsidFunc = new ObsidianFunctions.Functions();
                            send(ObsidFunc.exeExec("botchat.exe", channel, rnick, rmsg));
                        }
                    }

                    if (ObsidBot.controlSpam() == true)
                    {
                        if (rmsg == oldmsg)
                        {
                            increaseSpamCount();
                            if (spamcount >= 4)
                            {
                                ObsidianFunctions.Functions ObsidFunc = new ObsidianFunctions.Functions();
                                if (ObsidFunc.isOperator() == true)
                                {
                                    send("KICK " + channel + " " + rnick + " No Spamming or Repeating one's self");
                                    spamcount = 0;
                                }
                                else
                                {
                                    send("PRIVMSG " + channel + " :Try not to spam or excessively repeat yourself");
                                    spamcount = 0;
                                }
                            }

                        }
                    }

                    ObsidianFunctions.Functions Obsid = new ObsidianFunctions.Functions();
                    if (Obsid.isLogging() == true)
                    {
                        logMsg();
                    }
                    detectLang();
                    bool newMessages = Obsid.hasMessages(rnick);
                    if (newMessages == true)
                    {
                        Obsid.sayMessages(rnick);
                    }
                }
                else if (mail.Substring(mail.IndexOf(" ") + 1, 4) == "JOIN")
                {

                    string[] tmparr = null;
                    mail = mail.Remove(0, 1);
                    tmparr = mail.Split('!');
                    rnick = tmparr[0];
                    FervorLibrary.Library Greetings = new FervorLibrary.Library();
                    if (Greetings.canGreet() == true)
                    {

                        Random rand = new Random();
                        int indexgreet = rand.Next(0, Greetings.greetnumber());
                        say(nick, "!greet " + indexgreet.ToString());
                    }
                    ObsidianFunctions.Functions ObsidFunc = new ObsidianFunctions.Functions();
                    bool newMessages = ObsidFunc.hasMessages(rnick);
                    if (newMessages == true)
                    {
                        say(rnick, "!You have messages");
                        string[] usermessages = ObsidFunc.sayMessages(rnick);
                        foreach (string x in usermessages)
                        {
                            send(x);
                        }
                    }
                    say(nick, "!names");
                }
                else if (mail.Substring(mail.IndexOf(" ") + 1, 4) == "PART" || mail.Substring(mail.IndexOf(" ") + 1, 4) == "QUIT")
                {
                    ObsidianFunctions.Functions ObsidBot = new ObsidianFunctions.Functions();
                    string[] tmparr = null;
                    mail = mail.Remove(0, 1);
                    tmparr = mail.Split('!');
                    rnick = tmparr[0];
                    FervorLibrary.Library FervLib = new FervorLibrary.Library();
                    if (FervLib.canGreet() == true)
                    {

                        Random rand = new Random();

                        int indexfarewell = rand.Next(0, FervLib.farewellnumber());
                        say(nick, "!farewell " + indexfarewell.ToString());
                    }
                    ObsidianFunctions.Functions ObsidFunc = new ObsidianFunctions.Functions();
                    say(rnick, ObsidFunc.deactivate(rnick, rmsg));
                    if (rnick == ObsidBot.talkingTo())
                    {
                        ObsidBot.settalkingTo("nobody");
                    }
                    say(nick, "!names");
                }
                else if (mail.Substring(mail.IndexOf(" ") + 1, 4) == "MODE")
                {
                    mail = mail.Replace("\0", "").Trim();
                    int nameopslength = nick.Length + 3;
                    string action = mail.Substring(mail.Length - nameopslength);
                    if (action.StartsWith("+o") | action.StartsWith("+r") | action.StartsWith("+h"))
                    {
                        ObsidianFunctions.Functions ObsidFunc = new ObsidianFunctions.Functions();
                        ObsidFunc.opTrue();
                        send("PRIVMSG " + channel + " :isOperator = true");

                    }
                    else if (action.StartsWith("-o") | action.StartsWith("-r") | action.StartsWith("-h"))
                    {
                        ObsidianFunctions.Functions ObsidFunc = new ObsidianFunctions.Functions();
                        ObsidFunc.opFalse();
                        send("PRIVMSG " + channel + " :isOperator = false");
                    }

                }
                else if (mail.Substring(mail.IndexOf(" ") + 1, 4) == "KICK")
                {
                    string[] tmparr = null;
                    mail = mail.Remove(0, 1);
                    tmparr = mail.Split('!');
                    rnick = tmparr[0];
                    tmparr = mail.Split(':');
                    rmsg = tmparr[1];
                    ObsidianFunctions.Functions ObsidFunc = new ObsidianFunctions.Functions();
                    say(rnick, ObsidFunc.deactivate(rnick, rmsg)) ;
                }
                else if (mail.Substring(mail.IndexOf(" ") + 1, 3) == "353")
                {
                    string[] tmparr = null;
                    mail = mail.Remove(0, 1);
                    tmparr = mail.Split(':');
                    rmsg = tmparr[1];
                    ObsidianFunctions.Functions ObsidFunc = new ObsidianFunctions.Functions();
                    say(nick, ObsidFunc.setNames(rmsg));
                }
                else if (mail.Substring(mail.IndexOf(" ") + 1, 4) == "NICK")
                {
                    string[] tmparr = null;
                    mail = mail.Remove(0, 1);
                    tmparr = mail.Split('!');
                    rnick = tmparr[0];
                    tmparr = mail.Split(':');
                    string newnick = tmparr[1];
                    ObsidianFunctions.Functions ObsidFunc = new ObsidianFunctions.Functions();
                    say(rnick, ObsidFunc.deactivate(rnick, rmsg));
                    bool newMessages = ObsidFunc.hasMessages(newnick);
                    if (newMessages == true)
                    {
                        ObsidFunc.sayMessages(newnick);
                    }
                }
            }
            oldMsg();
            return mail;
        }
예제 #8
0
파일: Form1.cs 프로젝트: ArkaneCow/Obsidian
 public void GreetConfig()
 {
     if (System.IO.File.Exists("greet.bin") == false)
     {
         System.IO.StreamWriter greetwrite = new System.IO.StreamWriter("greet.bin");
         greetwrite.Write("Hallo,Ahlan,Ni Hao,Ahoj,Goddag,Goede dag,Hello,Bonjour,Guten Tag,Aloha,Shalom,Namaste,Dia dhuit,Ciao,Kon-nichiwa,Zdrasti,Hola,Hej,Sawubona~");
         greetwrite.Write("Afrikaans,Arabic,Chinese,Czech,Danish,Dutch,English,French,German,Hawaiian,Hebrew,Hindi,Irish,Italian,Japanese,Russian,Spanish,Swedish,Zulu");
         greetwrite.Close();
         System.IO.StreamReader greetread = new System.IO.StreamReader("greet.bin");
         string greetraw = greetread.ReadToEnd();
         string[] split = greetraw.Split(',');
         FervorLibrary.Library FervLib = new FervorLibrary.Library();
         FervLib.setgreetnumber(split.Length / 2);
     }
     else if (System.IO.File.Exists("greet.bin") == true)
     {
         System.IO.StreamReader greetread = new System.IO.StreamReader("greet.bin");
         string greetraw = greetread.ReadToEnd();
         string[] split = greetraw.Split(',');
         FervorLibrary.Library FervLib = new FervorLibrary.Library();
         FervLib.setgreetnumber(split.Length / 2);
     }
 }
예제 #9
0
파일: Form1.cs 프로젝트: ArkaneCow/Obsidian
 public void FarewellConfig()
 {
     if (System.IO.File.Exists("farewell.bin") == false)
     {
         System.IO.StreamWriter farewellwrite = new System.IO.StreamWriter("farewell.bin");
         farewellwrite.Write("Tosiens,Ma'a as-salaama,Zai Jian,Sbohem,Farvel,Afscheid,Goodbye,Au revoir,Aurf Wiedersehen,Aloha,Kol Tuv,Ach-ha,Slan agat,Addio,Sayonara,Pa-ka,Adios,Adjo,Hamba kahle~");
         farewellwrite.Write("Afrikaans,Arabic,Chinese,Czech,Danish,Dutch,English,French,German,Hawaiian,Hebrew,Hindi,Irish,Italian,Japanese,Russian,Spanish,Swedish,Zulu");
         farewellwrite.Close();
         System.IO.StreamReader farewellread = new System.IO.StreamReader("farewell.bin");
         string farewellraw = farewellread.ReadToEnd();
         string[] split = farewellraw.Split(',');
         FervorLibrary.Library FervLib = new FervorLibrary.Library();
         FervLib.setfarewellnumber(split.Length / 2);
     }
     else if (System.IO.File.Exists("farewell.bin") == true)
     {
         System.IO.StreamReader farewellread = new System.IO.StreamReader("farewell.bin");
         string farewellraw = farewellread.ReadToEnd();
         string[] split = farewellraw.Split(',');
         FervorLibrary.Library FervLib = new FervorLibrary.Library();
         FervLib.setfarewellnumber(split.Length / 2);
     }
 }
예제 #10
0
파일: Form1.cs 프로젝트: buzzbyte/Obsidian
        public string recv()
        {
            byte[] data = new byte[2048];
            sock.Receive(data, 2048, System.Net.Sockets.SocketFlags.None);
            mail = System.Text.ASCIIEncoding.UTF8.GetString(data).Replace("\0", "");
            if (mail.Contains(" "))
            {
                if (mail.Substring(0, 4) == "PING")
                {
                    string pserv = mail.Substring(mail.IndexOf(":"), mail.Length - mail.IndexOf(":"));
                    pserv = pserv.TrimEnd((char)0);
                    mail = "PING from " + pserv + "\r" + "PONG to " + pserv;
                    send("PONG " + pserv);
                }
                else if (mail.Substring(mail.IndexOf(" ") + 1, 7) == "PRIVMSG")
                {
                    string[] tmparr = null;
                    mail = mail.Remove(0, 1);
                    tmparr = mail.Split('!');
                    rnick = tmparr[0];
                    tmparr = mail.Split(':');
                    rmsg = tmparr[1];
                    bool nickblacklisted = isBlacklisted(rnick);

                    if (nickblacklisted == false)
                    {
                        if (rmsg.Contains("!respond") == true)
                        {
                            string response = "PRIVMSG " + channel + " :Response";
                            send(response);
                        }
                        else if (rmsg.Contains("!greet "))
                        {
                            string query = rmsg.Remove(0, 7);
                            try
                            {
                                int queryindex = Int32.Parse(query);
                                if (queryindex <= greetnumber)
                                {
                                    FervorLibrary.Library Greeting = new FervorLibrary.Library();
                                    string returngreet = Greeting.greet(queryindex);

                                    string response = "PRIVMSG " + channel + " :" + returngreet;
                                    send(response);
                                }
                                else
                                {
                                    send("PRIVMSG " + channel + " :I don't know that many languages!");
                                }
                            }
                            catch (Exception ex)
                            {
                                send("PRIVMSG " + channel + " :Something went wrong: " + ex);
                            }

                        }
                        else if (rmsg.Contains("!farewell "))
                        {
                            string query = rmsg.Remove(0, 10);
                            try
                            {
                                int queryindex = Int32.Parse(query);
                                if (queryindex <= greetnumber)
                                {
                                    FervorLibrary.Library Farewelling = new FervorLibrary.Library();
                                    string returnfarewell = Farewelling.farewell(queryindex);
                                    string response = "PRIVMSG " + channel + " :" + returnfarewell;
                                    send(response);
                                }
                                else
                                {
                                    send("PRIVMSG " + channel + " :I don't know that many languages!");
                                }
                            }
                            catch (Exception ex)
                            {
                                send("PRIVMSG " + channel + " :Something went wrong: " + ex);
                            }
                        }
                        else if (rmsg.Contains("!md5 "))
                        {
                            generateMD5message ();
                        }
                        else if (rmsg.Contains("!register "))
                        {
                            reqreguser ();
                        }
                        else if (rmsg.Contains("!registerlist"))
                        {
                            listregs ();
                        }
                        else if (rmsg.Contains("!clearregisterlist"))
                        {
                            clearregs ();
                        }
                        else if (rmsg.Contains("!active "))
                        {
                            activateUser ();
                        }
                        else if (rmsg.Contains("!deactivate"))
                        {
                            deactivateUser ();
                        }
                        else if (rmsg.Contains("!adduser "))
                        {
                            System.IO.StreamReader sr = new StreamReader(".activeusers");
                            string[] users = sr.ReadToEnd().Split(':');
                            sr.Close();
                            foreach (string x in users)
                            {
                                if (x.Contains(rnick))
                                {
                                    string query = rmsg.Remove(0, 9);
                                    ObsidianFunctions.Functions obsidfunc = new ObsidianFunctions.Functions();
                                    string list = obsidfunc.addUser(query);
                                    send("PRIVMSG " + channel + " :" + list);
                                }
                            }
                        }

                        else if (rmsg.Contains("!removeuser "))
                        {
                            System.IO.StreamReader sr = new StreamReader(".activeusers");
                            string[] users = sr.ReadToEnd().Split(':');
                            sr.Close();
                            foreach (string x in users)
                            {
                                if (x.Contains(rnick))
                                {
                                    string query = rmsg.Remove(0, 12);
                                    ObsidianFunctions.Functions obsidfunc = new ObsidianFunctions.Functions();
                                    string list = obsidfunc.removeUser(query);
                                    send("PRIVMSG " + channel + " :" + list);
                                }
                            }
                        }
                        else if (rmsg.Contains("!userlist"))
                        {
                            listUsers();
                        }
                        else if (rmsg.Contains("!botquit"))
                        {
                            bool nickisuser = isActiveUser(rnick);
                            if (nickisuser == true)
                            {
                                send("QUIT");
                            }
                            else
                            {
                                send("PRIVMSG " + channel + " :Insufficient permissions!");
                            }
                        }
                        else if (rmsg.Contains("!addops "))
                        {
                            if (isOperator == true)
                            {
                                string query = rmsg.Remove(0, 8);
                                bool nickisuser = isActiveUser(rnick);
                                if (nickisuser == true)
                                {
                                    send("MODE " + channel + " +o " + query);
                                }
                                else
                                {
                                    send("PRIVMSG " + channel + " :Insufficient permissions!");
                                }
                            }
                        }
                        else if (rmsg.Contains("!removeops "))
                        {
                            if (isOperator == true)
                            {
                                string query = rmsg.Remove(0, 11);
                                bool nickisuser = isActiveUser(rnick);
                                if (nickisuser == true)
                                {
                                    send("MODE " + channel + " -o " + query);
                                }
                                else
                                {
                                    send("PRIVMSG " + channel + " :Insufficient permissions!");
                                }
                            }
                        }
                        else if (rmsg.Contains("!kick "))
                        {
                            if (isOperator == true)
                            {
                                string query = rmsg.Remove(0, 6);
                                bool nickuser = isActiveUser(rnick);
                                if (nickuser == true)
                                {
                                    send("KICK " + channel + " " + query + " User-requested kick");
                                }
                                else
                                {
                                    send("PRIVMSG " + channel + " :Insufficient permissions!");
                                }
                            }
                        }

                        else if (rmsg.Contains("!batch "))
                        {
                            string query = rmsg.Remove(0, 7);
                            bool nickuser = isActiveUser(rnick);
                            if (rnick == ownernick && nickuser == true)
                            {
                                ObsidianFunctions.Functions ObsidFunc = new ObsidianFunctions.Functions();
                                ObsidFunc.batch(query);
                                send("PRIVMSG " + channel + " :Success!");
                            }
                            else
                            {
                                send("PRIVMSG " + channel + " :Insufficient Permissions!");
                            }
                        }
                        else if (rmsg.Contains("!cscompile "))
                        {
                            string query = rmsg.Remove(0, 11).Replace("\0", "").Trim();
                            bool nickuser = isActiveUser(rnick);
                            if (rnick == ownernick && nickuser == true)
                            {
                                ObsidianFunctions.Functions ObsidFunc = new Functions();
                                say(channel, ObsidFunc.CSCompile(query));

                            }
                            else
                            {
                                send("PRIVMSG " + channel + " :Insufficient Permissions!");
                            }
                        }
                        else if (rmsg.Contains("!log start"))
                        {
                            bool nickuser = isActiveUser(rnick);
                            if (nickuser == true)
                            {
                                isLogging = true;
                                send("PRIVMSG " + channel + " :Success!");
                            }
                            else
                            {
                                send("PRIVMSG " + channel + " :Insufficient Permissions!");
                            }
                        }
                        else if (rmsg.Contains("!log stop"))
                        {
                            bool nickuser = isActiveUser(rnick);
                            if (nickuser == true)
                            {
                                isLogging = false;
                                send("PRIVMSG " + channel + " :Success!");
                            }
                            else
                            {
                                send("PRIVMSG " + channel + " :Insufficient Permissions!");
                            }
                        }
                        else if (rmsg.Contains("!calc "))
                        {
                            ObsidianFunctions.Functions ObsidFunc = new ObsidianFunctions.Functions();
                            string query = rmsg.Remove(0, 6);
                            float answer = ObsidFunc.calc(query);
                            send("PRIVMSG " + channel + " :" + answer.ToString());
                        }
                        else if (rmsg.Contains("!isOperator true"))
                        {
                            bool nickuser = isActiveUser(rnick);
                            if (nickuser == true)
                            {
                                isOperator = true;
                                send("PRIVMSG " + channel + " :isOperator = true");
                            }
                            else
                            {
                                send("PRIVMSG " + channel + " :Insufficient Permissions!");
                            }
                        }
                        else if (rmsg.Contains("!isOperator false"))
                        {
                            bool nickuser = isActiveUser(rnick);
                            if (nickuser == true)
                            {
                                isOperator = false;
                                send("PRIVMSG " + channel + " :isOperator = false");
                            }
                            else
                            {
                                send("PRIVMSG " + channel + " :Insufficient Permissions!");
                            }
                        }
                        else if (rmsg.Contains("!botchat"))
                        {
                            if (talkingTo != "nobody")
                            {
                                send("PRIVMSG " + rnick + " :Sorry, I'm already talking with someone");
                            }
                            else
                            {
                                talkingTo = rnick;
                                FervorLibrary.Library Greetings = new FervorLibrary.Library();
                                Random rand = new Random();
                                int indexgreet = rand.Next(0, greetnumber);
                                string greeting = Greetings.Greeting(rnick, indexgreet);
                                send("PRIVMSG " + rnick + " :" + greeting);
                                botChat();
                            }

                        }
                        else if (rmsg.Contains("quit"))
                        {
                            if (rnick == talkingTo)
                            {
                                talkingTo = "nobody";
                            }
                        }
                        else if (rnick == talkingTo)
                        {

                            Request r = new Request(rmsg, chatUser, chatBot);
                            Result res = chatBot.Chat(r);
                            send("PRIVMSG " + talkingTo + " :" + res.Output);

                        }
                        else if (rmsg.Contains("!udefine "))
                        {
                            string query = rmsg.Remove(0, 9);
                            ObsidianFunctions.Functions ObsidFunc = new ObsidianFunctions.Functions();
                            string definition = ObsidFunc.uDefine(query);
                            send("PRIVMSG " + channel + " :" + definition);
                        }
                        else if (rmsg.Contains("!ddefine "))
                        {
                            string query = rmsg.Remove(0, 9);
                            ObsidianFunctions.Functions ObsidFunc = new ObsidianFunctions.Functions();
                            string definition = ObsidFunc.dDefine(query);
                            send("PRIVMSG " + channel + " :" + definition);
                        }
                        else if (rmsg.Contains("!canGreet true"))
                        {
                            bool nickuser = isActiveUser(rnick);
                            if (nickuser == true)
                            {
                                canGreet = true;
                                send("PRIVMSG " + channel + " :Success!");
                            }
                            else
                            {
                                send("PRIVMSG " + channel + " :Insufficient permissions!");
                            }
                        }
                        else if (rmsg.Contains("!canGreet false"))
                        {
                            bool nickuser = isActiveUser(rnick);
                            if (nickuser == true)
                            {
                                canGreet = false;
                                send("PRIVMSG " + channel + " :Success!");
                            }
                            else
                            {
                                send("PRIVMSG " + channel + " :Insufficient permissions!");
                            }
                        }
                        else if (rmsg.Contains("!wdefine "))
                        {
                            string query = rmsg.Remove(0, 9);
                            ObsidianFunctions.Functions ObsidFunc = new ObsidianFunctions.Functions();
                            string definition = ObsidFunc.wDefine(query);
                            send("PRIVMSG " + channel + " :" + definition);
                        }
                        else if (rmsg.Contains("!sha1 "))
                        {
                            Thread sha1hash = new Thread(generatesha1message);
                            sha1hash.Start();
                        }
                        else if (rmsg.Contains("!sha256 "))
                        {
                            Thread sha256hash = new Thread(generatesha256message);
                            sha256hash.Start();
                        }
                        else if (rmsg.Contains("!sha384 "))
                        {
                            Thread sha384hash = new Thread(generatesha384message);
                            sha384hash.Start();
                        }
                        else if (rmsg.Contains("!sha512 "))
                        {
                            Thread sha512hash = new Thread(generatesha512message);
                            sha512hash.Start();
                        }
                        else if (rmsg.Contains("!blacklistadd "))
                        {
                            bool nickuser = isActiveUser(rnick);
                            if (nickuser == true)
                            {
                                string query = rmsg.Remove(0, 14);
                                Functions ObsidFunc = new Functions();
                                blacklist = ObsidFunc.addBlacklist(query);
                                string newlist = String.Join(":", blacklist);
                                send("PRIVMSG " + channel + " :" + newlist);
                            }
                            else
                            {
                                send("PRIVMSG " + channel + " :Insufficient Permissions!");
                            }
                        }
                        else if (rmsg.Contains("!blacklistremove "))
                        {
                            bool nickuser = isActiveUser(rnick);
                            if (nickuser == true)
                            {
                                string query = rmsg.Remove(0, 17);
                                Functions ObsidFunc = new Functions();
                                blacklist = ObsidFunc.removeBlacklist(query);
                                string newlist = String.Join(":", blacklist);
                                if (newlist == null || newlist == "")
                                {
                                    newlist = "None";
                                }
                                send("PRIVMSG " + channel + " :" + newlist);
                            }
                            else
                            {
                                send("PRIVMSG " + channel + ":Insufficient Permissions!");
                            }
                        }
                        else if (rmsg.Contains("!blacklist"))
                        {
                            listBlacklist();
                        }
                        else if (rmsg.Contains("!get "))
                        {
                            string query = rmsg.Remove(0, 5);
                            if (query.StartsWith("me "))
                            {
                                string query2 = query.Remove(0, 3);
                                query = rnick + " " + query2;
                            }
                            say(channel, "Let me get that for you!");
                            say(channel, "\u0001ACTION " + "gives " + query + "\u0001");
                            say(channel, "There you go!");
                        }
                        else if (rmsg.Contains("!google "))
                        {
                            string query = rmsg.Remove(0, 8);
                            string googleURL = "http://google.com/search?q=" + query;
                            say(channel, googleURL);
                        }
                        else if (rmsg.Contains("!ircuserlist"))
                        {
                            Thread listircusers = new Thread(channelUsers);
                            listircusers.Start();
                            Thread saylistircusers = new Thread(saychannelUsers);
                            saylistircusers.Start();
                        }
                        else if (rmsg.Contains("!message "))
                        {
                            try
                            {
                                string sender = rnick;
                                string query = rmsg.Remove(0, 9);
                                string[] parsenick = query.Split('>');
                                string recipient = parsenick[0];
                                string message = "<" + sender + ">" + parsenick[1].Replace("~", "");
                                bool nickOnline = isOnline(recipient);
                                if (nickOnline == true)
                                {
                                    say(recipient, message);
                                    say(sender, "Message sent!");
                                }
                                else if (nickOnline == false)
                                {
                                    say(sender, "I'll tell " + recipient + " when he or she is online.");
                                    addMessage(recipient, message);
                                }

                            }
                            catch (Exception ex)
                            {
                                say(rnick, ex.ToString());
                            }
                        }
                        else if (rmsg.Contains("!spamControl true"))
                        {
                            bool nickuser = isActiveUser(rnick);
                            if (nickuser == true)
                            {
                                controlSpam = true;
                                say(channel, "spamControl = true");
                            }
                            else
                            {
                                say(rnick, "Insufficient permissions!");
                            }
                        }
                        else if (rmsg.Contains("!spamControl false"))
                        {
                            bool nickuser = isActiveUser(rnick);
                            if (nickuser == true)
                            {
                                controlSpam = false;
                                say(channel, "spamControl = false");
                            }
                            else
                            {
                                say(rnick, "Insufficient permissions!");
                            }
                        }
                        else if (rmsg.Contains("forcequit"))
                        {
                            bool nickuser = isActiveUser(rnick);
                            if (nickuser == true)
                            {
                                talkingTo = "nobody";
                            }
                            else
                            {
                                say(rnick, "Insufficient permissions!");
                            }
                        }
                        //commands end
                    }
                    if (controlSpam == true)
                    {
                        if (rmsg == oldmsg)
                        {
                            increaseSpamCount();
                            if (spamcount >= 4)
                            {
                                if (isOperator == true)
                                {
                                    send("KICK " + channel + " " + rnick + " No Spamming or Repeating one's self");
                                    spamcount = 0;
                                }
                                else
                                {
                                    send("PRIVMSG " + channel + " :Try not to spam or excessively repeat yourself");
                                    spamcount = 0;
                                }
                            }

                        }
                    }
                    if (isLogging == true)
                    {
                        logMsg();
                    }
                    detectLang();
                    bool newMessages = hasMessages(rnick);
                    if (newMessages == true)
                    {
                        sayMessages(rnick);
                    }
                }
                else if (mail.Substring(mail.IndexOf(" ") + 1, 4) == "JOIN")
                {

                    string[] tmparr = null;
                    mail = mail.Remove(0, 1);
                    tmparr = mail.Split('!');
                    rnick = tmparr[0];
                    if (canGreet == true)
                    {
                        FervorLibrary.Library Greetings = new FervorLibrary.Library();
                        Random rand = new Random();
                        int indexgreet = rand.Next(0, greetnumber);
                        string greeting = Greetings.Greeting(rnick, indexgreet);
                        string greetingmessage = "PRIVMSG " + channel + " :" + greeting;
                        send(greetingmessage);
                    }
                    bool newMessages = hasMessages(rnick);
                    if (newMessages == true)
                    {
                        sayMessages(rnick);
                    }
                }
                else if (mail.Substring(mail.IndexOf(" ") + 1, 4) == "PART" | mail.Substring(mail.IndexOf(" ") + 1, 4) == "QUIT")
                {

                    string[] tmparr = null;
                    mail = mail.Remove(0, 1);
                    tmparr = mail.Split('!');
                    rnick = tmparr[0];
                    if (canGreet == true)
                    {
                        FervorLibrary.Library Farewells = new FervorLibrary.Library();
                        Random rand = new Random();
                        int indexfarewell = rand.Next(0, farewellnumber);
                        string farewell = Farewells.Farewell(rnick, indexfarewell);
                        string farewellmessage = "PRIVMSG " + channel + " :" + farewell;
                        send(farewellmessage);
                    }
                    Thread deactive = new Thread(deactivateUser);
                    deactive.Start();
                    if (rnick == talkingTo)
                    {
                        talkingTo = "nobody";
                    }

                }
                else if (mail.Substring(mail.IndexOf(" ") + 1, 4) == "MODE")
                {
                    mail = mail.Replace("\0", "").Trim();
                    int nameopslength = nick.Length + 3;
                    string action = mail.Substring(mail.Length - nameopslength);
                    if (action.StartsWith("+o") | action.StartsWith("+r") | action.StartsWith("+h"))
                    {
                        isOperator = true;
                        send("PRIVMSG " + channel + " :isOperator = true");

                    }
                    else if (action.StartsWith("-o") | action.StartsWith("-r") | action.StartsWith("-h"))
                    {
                        isOperator = false;
                        send("PRIVMSG " + channel + " :isOperator = false");
                    }

                }
                else if (mail.Substring(mail.IndexOf(" ") + 1, 4) == "KICK")
                {
                    string[] tmparr = null;
                    mail = mail.Remove(0, 1);
                    tmparr = mail.Split('!');
                    rnick = tmparr[0];
                    tmparr = mail.Split(':');
                    rmsg = tmparr[1];
                    deactivateUser();
                }
                else if (mail.Substring(mail.IndexOf(" ") + 1, 4) == "NICK")
                {
                    string[] tmparr = null;
                    mail = mail.Remove(0, 1);
                    tmparr = mail.Split('!');
                    rnick = tmparr[0];
                    tmparr = mail.Split(':');
                    string newnick = tmparr[1];
                    deactivateUser();
                    bool newMessages = hasMessages(newnick);
                    if (newMessages == true)
                    {
                        sayMessages(newnick);
                    }
                }
            }
            oldMsg();
            return mail;
        }