Browse Source

[docs] Merge pull request #398 from Esscoder/patch-3

Fixed async method
pull/402/head
Christopher F GitHub 8 years ago
parent
commit
a967ca1ec0
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      docs/guides/samples/require_owner.cs

+ 2
- 2
docs/guides/samples/require_owner.cs View File

@@ -4,7 +4,7 @@
public class RequireOwnerAttribute : PreconditionAttribute public class RequireOwnerAttribute : PreconditionAttribute
{ {
// Override the CheckPermissions method // Override the CheckPermissions method
public override Task<PreconditionResult> CheckPermissions(CommandContext context, CommandInfo command, IDependencyMap map)
public async override Task<PreconditionResult> CheckPermissions(CommandContext context, CommandInfo command, IDependencyMap map)
{ {
// Get the ID of the bot's owner // Get the ID of the bot's owner
var ownerId = (await map.Get<DiscordSocketClient>().GetApplicationInfoAsync()).Owner.Id; var ownerId = (await map.Get<DiscordSocketClient>().GetApplicationInfoAsync()).Owner.Id;
@@ -15,4 +15,4 @@ public class RequireOwnerAttribute : PreconditionAttribute
else else
return PreconditionResult.FromError("You must be the owner of the bot to run this command."); return PreconditionResult.FromError("You must be the owner of the bot to run this command.");
} }
}
}

Loading…
Cancel
Save