Пример #1
0
 public void Dispose()
 {
     if (_thread != null && _thread.IsAlive)
     {
         _thread.Abort();
     }
     _bot.Dispose();
 }
Пример #2
0
        public bool RemoveBot(IBot bot)
        {
            if (_bots.TryRemove(bot.BotDTO.Id, out bot))
            {
                bot.Dispose();

                bot.ConnectionBotEvent        -= OnConnectionBotEvent;
                bot.ConnectionServerBotEvent  -= OnConnectionServerBotEvent;
                bot.ConnectionServerUserEvent -= OnConnectionServerUserEvent;
                bot.MessageServerChatEvent    -= OnMessageServerChatEvent;
                bot.MessageServerCommandEvent -= OnMessageServerCommandEvent;
                bot.MessageWhisperEvent       -= OnMessageWhisperEvent;
                bot.ColorChangeEvent          -= OnColorChangeEvent;
                bot.ErrorEvent -= OnErrorEvent;
                return(true);
            }

            return(false);
        }