Exemplo n.º 1
0
 public Bot(ITwitchNETDALService twitchNETService,
            IBotDTO bot,
            int intervalReconnectMS)
 {
     _twitchNetService = twitchNETService;
     _bot = bot;
     _intervalReconnectMS = intervalReconnectMS;
 }
Exemplo n.º 2
0
        public async Task <IBot> AddBotAsync(BotCredentials credentials, IBotDTO botDTO, int reconnectIntervalMS)
        {
            IBot bot = new Bot(_twitchNETService, botDTO, reconnectIntervalMS);

            bot.ConnectionBotEvent        += OnConnectionBotEvent;
            bot.ConnectionServerBotEvent  += OnConnectionServerBotEvent;
            bot.ConnectionServerUserEvent += OnConnectionServerUserEvent;
            bot.MessageServerChatEvent    += OnMessageServerChatEvent;
            bot.MessageServerCommandEvent += OnMessageServerCommandEvent;
            bot.MessageWhisperEvent       += OnMessageWhisperEvent;
            bot.ColorChangeEvent          += OnColorChangeEvent;
            bot.ErrorEvent += OnErrorEvent;
            await bot.ConnectAsync(credentials);

            _bots.TryAdd(botDTO.Id, bot);

            return(bot);
        }