Пример #1
0
 private static void LoadSprockets(Bot bot)
 {
     bot.AddSprocket(new Jabbot.Sprockets.auto_stache());
     bot.AddSprocket(new Jabbot.Sprockets.Github.Issues());
     bot.AddSprocket(new Jabbot.Sprockets.Github.Issue());
     bot.AddSprocket(new Jabbot.Sprockets.Github.Members());
 }
Пример #2
0
 private static void LoadSprockets(Bot bot)
 {
     bot.AddSprocket(new Jabbot.Sprockets.auto_stache());
     bot.AddSprocket(new Jabbot.Sprockets.Github.Issues());
     bot.AddSprocket(new Jabbot.Sprockets.Github.Issue());
     bot.AddSprocket(new Jabbot.Sprockets.Github.Members());
 }
Пример #3
0
        private void StartBot()
        {
            if (!_hostBaseUrl.Contains("localhost"))
            {
                ScheduleKeepAlive(_hostBaseUrl + "/keepalive");
            }
            foreach (var sprocket in _sprockets)
            {
                _bot.AddSprocket(sprocket.Value);
            }

            _bot.PowerUp(_sprocketInitializers);
            JoinRooms(_bot);

            _bot.MessageReceived += BotMessageReceived;
            LoadCoffeeScript();
            TinyMessengerHub.Instance.Subscribe <TalkMessage>(m => _bot.Say(m.Text, _bot.Rooms.First()));
        }
Пример #4
0
        private static void RunBot()
        {
            try
            {
                var scheduler = new Scheduler();

                var container = CreateCompositionContainer();
                // Add all the sprockets to the sprocket list
                var announcements = container.GetExportedValues <IAnnounce>();

                Console.WriteLine(String.Format("Connecting to {0}...", _serverUrl));
                Bot bot = new Bot(_serverUrl, _botName, _botPassword);

                foreach (var s in container.GetExportedValues <ISprocket>())
                {
                    bot.AddSprocket(s);
                }

                bot.PowerUp();
                JoinRooms(bot);
                var users = bot.GetUsers(bot.Rooms.First());
                var user  = bot.GetUserInfo(bot.Rooms.First(), users.First().Name.ToString());

                scheduler.Start(announcements, bot);

                Console.Write("Press enter to quit...");
                Console.ReadLine();

                scheduler.Stop();
                bot.ShutDown();

                _appShouldExit = true;
            }
            catch (Exception e)
            {
                Console.WriteLine("ERROR: " + e.GetBaseException().Message);
            }
        }
Пример #5
0
        private static void RunBot()
        {
            try
            {
                var scheduler = new Scheduler();

                var container = CreateCompositionContainer();
                // Add all the sprockets to the sprocket list
                var announcements = container.GetExportedValues<IAnnounce>();

                Console.WriteLine(String.Format("Connecting to {0}...", _serverUrl));
                Bot bot = new Bot(_serverUrl, _botName, _botPassword);

                foreach (var s in container.GetExportedValues<ISprocket>())
                    bot.AddSprocket(s);

                bot.PowerUp();
                JoinRooms(bot);
                var users = bot.GetUsers(bot.Rooms.First());
                var user = bot.GetUserInfo(bot.Rooms.First(), users.First().Name.ToString());

                scheduler.Start(announcements, bot);

                Console.Write("Press enter to quit...");
                Console.ReadLine();

                scheduler.Stop();
                bot.ShutDown();

                _appShouldExit = true;
            }
            catch (Exception e)
            {
                Console.WriteLine("ERROR: " + e.GetBaseException().Message);
            }
        }