Connecting will now show how many shards connected so far
This commit is contained in:
		@@ -249,14 +249,12 @@ namespace NadekoBot
 | 
				
			|||||||
            await Client.LoginAsync(TokenType.Bot, token).ConfigureAwait(false);
 | 
					            await Client.LoginAsync(TokenType.Bot, token).ConfigureAwait(false);
 | 
				
			||||||
            await Client.StartAsync().ConfigureAwait(false);
 | 
					            await Client.StartAsync().ConfigureAwait(false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // wait for all shards to be ready
 | 
					 | 
				
			||||||
            int readyCount = 0;
 | 
					 | 
				
			||||||
            foreach (var s in Client.Shards)
 | 
					 | 
				
			||||||
                s.Ready += () => Task.FromResult(Interlocked.Increment(ref readyCount));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            _log.Info("Waiting for all shards to connect...");
 | 
					            _log.Info("Waiting for all shards to connect...");
 | 
				
			||||||
            while (readyCount < Client.Shards.Count)
 | 
					            while (!Client.Shards.All(x => x.ConnectionState == ConnectionState.Connected))
 | 
				
			||||||
                await Task.Delay(100).ConfigureAwait(false);
 | 
					            {
 | 
				
			||||||
 | 
					                _log.Info("Connecting... {0}/{1}", Client.Shards.Count(x => x.ConnectionState == ConnectionState.Connected), Client.Shards.Count);
 | 
				
			||||||
 | 
					                await Task.Delay(1000).ConfigureAwait(false);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public async Task RunAsync(params string[] args)
 | 
					        public async Task RunAsync(params string[] args)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user