コード例 #1
0
        public Triggers(string triggerPrefix, ThrottleManager tManager, Logger log)
        {
            Prefix           = triggerPrefix;
            primeIds         = new List <string>();
            PrimeIdentifiers = new ReadOnlyCollection <string>(primeIds);

            throttle = tManager;
            this.log = log;
            triggers = new Dictionary <string, Trigger>(StringComparer.Ordinal);
        }
コード例 #2
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);
        }
コード例 #3
0
ファイル: IrcComm.cs プロジェクト: IvionSauce/MeidoBot
 public IrcComm(IrcClient ircClient, ThrottleManager tManager, IChatlogger chatLog)
 {
     irc          = ircClient;
     throttle     = tManager;
     this.chatLog = chatLog;
 }