From fc7ac80f4366c6c445036ca3f6bdadcd02067047 Mon Sep 17 00:00:00 2001 From: Alex Gravely Date: Fri, 19 Oct 2018 16:53:52 -0400 Subject: [PATCH] Resolve DI issue with initialized client; properly initialize command handling service. --- samples/03_sharded_client/Program.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/samples/03_sharded_client/Program.cs b/samples/03_sharded_client/Program.cs index f89e0eb3c..048145f9f 100644 --- a/samples/03_sharded_client/Program.cs +++ b/samples/03_sharded_client/Program.cs @@ -27,9 +27,8 @@ namespace _03_sharded_client TotalShards = 2 }; - var services = ConfigureServices(); - _client = new DiscordShardedClient(config); + var services = ConfigureServices(); // The Sharded Client does not have a Ready event. // The ShardReady event is used instead, allowing for individual @@ -37,6 +36,8 @@ namespace _03_sharded_client _client.ShardReady += ReadyAsync; _client.Log += LogAsync; + await services.GetRequiredService().InitializeAsync(); + await _client.LoginAsync(TokenType.Bot, Environment.GetEnvironmentVariable("token")); await _client.StartAsync();