Beispiel #1
0
        private async Task InitShards(DiscordHttpClient client)
        {
            try {
                List <Task> handlerinits = new List <Task>();
                int         MinShards    = await client.GetBotRequiredShards().ConfigureAwait(true);

                for (int i = handlers.Count; i < MinShards; i++)
                {
                    Shard s = new Shard(config.Token, i, MinShards);
                    handlerinits.Add(s.StartAsync().ContinueWith(delegate {
                        InitHandler(client, s);
                    }, TaskScheduler.Default));
                }
                Task.WaitAll(handlerinits.ToArray());
            } catch (Exception ex) {
                log.Error(ex.ToString());
                throw;
            }
        }