Browse Source

Resolve DI issue with initialized client; properly initialize command handling service.

pull/1177/head
Alex Gravely 6 years ago
parent
commit
fc7ac80f43
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      samples/03_sharded_client/Program.cs

+ 3
- 2
samples/03_sharded_client/Program.cs View File

@@ -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<CommandHandlingService>().InitializeAsync();

await _client.LoginAsync(TokenType.Bot, Environment.GetEnvironmentVariable("token"));
await _client.StartAsync();



Loading…
Cancel
Save