Beispiel #1
0
        public static BotMain NewBot(TwitchClientSettings clientSettings, EfGenericRepo efGenericRepo)
        {
            var chatClients = new List <IChatClient>
            {
                new ConsoleChatClient(),
                new TwitchChatClient(clientSettings),
            };


            var commandMessages   = efGenericRepo.List(DataItemPolicy <SimpleResponseMessage> .ActiveOnly());
            var commandHandler    = new CommandHandler(chatClients, commandMessages);
            var subscriberHandler = new SubscriberHandler(chatClients);
            var followerHandler   = new FollowerHandler(chatClients);
            var botMain           = new BotMain(chatClients, efGenericRepo, commandHandler, subscriberHandler, followerHandler);

            return(botMain);
        }
Beispiel #2
0
        private static void Main(string[] args)
        {
            var config = InitConfiguration();

            Console.WriteLine($"{DateTime.Now:HH:mm:ss}: Application starting...");

            var options = new DbContextOptionsBuilder <AppDataContext>()
                          .UseInMemoryDatabase(databaseName: "fake-data-db")
                          .Options;

            var efGenericRepo = new EfGenericRepo(new AppDataContext(options));

            new FakeData(efGenericRepo).Initialize();

            var chatClients = GetChatClients(config);

            Console.WriteLine($"{DateTime.Now:HH:mm:ss}: Application started successfully.");

            var commandMessages = efGenericRepo.List(StatusPolicy <SimpleResponseMessage> .ActiveOnly());
            var commandHandler  = new CommandHandler(chatClients, commandMessages);
            var botMain         = new BotMain(chatClients, efGenericRepo, commandHandler);

            WaitForCommands(botMain);
        }