Browse Source

Merge b3590165d0 into 7f1fc286cf

pull/541/merge
Mark Gross GitHub 8 years ago
parent
commit
86c8a956d5
2 changed files with 6 additions and 0 deletions
  1. +3
    -0
      src/Discord.Net.Commands/Info/CommandInfo.cs
  2. +3
    -0
      src/Discord.Net.Commands/Info/ModuleInfo.cs

+ 3
- 0
src/Discord.Net.Commands/Info/CommandInfo.cs View File

@@ -63,6 +63,9 @@ namespace Discord.Commands
_action = builder.Callback; _action = builder.Callback;
} }


public IEnumerable<TPrecondition> GetPreconditions<TPrecondition>() where TPrecondition : PreconditionAttribute =>
Preconditions.Where(x => x.GetType() == typeof(TPrecondition)).Cast<TPrecondition>();

public async Task<PreconditionResult> CheckPreconditionsAsync(ICommandContext context, IDependencyMap map = null) public async Task<PreconditionResult> CheckPreconditionsAsync(ICommandContext context, IDependencyMap map = null)
{ {
if (map == null) if (map == null)


+ 3
- 0
src/Discord.Net.Commands/Info/ModuleInfo.cs View File

@@ -20,6 +20,9 @@ namespace Discord.Commands
public ModuleInfo Parent { get; } public ModuleInfo Parent { get; }
public bool IsSubmodule => Parent != null; public bool IsSubmodule => Parent != null;


public IEnumerable<TPrecondition> GetPreconditions<TPrecondition>() where TPrecondition : PreconditionAttribute =>
Preconditions.Where(x => x.GetType() == typeof(TPrecondition)).Cast<TPrecondition>();

internal ModuleInfo(ModuleBuilder builder, CommandService service, ModuleInfo parent = null) internal ModuleInfo(ModuleBuilder builder, CommandService service, ModuleInfo parent = null)
{ {
Service = service; Service = service;


Loading…
Cancel
Save