Пример #1
0
        public static void Initialize()
        {
            if (botEnabled)
            {
                Instance = new ComBot();
                Instance.Start();
            }

            CommandSystem.Register("Combot", AccessLevel.GameMaster, new CommandEventHandler(OnCommand_ComBot));
        }
Пример #2
0
 private static void OnCommand_ComBot(CommandEventArgs e)
 {
     if (!Instance.connection.Connected)
     {
         Instance = null;
         e.Mobile.SendAsciiMessage("ComBot is disconnected. Killing the thread.");
     }
     else if (Instance != null)
     {
         Instance.connection.Disconnect("I was told to leave.");
         Instance = null;
     }
     Initialize();
     e.Mobile.SendAsciiMessage("ComBot is being initalized.");
 }
Пример #3
0
        public void OnError(ReplyCode code, string message)
        {
            //All anticipated errors have a numeric code. The custom Thresher ones start at 1000 and
            //can be found in the ErrorCodes class. All the others are determined by the IRC spec
            //and can be found in RFC2812Codes.
            if ((int)code == 439)
            {
                return;
            }

            if (code == ReplyCode.ConnectionFailed)
            {
                Instance.connection.Disconnect("Connection Failed");
                Instance = null;
            }

            Console.WriteLine("An error of type " + code + " due to " + message + " has occurred.");
        }