예제 #1
0
        protected override void OnStop()
        {
            base.OnStop();

            logger.Log("Stopping Orbit Slackbot");
            bot?.Stop();
        }
예제 #2
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();
        }