Exemplo n.º 1
0
 public GiveCommand(ChatUserCollection chatUserCollection)
 {
     _chatUserCollection = chatUserCollection;
     RoleRequired        = UserRole.Everyone;
     CommandText         = "give";
     HelpText            = "Give coins to someone. Example !give LNGgrinds 10";
 }
Exemplo n.º 2
0
 public CurrencyGenerator(List <IChatClient> chatClients, ChatUserCollection chatUserCollection)
 {
     _chatUserCollection = chatUserCollection;
     foreach (IChatClient chatClient in chatClients)
     {
         AddCurrentChatters(chatClient);
         chatClient.OnUserNoticed += ChatClientOnOnUserNoticed;
         chatClient.OnUserLeft    += ChatClientOnUserLeft;
     }
 }
Exemplo n.º 3
0
        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);
        }