示例#1
0
 private void Client_OnDisconnected(object sender, OnDisconnectedEventArgs e)
 {
     mainForm.BotConnected = false;
     mainForm.ChangeUserSettingsPannel(true);
     mainForm.ChangeConnectionStatusLabel("Desconnectat");
     mainForm.ChangeConnectDisconnectButton("Connectar");
 }
示例#2
0
 private void Client_onDisconnected(object sender, OnDisconnectedEventArgs e)
 {
     MessageTimerController.Instance.Stop();
     CoinSystem.CoinSystem.Instance.Stop();
     TwitchBotGlobalObjects.TwitchBotConnectedState = TwitchBotConnectedState.Disconnected;
     MessageBox.Show("AutoDisconnect");
 }
 private void ClientOnDisconnected(object sender, OnDisconnectedEventArgs e)
 {
     _logger.LogInformation($"Connected disconnected. reconnecting...");
     if (!Client.IsConnected)
     {
         Client.Connect();
     }
 }
示例#4
0
 private void Client_OnDisconnected(object sender, OnDisconnectedEventArgs e)
 {
     LogUtil.LogText($"[{client.TwitchUsername}] - Disconnected.");
     while (!client.IsConnected)
     {
         client.Reconnect();
     }
 }
示例#5
0
 private void Client_OnDisconnected(object?sender, OnDisconnectedEventArgs e)
 {
     if (ManualDisconnect)
     {
         return;
     }
     client.Reconnect();
 }
 private void Client_OnDisconnected(object sender, OnDisconnectedEventArgs e)
 {
     Log.LogFeedSystem($"Bot disconnected");
     if (autoReconnect)
     {
         Connect();
     }
 }
示例#7
0
        private void OnDisconnected(object sender, OnDisconnectedEventArgs e)
        {
            EvtDisconnectedArgs disArgs = new EvtDisconnectedArgs()
            {
            };

            OnDisconnectedEvent?.Invoke(disArgs);
        }
示例#8
0
        private void TwitchClientOnOnDisconnected(object sender, OnDisconnectedEventArgs e)
        {
            _logger.LogInformation($"{nameof(TwitchChatClient)} disconnected");
            _twitchClient.OnDisconnected -= TwitchClientOnOnDisconnected;
            _isReady = false;

            _disconnectionCompletionTask.SetResult(true);
            _connectionCompletionTask = new TaskCompletionSource <bool>();
        }
 private void Disconnected(object sender, OnDisconnectedEventArgs e)
 {
     ConnectionChangeInProgress = false;
     if (_AutoCommandTimer != null)
     {
         _AutoCommandTimer.Stop();
     }
     RefreshToken();
 }
示例#10
0
 private static void Bot_OnDisconnected(object sender, OnDisconnectedEventArgs e)
 {
     if (isReconnect)
     {
         Thread.Sleep(reconnectTime * 1000);
         reconnectTime *= 2;
         bot.Reconnect();
     }
 }
示例#11
0
        private void OnDisconnected(object sender, OnDisconnectedEventArgs e)
        {
            logger.WriteDebug("Disconnected from the Twitch IRC Server");

            Unsubscribe();
            isInitialized = false;
            CreateTwitchClient();
            Start();
        }
示例#12
0
        private async void OnDisconnected(object sender, OnDisconnectedEventArgs eventArgs)
        {
            ConnectionStatus = ConnectionStatus.Disconnected;
            StatusChanged?.Invoke(this, eventArgs);

            if (eventArgs.Exception != null)
            {
                await ConnectAsync();
            }
        }
示例#13
0
        private void Client_OnDisconnected(object sender, OnDisconnectedEventArgs e)
        {
            Console.WriteLine($"Disconnected from chat");

            // if not shutting down on purpose, reconnect
            if (!isShuttingDown)
            {
                twitchClient.Connect();
            }
        }
示例#14
0
 private void Client_OnDisconnected(object sender, OnDisconnectedEventArgs e)
 {
     if (_isStopping)
     {
         Logger.Instance.Info($"Twitch client disconnected");
     }
     else
     {
         Logger.Instance.Error($"Twitch client disconnected, reconnecting...");
     }
 }
示例#15
0
        private void onDisconnected(object sender, OnDisconnectedEventArgs e)
        {
            CheckForIllegalCrossThreadCalls = false;
            textBox_output_info.AppendText(Environment.NewLine + "Disconnected!" + Environment.NewLine);
            connection_status            = false;
            label_connection_status.Text = "disconnected";

            client.OnNewSubscriber   -= new EventHandler <OnNewSubscriberArgs>(onNewSubscriber);
            client.OnMessageReceived -= new EventHandler <OnMessageReceivedArgs>(onMessageReceived);
            client.OnConnected       -= new EventHandler <OnConnectedArgs>(onConnected);
        }
        public void PropertyTest()
        {
            Mock <ITwitchChannelLink> cLink = new Mock <ITwitchChannelLink>();

            OnDisconnectedEventArgs eventArgs = new OnDisconnectedEventArgs();
            TwitchDisconnectedNotification
                notification = new TwitchDisconnectedNotification(cLink.Object, eventArgs);

            notification.ChannelLink.Should().NotBeNull();
            notification.ChannelLink.Should().Be(cLink.Object);
            notification.DisconnectedEventArgs.Should().Be(eventArgs);
        }
示例#17
0
 private void ClientOnOnDisconnected(OnDisconnectedEventArgs e, ILogger logger)
 {
     logger.LogError("Disconnected from channel.");
     try
     {
         this.client.Connect();
         logger.LogInformation($"Reconnected to channel.");
     }
     catch (Exception exception)
     {
         logger.LogError("Failed to reconnect to channel.");
     }
 }
示例#18
0
 private void Client_OnDisconnected(object sender, OnDisconnectedEventArgs e)
 {
     try
     {
         Logger.LogInfo("Disconnected.");
         Logger.LogInfo("Try to reconnect...");
         client.Connect();
         Logger.LogInfo("Reconnected...");
     }
     catch (Exception ex)
     {
         Logger.Log(ex);
     }
 }
示例#19
0
        private async void TwitchClient_OnDisconnected(object sender, OnDisconnectedEventArgs e)
        {
            if (_isStopping)
            {
                _logger.LogInformation("Disconnected!");
                return;
            }

            // wait until it's *really* disconnected
            while (_client.IsConnected)
            {
            }
            _logger.LogInformation("Client disconnected unexpectedly!");

            // refresh tokens and reconnect to chat
            _tokens = await _mediator.Send(new RefreshTokensRequest());

            await _client.ReconnectAsync(accessToken : _tokens.AccessToken);
        }
示例#20
0
        private void OnDisconnected(object sender, OnDisconnectedEventArgs e)
        {
            client.OnMessageReceived       -= OnMessageReceived;
            client.OnChatCommandReceived   -= OnCommandReceived;
            client.OnConnected             -= OnConnected;
            client.OnDisconnected          -= OnDisconnected;
            client.OnUserJoined            -= OnUserJoined;
            client.OnUserLeft              -= OnUserLeft;
            client.OnGiftedSubscription    -= OnGiftedSub;
            client.OnCommunitySubscription -= OnPrimeSub;
            client.OnNewSubscriber         -= OnNewSub;
            client.OnReSubscriber          -= OnReSub;
            isInitialized = false;

            logger.WriteDebug("Disconnected from the Twitch IRC Server");

            CreateTwitchClient();
            Start();
        }
示例#21
0
        protected virtual void OnDisconnected(object sender, OnDisconnectedEventArgs args)
        {
            Task.Run(async() =>
            {
                try
                {
                    _isRunning = false;

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

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

                    await FireConnectionBotEventAsync(sender, new ConnectionBotEventArgs
                    {
                        Bot = this,
                        ConnectionEventType = Enums.ConnectionEventType.DisconnectedFromTwitch,
                    });

                    if (_intervalReconnectMS > 0)
                    {
                        Thread.Sleep(_intervalReconnectMS);
                        await ConnectAsync(_botCredentials);
                    }
                }
                catch (Exception ex)
                {
                    await FireErrorEventAsync(sender, new ErrorBotConnectEventArgs
                    {
                        Bot = this,
                        ErrorConnectionEventType = ErrorConnectionEventType.DisconnectBot,
                        Exception = ex
                    });
                }
            });
        }
示例#22
0
        private static void _client_OnDisconnected(object sender, OnDisconnectedEventArgs e)
        {
            // Disconnected
            Application.Current.Dispatcher.Invoke(() =>
            {
                foreach (Window window in Application.Current.Windows)
                {
                    if (window.GetType() != typeof(MainWindow))
                    {
                        continue;
                    }
                    //(window as MainWindow).icon_Twitch.Foreground = new SolidColorBrush(Colors.Red);
                    ((MainWindow)window).LblStatus.Content             = "Disconnected from Twitch";
                    ((MainWindow)window).mi_TwitchConnect.IsEnabled    = true;
                    ((MainWindow)window).mi_TwitchDisconnect.IsEnabled = false;
                }
            });

            Logger.LogStr("TWITCH: Disconnected from Twitch");
        }
示例#23
0
        private void Client_OnDisconnected(object sender, OnDisconnectedEventArgs e)
        {
            Thread.Sleep(5000);

            if (BotEnvironment.Settings["show.debug"] == "true")
            {
                Logger.WriteLine("Client_OnDisconnected", Color.DarkCyan);
            }

            Logger.WriteLine("O bot foi desconectado", Color.IndianRed);
            Logger.WriteLine($"Tentando reconectar...", Color.IndianRed);


            if (BotEnvironment.Settings["console.beep"] == "true")
            {
                Console.Beep();
            }

            BotEnvironment.Bot.Client.Reconnect();
        }
示例#24
0
        /// <summary>
        /// Detects disconnects outside the shutdown state and attempts to reconnect, using exponential backoff.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">An <see cref="OnDisconnectedEventArgs"/> object.</param>
        private async void TwitchClient_OnDisconnected(object sender, OnDisconnectedEventArgs e)
        {
            this.OnDisconnected?.Invoke(this, e);

            if (!this._shutdown)
            {
                await Task.Run(async() =>
                {
                    while (DateTime.Now.CompareTo(this._nextConnectAttempt) < 0)
                    {
                        await Task.Delay(1000).ConfigureAwait(false);
                    }

                    this._nextConnectAttempt = DateTime.Now.AddSeconds(_nextConnectAttemptBackoffValues[this._nextConnectAttemptBackoffKey]);
                    this.Reconnect();
                    this._nextConnectAttemptBackoffKey++;
                    if (this._nextConnectAttemptBackoffKey >= _nextConnectAttemptBackoffValues.Length)
                    {
                        this._nextConnectAttemptBackoffKey = _nextConnectAttemptBackoffValues.Length - 1;
                    }
                }).ConfigureAwait(false);
            }
        }
 private void Client_OnDisconnected(object sender, OnDisconnectedEventArgs e)
 {
     Environment.Exit(0);
 }
 private void ClientOnDisconnected(object sender, OnDisconnectedEventArgs e)
 {
 }
 private void Client_OnDisconnected(object sender, OnDisconnectedEventArgs e)
 {
     logger.Information($"Disconnected");
     bus.Publish(new DisconnectedFromTwitchEvent());
 }
示例#28
0
 private void Client_OnDisconnected(object sender, OnDisconnectedEventArgs e)
 {
     Console.WriteLine("DISCONNECTED");
     _client.Reconnect();
 }
示例#29
0
 private static void OnDisconnect(object sender, OnDisconnectedEventArgs e)
 {
     BNC_Core.Logger.Log($"{TwitchUsername} has disconnected from Twitch channel : {TwitchChannel}", LogLevel.Warn);
     attemptReconnect();
 }
示例#30
0
 private void OnDisconnected(object sender, OnDisconnectedEventArgs e)
 {
     logger.LogInformation("Disconnected from the Twitch IRC Server");
     TryToReconnect();
 }