This project is part of my speech recognition console application that can be found at brettanda.ca/projects/friday-discord-bot. I am making this part of the application as part of a failsafe if the speech recognition stops working properly. This command is also run during the startup of the bot and shows the status of the bot while booting.

In Discord you can communicate with this bot by typing commands in any chat that the bot also has access to.

class Program    {        public static Boolean isConvo = false;        public static bool error = false;        static readonly List<string> Websites = new List<string>(new string[] { "brettanda.ca" });        ///<summary>        ///<para>The main startup</para>        ///</summary>        static void Main(string[] args)        {            bool CheckInternetConnection()            {                try                {                    using (var client = new WebClient())                    using (client.OpenRead("https/clients3.google.com"))                    {                        return true;                    }                }                catch                {                    return false;                }            }            Console.Title = "Friday";            bool connection = CheckInternetConnection();            if (connection == true)            {                TypeWriter("Internet Connectivity Status: ");                TypeWriter("Online", ConsoleColor.Green);                Console.WriteLine();            }            else            {                TypeWriter("Internet Connectivity Status: ");                TypeWriter("Offline", ConsoleColor.Red);                Console.WriteLine();                TypeWriter("Check your connection settings", ConsoleColor.Yellow);                Console.WriteLine();            }            TypeWriter("Running on: " + System.Environment.MachineName);            Console.WriteLine();            //Modules.FridaySpeech.Start();            if (connection == true)            {                foreach (string website in Websites)                {                    //ConsoleSpinner spin = new ConsoleSpinner();                    LoadProgress("Working...");                    string web = CheckWebsiteStatus(website);                    /*while (web != "true" && web != "false" && web == "")                    {                        spin.Turn();                    }*/                    if (web != "true" && web != "false")                    {                        TypeWriter(web, ConsoleColor.Yellow);                        Console.WriteLine();                    }                    else if (web == "true")                    {                        TypeWriter(website, ConsoleColor.Magenta);                        TypeWriter(" Status: ");                        TypeWriter("Online", ConsoleColor.Green);                        Console.WriteLine();                    }                    else if (web == "false")                    {                        TypeWriter(website, ConsoleColor.Magenta);                        TypeWriter(" Status: ");                        TypeWriter("Offline", ConsoleColor.Red);                        Console.WriteLine();                    }                    else                    {                        TypeWriter(web, ConsoleColor.Yellow);                    }                    /*if (CheckWebsiteStatus(website) == true)                    {                        TypeWriter(website + " Status: ");                        Console.ForegroundColor = ConsoleColor.Green;                        TypeWriter("Online");                        Console.ForegroundColor = ConsoleColor.White;                        Console.WriteLine();                    }                    else                    {                        TypeWriter(website + " Status: ");                        Console.ForegroundColor = ConsoleColor.Red;                        TypeWriter("Offline");                        Console.ForegroundColor = ConsoleColor.White;                        Console.WriteLine();                    }*/                }            }            else            {                foreach (string website in Websites)                {                    TypeWriter(website + " status: ");                    TypeWriter("Offline", ConsoleColor.Red);                    Console.WriteLine();                }            }            Modules.FridaySpeech.Start();            TypeWriter("The time is " + string.Format("{0:h:mm:ss tt}", DateTime.Now));            Console.WriteLine();            Modules.FridaySpeech.Begin();            Messages();        }        public static void Messages()        {            string message = Console.ReadLine();            bool YorN;            if (message != null || message != "")            {                if (message.ToLower().Contains("friday") && message.Length == "friday".Length)                {                    Random randwhat = new Random();                    int indexw = randwhat.Next(Modules.Variables.WhatUp.Count);                    SendMessage(Uppercasefirst(Modules.Variables.WhatUp[indexw]), message);                    Messages();                }                foreach (string greet in Modules.Variables.Greetings)                {                    if (message.ToLower().Contains(greet) && IsOwnWord(greet, message) == true)                    {                        SendMessage(Uppercasefirst(greet), message);                        Messages();                    }                }                foreach (string fare in Modules.Variables.Farewells)                {                    if (message.ToLower().Contains(fare) && IsOwnWord(fare, message) == true)                    {                        SendMessage(Uppercasefirst(fare), message);                        Messages();                    }                }                foreach (string thank in Modules.Variables.Thanks)                {                    if (message.ToLower().Contains(thank) && IsOwnWord(thank, message) == true)                    {                        Random randthank = new Random();                        int indext = randthank.Next(Modules.Variables.Thanks.Count);                        SendMessage(Uppercasefirst(Modules.Variables.Thanks[indext]), message);                        Messages();                    }                }                if (message.ToLower().Contains("time") && Question(message) == true)                {                    SendMessage(Uppercasefirst("the time is " + string.Format("{0:hh:mm:ss tt}", DateTime.Now)), message);                    Messages();                }                if (message.ToLower() == "close" || message.ToLower() == "exit" || message.ToLower() == "quit")                {                    SendMessage(Uppercasefirst("are you sure?"), message);                    YorN = GetYorN();                    if (YorN == true)                    {                        Environment.Exit(0);                    }                    else if (YorN == false)                    {                        SendMessage(Uppercasefirst("YAY"), message);                        Messages();                    }                }                if (message.ToLower().Contains("start voice"))                {                    FridayAI.Modules.FridaySpeech.Begin();                }                if (message.ToLower().Contains("stop voice"))                {                    Modules.FridaySpeech.Stop();                }                if (message.ToLower().Contains("add") && message.ToLower().Contains("event"))                {                    Modules.Google.AddEvent("test", "test");                    SendMessage(Uppercasefirst("event added"), message);                    Messages();                }                if (message.ToLower().Contains("is hurt"))                {                    SendMessage(Uppercasefirst("was it something that you did?"), message);                    YorN = GetYorN();                    if (YorN == true)                    {                        SendMessage(Uppercasefirst("do you know what you did?"), message);                        YorN = GetYorN();                        if (YorN == true)                        {                            //SendMessage(Uppercasefirst("talk to her about it, and make her feel better."), message);                            SendMessage(Uppercasefirst("are you with her right now?"), message);                            YorN = GetYorN();                            if(YorN == true)                            {                                SendMessage(Uppercasefirst("have you tried anything physical like a hug or trying to hold her hand?"), message);                                YorN = GetYorN();                                if (YorN == true)                                {                                }                                else                                {                                    SendMessage(Uppercasefirst("have you tried talking to her?"), message);                                    YorN = GetYorN();                                    if (YorN == true)                                    {                                    }                                    else                                    {                                        SendMessage(Uppercasefirst("?"), message);                                        YorN = GetYorN();                                        if (YorN == true)                                        {                                        }                                        else                                        {                                        }                                    }                                }                            }                            else                            {                                SendMessage(Uppercasefirst("Are you in a call with her, or are you able to talk to her?"), message);                                YorN = GetYorN();                                if (YorN == true)                                {                                    SendMessage(Uppercasefirst("?"), message);                                    YorN = GetYorN();                                    if (YorN == true)                                    {                                    }                                    else                                    {                                    }                                }                                else                                {                                    SendMessage(Uppercasefirst("?"), message);                                    YorN = GetYorN();                                    if (YorN == true)                                    {                                    }                                    else                                    {                                    }                                }                            }                        }                        else if (YorN == false)                        {                            SendMessage(Uppercasefirst("have you already asked what you have done?"), message);                            YorN = GetYorN();                            if (YorN == true)                            {                                SendMessage(Uppercasefirst("first, don't ask anymore but don't forget what the answer was when you did ask."), message);                                Messages();                            }                            else if (YorN == false)                            {                                SendMessage(Uppercasefirst("ask her immediately and remember the answer. Then you better make sence of it."), message);                                Messages();                            }                        }                    }                    else if (YorN == false)                    {                        SendMessage(Uppercasefirst("did someone else do it?"), message);                        YorN = GetYorN();                        if (YorN == true)                        {                            SendMessage(Uppercasefirst("were you able to prevent this thing from happening?"), message);                            YorN = GetYorN();                            if (YorN == true)                            {                                SendMessage(Uppercasefirst(""), message);                            }                            else if (YorN == false)                            {                                SendMessage(Uppercasefirst("was this something you were able to take action after it had happened?"), message);                                YorN = GetYorN();                                if (YorN == true)                                {                                    SendMessage(Uppercasefirst("is there something that you can still do to fix what you should have done ealier?"), message);                                    YorN = GetYorN();                                    if (YorN == true)                                    {                                        SendMessage(Uppercasefirst("find what you can do to help and do it before this gets worse."), message);                                        Messages();                                    }                                    else if (YorN == false)                                    {                                    }                                }                                else if (YorN == false)                                {                                }                            }                        }                        else if (YorN == false)                        {                            SendMessage(Uppercasefirst("did she do something to her self?"), message);                            YorN = GetYorN();                            if (YorN == true)                            {                            }                            else if (YorN == false)                            {                            }                        }                    }                }                if (message.ToLower().Contains("message"))                {                    SendNotification("title", "message");                    Messages();                }                error = true;                SendMessage(Uppercasefirst("i don't know how to repond to that, sorry."), message);                error = false;            }            Messages();        }        /*public class ConsoleSpinner        {            int counter;            public ConsoleSpinner()            {                counter = 0;            }            public void Turn()            {                counter++;                if(counter == 0)                {                    Console.Write("/");                }else if(counter == 1)                {                    Console.Write("-");                }else if(counter == 2)                {                    Console.Write("\\");                }else if(counter == 3)                {                    Console.Write("|");                }                else                {                    counter = 0;                }                Console.SetCursorPosition(Console.CursorLeft - 1, Console.CursorTop);            }        }*/        public static void LoadProgress(string message)        {            TypeWriter(message, ConsoleColor.Yellow);            Console.SetCursorPosition(Console.CursorLeft - message.Length, Console.CursorTop);        }        public static int PickIndex(List<string> list)        {            Random randList = new Random();            int i = randList.Next(0, list.Count);            return i;        }        public static bool GetYorN()        {            ConsoleKey response;            do            {                /*while (Console.KeyAvailable)                    Console.ReadKey();*/                Console.Write("Y or N? ");                response = Console.ReadKey().Key;                Console.WriteLine();            } while (response != ConsoleKey.Y && response != ConsoleKey.N);            return response == ConsoleKey.Y;        }        public static void TypeWriter(string message, ConsoleColor begin = ConsoleColor.White, ConsoleColor end = ConsoleColor.White, int SpeedMilisecond = 10)        {            message = Uppercasefirst(message);            Console.ForegroundColor = begin;            for (int i = 0; i < message.Length; i++)            {                Console.Write(message[i]);                System.Threading.Thread.Sleep(SpeedMilisecond);            }            Console.ForegroundColor = end;        }        public static string CheckWebsiteStatus(string url)        {            try            {                var ping = new System.Net.NetworkInformation.Ping();                var result = ping.Send(url);                if (result.Status == System.Net.NetworkInformation.IPStatus.Success)                {                    return "true";                }                else                {                    return "false";                }            }            catch (Exception e)            {                return e.Message;                //return e.message;            }        }        public static void SendMessage(string message, string usermsg)        {            if (Question(usermsg) == true)            {                TypeWriter("Q ", ConsoleColor.Green);            }            else            {                TypeWriter("Q ", ConsoleColor.Yellow);            }            TypeWriter("Friday:", ConsoleColor.Cyan);            if (error == true)            {                TypeWriter(" " + message, ConsoleColor.Red);            }            else            {                TypeWriter(" " + message);            }            Console.WriteLine("");        }        public static void Convorsation(Boolean convo)        {            if (convo == true)            {                isConvo = true;            }            else            {                isConvo = false;            }        }        public static void SendNotification(string title, string message)        {            Console.WriteLine("Notification not sent");        }        public static string TimeOfDay()        {            if (DateTime.Now.Hour <= 6 || DateTime.Now.Hour >= 21)            {                return "night";            }            else if (DateTime.Now.Hour <= 12)            {                return "morning";            }            else if (DateTime.Now.Hour <= 17)            {                return "afternoon";            }            else if (DateTime.Now.Hour <= 20)            {                return "evening";            }            else            {                return "day";            }        }        public static Boolean IsOwnWord(string word, string Content)        {            if (Content.Length == word.Length)            {                //the message only contains the word or phrase                return true;            }            else            {                if (Content.Contains(word + " ") || Content.Contains(" " + word) || Content.Contains(" " + word + " ") || Content.Contains(word + "-") || Content.Contains("-" + word) || Content.Contains("-" + word + "-") || Content.Contains(word + ",") || Content.Contains("," + word) || Content.Contains("," + word + ",") || Content.Contains(word + "."))                {                    //the message contains the word/phrase but is hase more than just the word or phrase                    return true;                }                else { return false; }            }        }        public static string Uppercasefirst(string s)        {            if (string.IsNullOrEmpty(s))            {                return string.Empty;            }            char[] a = s.ToCharArray();            a[0] = char.ToUpper(a[0]);            return new string(a);        }        public static Boolean Question(string Message)        {            Message = Message.ToLower();            if (Message.Contains("what") || Message.Contains("who") || Message.Contains("when") || Message.Contains("why") || Message.Contains("how") || Message.Contains("where") || Message.Contains("do you") || Message.Contains("did you") || Message.Contains("?"))            {                return true;            }            else            {                return false;            }        }        /*SendMessage(Uppercasefirst("test Y or N?"),message);        YorN = GetYorN();        if(YorN == true)        {            SendMessage(Uppercasefirst(""), message);            Messages();        }else if(YorN == false)        {            SendMessage(Uppercasefirst(""), message);            Messages();        }*/        /*SendMessage(Uppercasefirst("did someone else do it?"), message);        message = Console.ReadLine();        if (message.ToLower().Contains("yes"))        {        }else if (message.ToLower().Contains("no"))        {        }        else        {        }*/    }