public static async Task MainAsync(Configuration configuration, CancellationToken cancel) { var persistence = new JsonFileKeyValueStore(new FileInfo(configuration.Get("db-file-location"))); var gamesPersistence = new JsonFileKeyValueStore(new FileInfo(configuration.Get("games-db-location"))); var slackApi = new SlackApi(configuration.Get("slack-api-key")); var slackRtm = await(ReconnectingSlackRealTimeMessaging.CreateAsync( async() => await slackApi.StartRtm())); var aliasList = GetAliasList(slackRtm.InstanceInfo.Users); var commandParser = new SlackCommandParser("scbot", slackRtm.InstanceInfo.BotId); var webClient = new WebClient(); var features = new FeatureMessageProcessor(commandParser, NoteProcessor.Create(commandParser, persistence), //ZendeskTicketTracker.Create(commandParser, persistence, configuration), RecordReplayTraceManagement.Create(commandParser), SeatingPlans.Create(commandParser, webClient), Webcams.Create(commandParser, configuration), Silly.Create(commandParser, webClient), Installers.Create(commandParser, webClient), Polls.Create(commandParser), RollBuildNumbers.Create(commandParser, configuration), ReviewFactory.Create(commandParser, webClient, configuration), LabelPrinting.Create(commandParser, webClient, configuration), Jira.Create(commandParser), CompareTeamEmails.Create(commandParser, configuration), GamesProcessor.Create(commandParser, gamesPersistence, aliasList) ); var pasteBin = new HasteServerPasteBin(webClient, configuration.Get("haste-server-url")); var newChannelNotificationsChannel = configuration.GetWithDefault("new-channels-notification-channel", null); var newChannelProcessor = GetNewChannelProcessor(newChannelNotificationsChannel); var bot = new Bot( new ErrorReportingMessageProcessor( new ConcattingMessageProcessor(features), pasteBin), newChannelProcessor); var handler = new SlackMessageHandler(bot, slackRtm.InstanceInfo.BotId); MainLoop(slackRtm, handler, slackApi, cancel); }
public void IsActuallyLunchtime() { Assert.AreEqual("Lunchtime!", Webcams.LunchMessage(TimeSpan.FromHours(12.5))); }
public void IsNearlyLunchtime() { Assert.AreEqual("It's nearly lunchtime!", Webcams.LunchMessage(TimeSpan.FromHours(11.5))); }