static void Main(string[] args) { container = BotRunnerBootstrapper.Init(); var fineBot = new Bot(); var fineBotResponders = container.ResolveAll<IFineBotResponder>(); foreach (IFineBotResponder responder in fineBotResponders) { fineBot.Responders.Add(responder); } fineBot.RespondsTo("hi").IfBotIsMentioned().With("Stop resisting citizen!"); fineBot.CreateResponder(x => !x.BotHasResponded, rc => "My responses are limited, you must ask the right question..."); var task = fineBot.Connect(ConfigurationManager.AppSettings["BotKey"]); Console.WriteLine(string.Format("{0}: Bot is runnning, type 'die' to make it die", DateTime.Now)); var secondCousinBot = new Bot(); var secondCousinResponders = container.ResolveAll<ISecondCousinResponder>(); foreach (ISecondCousinResponder responder in secondCousinResponders) { secondCousinBot.Responders.Add(responder); } var seconderTask = secondCousinBot.Connect(ConfigurationManager.AppSettings["SeconderBotKey"]); Console.WriteLine(string.Format("{0}: Finebot's second cousin is also also running. Some say he can't die.", DateTime.Now)); while(Console.ReadLine() != "die") { } container.Dispose(); }
public ArmaStatusBot(string slackKey, IPAddress address, int port, List<SlackUser> registeredUsers) { m_RegisteredUsers = registeredUsers ?? new List<SlackUser>(); m_Key = slackKey; m_Address = address; m_Port = port; m_Bot = new Bot(); }
static void Main(string[] args) { container = BotRunnerBootstrapper.Init(); var bot = new Bot(); var responders = container.ResolveAll<IResponder>(); foreach (var responder in responders) { bot.Responders.Add(responder); } var connect = bot.Connect(ConfigurationManager.AppSettings["SlackBotApiToken"]); while (Console.ReadLine() != "close") { } }
static void Main(string[] args) { container = BotRunnerBootstrapper.Init(); Bot bot = new Bot(); foreach(IResponder responder in container.ResolveAll<IResponder>()) { bot.Responders.Add(responder); } bot.RespondsTo("hi").IfBotIsMentioned().With("Stop resisting citizen!"); var task = bot.Connect(ConfigurationManager.AppSettings["SlackApiKey"]); Console.WriteLine(String.Format("{0}: Bot is runnning, type 'die' to make it die", DateTime.Now)); while(Console.ReadLine() != "die") { } container.Dispose(); }
private static void Init() { _ravenStore = CreateStore(); _slackKey = ConfigurationManager.AppSettings[Keys.AppSettings.SlackKey]; _bot = new Bot(); _userNameCache = new Dictionary<string, string>(); _channelsNameCache = new Dictionary<string, string>(); _messageHandlers = ObjectFactory.GetAllInstances<IMessageHandler>().ToList(); _botAliases = ConfigurationManager.AppSettings[Keys.AppSettings.BotAliases].Split(','); }