示例#1
0
        public IrcBotService(MessageQueueService queueService, IOptions <IrcBotConfiguration> options, BotRulePipeline pipeline)
        {
            this.queueService = queueService;
            this.pipeline     = pipeline;
            config            = options.Value;

            queueService.MessageAdded += QueueService_MessageAdded;

            InitializeClient();
        }
示例#2
0
        private static void ConfigureIrcBot(IServiceCollection services, Action <BotRulePipeline> configurePipeline)
        {
            services.AddSingleton <MessageQueueService>();

            var pipeline = new BotRulePipeline(services);

            configurePipeline?.Invoke(pipeline);

            services.AddHostedService(p => new IrcBotService(
                                          p.GetRequiredService <MessageQueueService>(),
                                          p.GetRequiredService <IOptions <IrcBotConfiguration> >(),
                                          pipeline
                                          ));
        }