Esempio n. 1
0
        public Meido(MeidoConfig config)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            // We need these parameters for events, store them.
            conf            = config;
            currentChannels = new List <string>(config.Channels);

            // Initialize log factory for this server/instance.
            var logFac = new LogFactory(config.ServerAddress);

            // Set aside some logging for ourself.
            log = logFac.CreateLogger("Meido");

            // Throttling for triggers and outgoing messages.
            var tManager = new ThrottleManager(log);

            // Setup chatlogger and underlying LogWriter.
            logWriter = new LogWriter();
            var chatLog = SetupChatlog();

            ircComm   = new IrcComm(irc, tManager, chatLog);
            meidoComm = new MeidoComm(config, logFac, log);

            var triggers = new Triggers(
                config.TriggerPrefix,
                tManager,
                logFac.CreateLogger("Triggers")
                );

            // This must be instantiated before loading plugins and their triggers.
            dispatch = new Dispatcher(
                ircComm,
                triggers,
                new IrcEventHandlers(log)
                );
            // Setup autoloading of ignores.
            meidoComm.LoadAndWatchConfig("Ignore", LoadIgnores);

            // Setup non-plugin triggers and register them.
            help  = new Help(triggers);
            admin = new Admin(this, irc, meidoComm);
            RegisterSpecialTriggers(triggers);
            // Load plugins and setup their triggers/help.
            LoadPlugins(triggers);

            // Setting some SmartIrc4Net properties and event handlers.
            SetProperties();
            SetHandlers();
            reconnect = new AutoReconnect(irc);
        }
Esempio n. 2
0
 public Admin(Meido bot, IrcClient irc, MeidoComm meidoComm)
 {
     this.bot       = bot;
     this.irc       = irc;
     this.meidoComm = meidoComm;
 }