示例#1
0
        public void Set(Models.Plugins.SlackBotInfo info)
        {
            if (m_bot != null)
            {
                m_bot.Dispose();
                m_bot.OnConnected -= OnBotConnectedToSlack;
                OnBotConnectionChanged?.Invoke(false);
            }

            m_bot              = new SlackBot(info.Token, info.Name);
            m_bot.OnConnected += OnBotConnectedToSlack;

            //Force the client to constantly check for the channel & force connect
            //ToDo: Make this async and improve
            if (m_channelThread != null)
            {
                m_channelThread.Abort();
            }
            m_channelThread = new Thread(() => FindChannel(info.Channel));
            m_channelThread.Start();
        }