public static void Initialize() { if (botEnabled) { Instance = new ComBot(); Instance.Start(); } CommandSystem.Register("Combot", AccessLevel.GameMaster, new CommandEventHandler(OnCommand_ComBot)); }
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."); }
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."); }