Example #1
0
        public void Start()
        {
            IContainerFactory containerFactory = new ContainerFactory(_configuration, _configReader, LogManager.GetLogger(GetType()));
            INoobotContainer  container        = containerFactory.CreateContainer();

            _noobotCore = container.GetNoobotCore();

            Console.WriteLine("Connecting...");
            _noobotCore
            .Connect()
            .ContinueWith(task =>
            {
                if (!task.IsCompleted || task.IsFaulted)
                {
                    Console.WriteLine($"Error connecting to Slack: {task.Exception}");
                }

                Settings.ChannelList = _noobotCore.ListChannels();

                var lastRun = DateTime.UtcNow;
                while (true)
                {
                    if (lastRun.AddSeconds(1) <= DateTime.UtcNow)
                    {
                        var check = new MunkCheck();
                        check.CheckForEvents(_noobotCore);

                        lastRun = DateTime.UtcNow;
                    }
                }
            })
            .Wait();
        }
Example #2
0
        public void Setup()
        {
            var containerFactory = new ContainerFactory(new ToolboxConfiguration(), new ConfigReader(), NoobotWrapper.GetLogger());
            _container = containerFactory.CreateContainer();

            _noobotCore = _container.GetNoobotCore();
            _noobotCore.Connect().Wait(TimeSpan.FromMinutes(1));
        }
        public void Setup()
        {
            var containerFactory = new ContainerFactory(new ToolboxConfiguration(), new JsonConfigReader(), NoobotWrapper.GetLogger());

            _container = containerFactory.CreateContainer();

            _noobotCore = _container.GetNoobotCore();
            _noobotCore.Connect().Wait(TimeSpan.FromMinutes(1));
        }
        public void Setup()
        {
            File.Delete(Path.Combine(Environment.CurrentDirectory, "data/schedules.json"));

            var containerFactory = new ContainerFactory(new SchedulerConfig(), new ConfigReader(), NoobotWrapper.GetLogger());
            _container = containerFactory.CreateContainer();

            _noobotCore = _container.GetNoobotCore();
            _noobotCore.Connect().Wait(TimeSpan.FromMinutes(1));
        }
Example #5
0
        public void Setup()
        {
            File.Delete(Path.Combine(Environment.CurrentDirectory, "data/schedules.json"));

            var containerFactory = new ContainerFactory(new SchedulerConfig(), new ConfigReader(), NoobotWrapper.GetLogger());

            _container = containerFactory.CreateContainer();

            _noobotCore = _container.GetNoobotCore();
            _noobotCore.Connect().Wait(TimeSpan.FromMinutes(1));
        }
Example #6
0
        public async Task StartAsync(CancellationToken cancellationToken)
        {
            IContainerFactory containerFactory = new ContainerFactory(_botConfiguration,
                                                                      _configReader, LogManager.GetLogger(GetType()));
            INoobotContainer container = containerFactory.CreateContainer();

            _noobotCore = container.GetNoobotCore();

            _logger.LogInformation("Connecting..");
            await _noobotCore.Connect();
        }
Example #7
0
        private static async Task RunBot()
        {
            var environmentReader = new EnvironmentReader();
            var botConfiguration  = new BotConfiguration(environmentReader);

            var containerFactory = new ContainerFactory(botConfiguration, environmentReader, GetLogger());
            var container        = containerFactory.CreateContainer();

            _noobotCore = container.GetNoobotCore();

            await _noobotCore.Connect();
        }
Example #8
0
        private static async Task RunNoobot()
        {
            var containerFactory = new ContainerFactory(
                new ConfigurationBase(),
                JsonConfigReader.DefaultLocation(),
                GetLogger());

            INoobotContainer container = containerFactory.CreateContainer();

            _noobotCore = container.GetNoobotCore();

            await _noobotCore.Connect();
        }
Example #9
0
        private static async Task RunNoobot()
        {
            var containerFactory = new ContainerFactory(
                new MiddlewareConfiguration(),
                new JsonConfigReader(_noobotConfigFilePath),
                GetLogger());

            INoobotContainer container = containerFactory.CreateContainer();

            _noobotCore = container.GetNoobotCore();

            await _noobotCore.Connect();
        }
Example #10
0
        public void Start()
        {
            Console.WriteLine("Connecting...");

            _noobotCore
            .Connect()
            .ContinueWith(task =>
            {
                if (!task.IsCompleted || task.IsFaulted)
                {
                    Console.WriteLine($"Error connecting to Slack: {task.Exception}");
                }
            })
            .Wait();
        }
Example #11
0
        public void Start()
        {
            IContainerFactory containerFactory = new ContainerFactory(_configuration, _configReader, new ConsoleLog());
            INoobotContainer container = containerFactory.CreateContainer();
            _noobotCore = container.GetNoobotCore();

            Console.WriteLine("Connecting...");
            _noobotCore
                .Connect()
                .ContinueWith(task =>
                {
                    if (!task.IsCompleted || task.IsFaulted)
                    {
                        Console.WriteLine($"Error connecting to Slack: {task.Exception}");
                    }
                });
        }
Example #12
0
        public void Start()
        {
            IContainerFactory containerFactory = new ContainerFactory(_configuration, _configReader, new ConsoleLog());
            INoobotContainer  container        = containerFactory.CreateContainer();

            _noobotCore = container.GetNoobotCore();

            Console.WriteLine("Connecting...");
            _noobotCore
            .Connect()
            .ContinueWith(task =>
            {
                if (!task.IsCompleted || task.IsFaulted)
                {
                    Console.WriteLine($"Error connecting to Slack: {task.Exception}");
                }
            });
        }
Example #13
0
        public INoobotHost Start()
        {
            INoobotContainer container = _containerFactory.CreateContainer();
            _noobotCore = container.GetNoobotCore();

            Console.WriteLine("Connecting...");
            _noobotCore
                .Connect()
                .ContinueWith(task =>
                {
                    if (!task.IsCompleted || task.IsFaulted)
                    {
                        Console.WriteLine($"Error connecting to Slack: {task.Exception}");
                    }
                });

            return this;
        }
Example #14
0
        public INoobotHost Start()
        {
            INoobotContainer container = _containerFactory.CreateContainer();

            _noobotCore = container.GetNoobotCore();

            Console.WriteLine("Connecting...");
            _noobotCore
            .Connect()
            .ContinueWith(task =>
            {
                if (!task.IsCompleted || task.IsFaulted)
                {
                    Console.WriteLine($"Error connecting to Slack: {task.Exception}");
                }
            });

            return(this);
        }
Example #15
0
        public void Start(ILog log)
        {
            IContainerFactory containerFactory = new ContainerFactory(_configuration, _configReader, log);
            INoobotContainer  container        = containerFactory.CreateContainer();

            _noobotCore = container.GetNoobotCore();

            _noobotCore
            .Connect()
            .ContinueWith(task =>
            {
                if (!task.IsCompleted || task.IsFaulted)
                {
                    Debug.WriteLine($"Error connecting to Slack: {task.Exception}");
                }
            })
            .GetAwaiter()
            .GetResult();
        }
Example #16
0
 public async Task StartAsync(CancellationToken cancellationToken)
 {
     await _noobotCore.Connect();
 }