private readonly int _refreshInterval = 1000;//the milliseconds the bot waits before checking for new messages public BotMain(List <IChatClient> chatClients, IRepository repository, CommandHandler commandHandler, SubscriberHandler subscriberHandler, FollowableSystem followableSystem, AutomatedActionSystem automatedActionSystem) { _chatClients = chatClients; _repository = repository; _commandHandler = commandHandler; _subscriberHandler = subscriberHandler; _followableSystem = followableSystem; _automatedActionSystem = automatedActionSystem; }
public static BotMain NewBot(TwitchClientSettings twitchSettings, string connectionString) { var twitchApi = new TwitchAPI(twitchSettings.TwitchClientId); var twitchChatClient = new TwitchChatClient(twitchSettings, twitchApi); var chatClients = new List <IChatClient> { new ConsoleChatClient(), twitchChatClient, }; var twitchFollowerService = new TwitchFollowerService(twitchApi, twitchSettings); IRepository repository = SetUpDatabase.SetUpRepository(connectionString); var chatUserCollection = new ChatUserCollection(repository); var currencyGenerator = new CurrencyGenerator(chatClients, chatUserCollection); var currencyUpdate = new CurrencyUpdate(1, currencyGenerator); var automatedActionSystem = new AutomatedActionSystem(new List <IIntervalAction> { currencyUpdate }); var rockPaperScissorsGame = new RockPaperScissorsGame(currencyGenerator, automatedActionSystem); var wordList = new List <string> { "apple", "banana", "orange", "mango", "watermellon", "grapes", "pizza", "pasta", "pepperoni", "cheese", "mushroom", "csharp", "javascript", "cplusplus", "nullreferenceexception", "parameter", "argument" }; var hangmanGame = new HangmanGame(currencyGenerator, automatedActionSystem, wordList); var simpleCommands = repository.List <SimpleCommand>(); List <IBotCommand> allCommands = new List <IBotCommand>(); allCommands.AddRange(simpleCommands); allCommands.Add(new GiveCommand(chatUserCollection)); allCommands.Add(new HelpCommand(allCommands)); allCommands.Add(new CommandsCommand(allCommands)); allCommands.Add(new CoinsCommand(repository)); allCommands.Add(new BonusCommand(currencyGenerator)); allCommands.Add(new StreamsCommand(repository)); allCommands.Add(new ShoutOutCommand(twitchFollowerService)); allCommands.Add(new QuoteCommand(repository)); allCommands.Add(new AddQuoteCommand(repository)); allCommands.Add(new AddCommandCommand(repository, allCommands)); allCommands.Add(new RemoveCommandCommand(repository, allCommands)); allCommands.Add(new HangmanCommand(hangmanGame)); allCommands.Add(new RockPaperScissorsCommand(rockPaperScissorsGame)); var commandHandler = new CommandHandler(chatClients, allCommands); var subscriberHandler = new SubscriberHandler(chatClients); var twitchSystem = new FollowableSystem(new[] { twitchChatClient }, twitchFollowerService); var botMain = new BotMain(chatClients, repository, commandHandler, subscriberHandler, twitchSystem, automatedActionSystem); return(botMain); }