Esempio n. 1
0
        public void Connect()
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;
            CommandListInit();
            try
            {
                if (!Properties.Settings.Default.DateTimeFormatCorrected)
                {
                    //xmlprovider.DateTimeCorrection();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            _streamProviderManager = new StreamProviderManager();
            _streamProviderManager.StreamStarted += OnStreamStarted;
            _streamProviderManager.StreamStopped += OnStreamStopped;
            _streamProviderManager.StreamGlobalNotification += OnStreamGlobalNotification;
            _streamProviderManager.AddStreamProvider(new TwitchProvider());
            _streamProviderManager.AddStreamProvider(new HitboxProvider());
            bot = new DiscordClient();
            bot.MessageReceived += Message_Received;
            bot.UserJoined += User_Joined;
            deathmicirc = new RelayBot(bot,false);
            Thread RelayThread = new Thread(deathmicirc.runBot);
            RelayThread.Start();
            while (!RelayThread.IsAlive) ;
            Thread.Sleep(1);

            readUsers();

            bot.ExecuteAndWait(async () =>
            {
                await bot.Connect("MjYwMTE2OTExOTczNDY2MTEy.CzhvyA.kpEIti2hVnjNIUccob0ERB4QFTw", TokenType.Bot);
            });
        }
Esempio n. 2
0
        protected override void OnLocalUserJoinedChannel(IrcLocalUser localUser, IrcChannelEventArgs e)
        {
            thisclient.FloodPreventer = new IrcStandardFloodPreventer(2,4000);
            thisclient.WhoReplyReceived += UserListUpdate;
            if (xmlprovider.runningVotes().Count() > 0)
            {
                VoteTimer = new System.Timers.Timer(5000);
                VoteTimer.Elapsed += OnVoteTimerEvent;
                VoteTimer.Enabled = true;
            }
            //OnClientRegistered may happen before joined channel thus...
            _streamProviderManager = new StreamProviderManager();
            _streamProviderManager.StreamStarted += OnStreamStarted;
            _streamProviderManager.StreamStopped += OnStreamStopped;
            _streamProviderManager.StreamGlobalNotification += OnStreamGlobalNotification;
            _streamProviderManager.AddStreamProvider(new TwitchProvider());
            _streamProviderManager.AddStreamProvider(new HitboxProvider());
            //localUser.Client.WhoReplyReceived += WhoReplyReceived;

            if (reconnectimer != null)
            {
                reconnectimer.Dispose();
            }

            if (!debug)
            {
                reconnectimer = new System.Timers.Timer(150000);
            }
            else
            {
                reconnectimer = new System.Timers.Timer(240000);
            }
            reconnectimer.Elapsed += OnReconnectTimer;
            reconnectimer.Enabled = true;
        }