Exemple #1
0
        private static void Run(string baseUrl, string dataView, string username, string password, string slackToken)
        {
            OrbitApiClient apiClient = new OrbitApiClient(dataView, new ApiConnectorFactory(baseUrl));

            if (!apiClient.Login(username, password))
            {
                throw new Exception("Can't log in to the dataview " + dataView + " with username " + username + " using the API at " + baseUrl);
            }

            OrbitResponseHandler responseHandler = new OrbitResponseHandler(apiClient);

            SlackBot bot = new SlackBot(new SlackClientFactory(), responseHandler, new ConsoleLogger(), slackToken);

            bot.Start();

            System.Console.WriteLine("Orbit Slackbot started.  Press return to stop");
            System.Console.WriteLine();
            System.Console.ReadLine();

            bot.Stop();
        }
Exemple #2
0
        protected override void OnStart(string[] args)
        {
            base.OnStart(args);

            EnsureOrbitConnectionParametersCorrect();

            logger.Log("Starting Orbit Slackbot - connecting to Orbit API");

            OrbitApiClient apiClient = new OrbitApiClient(dataView, new ApiConnectorFactory(baseUrl));

            if (!apiClient.Login(username, password))
            {
                throw new Exception("Can't log in to the dataview " + dataView + " with username " + username + " using the API at " + baseUrl);
            }

            logger.Log("Starting Orbit Slackbot - successfully connected to Orbit API");
            OrbitResponseHandler responseHandler = new OrbitResponseHandler(apiClient);

            logger.Log("Starting Orbit Slackbot - connecting to Slack");
            bot = new SlackBot(new SlackClientFactory(), responseHandler, logger, slackToken);
            bot.Start();

            logger.Log("Successfully started Orbit Slackbot");
        }