Esempio n. 1
0
        static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                Console.WriteLine(miniHelp);
                return;
            }
            if (args[0].Equals("-h", StringComparison.OrdinalIgnoreCase) ||
                args[0].Equals("--help", StringComparison.OrdinalIgnoreCase))
            {
                Console.WriteLine(miniHelp);
                Console.WriteLine("Example config:" + Parsing.ExampleConfig);
                Console.WriteLine("Modify and save to a file. Pass path as argument to MeidoBot.");
                return;
            }

            configPath = args[0];
            bot        = CreateMeido(Logger.ConsoleLogger("Main"));
            if (bot != null)
            {
                // Holy scoping, Batman!
                System.Threading.Thread.CurrentThread.Name = "SecretlySkynet";
                bot.Connect();
            }
        }
Esempio n. 2
0
        public static void RestartMeido()
        {
            // TODO: Make the caller supply the logger.
            var log = Logger.ConsoleLogger("Main");

            log.Message("Attempting to restart meido...");

            var newbot = CreateMeido(log);

            if (newbot != null)
            {
                bot.Disconnect("Restarting...");
                // Dispose of old bot and assign new bot.
                bot.Dispose();
                bot = newbot;
                // The previous 2 actions (disposing the old bot and removing the reference to it) have changed
                // the entire program. The bot is the root of a large tree of objects (several helper classes,
                // plugins, etc.), so now is a good time to force a complete collection.
                Collect();
                bot.Connect();
            }
            else
            {
                log.Error("Restart failed.");
            }
        }
Esempio n. 3
0
 public Admin(Meido bot, IrcClient irc, MeidoComm meidoComm)
 {
     this.bot       = bot;
     this.irc       = irc;
     this.meidoComm = meidoComm;
 }