Browse Source

Fix missing service provider in example

pull/1161/head
Still Hsu 7 years ago
parent
commit
e9f72b6ece
No known key found for this signature in database GPG Key ID: 8601A145FDA95209
1 changed files with 6 additions and 4 deletions
  1. +6
    -4
      docs/guides/commands/samples/command_handler.cs

+ 6
- 4
docs/guides/commands/samples/command_handler.cs View File

@@ -1,12 +1,14 @@
public class CommandHandle
public class CommandHandler
{
private readonly DiscordSocketClient _client;
private readonly CommandService _commands;
private readonly IServiceProvider _services;

public CommandHandle(DiscordSocketClient client)
public CommandHandler(IServiceProvider services)
{
_client = client;
_commands = new CommandService();
_services = services;
_commands = services.GetRequiredService<CommandService>();
_client = services.GetRequiredService<DiscordSocketClient>();
}
public async Task InstallCommandsAsync()


Loading…
Cancel
Save