private static async Task Run(string[] args) { string token = args[0]; string logfile = args[1]; string aikey = args[2]; string aiend = args[3]; using (var bot = new SlackBot(token)){ bot.AddHandler(new PingHandler()); //bot.AddHandler(new MessageHandler()); bot.AddHandler(new MessageHandler(logfile)); bot.AddHandler(new AnalyticsHandler(aikey, aiend)); await bot.Connect().ConfigureAwait(false); Console.WriteLine("Connected"); await WaitForKeyPress().ConfigureAwait(false); } }
public async Task AddHandler_HandlesMessages() { var handler = Substitute.For <IMessageHandler>(); await Connect(); _sut.AddHandler(handler); _incomingMessages.OnNext(new MessageEvent { Text = "foo" }); await handler.Received().HandleMessage(Arg.Is <IMessage>(m => m.Text == "foo")); }
private static async Task Run(string token) { using (var bot = new SlackBot(token)) { bot.AddHandler(new PingHandler()); await bot.Connect().ConfigureAwait(false); Console.WriteLine("Connected"); await WaitForKeyPress().ConfigureAwait(false); } }