Ejemplo n.º 1
0
        public virtual async Task <IBot> ConnectBotAsync(BotCredentials credentials, int reconnectIntervalSec)
        {
            var bot = await _twitchNETService.GetBotAsync(credentials.BotId);

            if (bot == null)
            {
                return(null);
            }

            var instance = await _twitchNETBotManager.AddBotAsync(credentials, bot, reconnectIntervalSec * 1000);

            instance.ConnectionBotEvent        += OnConnectionBotEvent;
            instance.ConnectionServerBotEvent  += OnConnectionServerBotEvent;
            instance.ConnectionServerUserEvent += OnConnectionServerUserEvent;
            instance.MessageServerChatEvent    += OnMessageServerChatEvent;
            instance.MessageServerCommandEvent += OnMessageServerCommandEvent;
            instance.MessageWhisperEvent       += OnMessageWhisperEvent;
            instance.FollowEvent += OnFollowEvent;
            instance.ErrorEvent  += OnErrorEvent;

            return(instance);
        }