Browse Source

Allow modules to be built regardless of their declaring type.

pull/969/head
Alex Gravely 7 years ago
parent
commit
b52cffdbcc
1 changed files with 1 additions and 4 deletions
  1. +1
    -4
      src/Discord.Net.Commands/Builders/ModuleClassBuilder.cs

+ 1
- 4
src/Discord.Net.Commands/Builders/ModuleClassBuilder.cs View File

@@ -48,14 +48,11 @@ namespace Discord.Commands
/*if (!validTypes.Any()) /*if (!validTypes.Any())
throw new InvalidOperationException("Could not find any valid modules from the given selection");*/ throw new InvalidOperationException("Could not find any valid modules from the given selection");*/


var topLevelGroups = validTypes.Where(x => x.DeclaringType == null);
var subGroups = validTypes.Intersect(topLevelGroups);

var builtTypes = new List<TypeInfo>(); var builtTypes = new List<TypeInfo>();


var result = new Dictionary<Type, ModuleInfo>(); var result = new Dictionary<Type, ModuleInfo>();


foreach (var typeInfo in topLevelGroups)
foreach (var typeInfo in validTypes)
{ {
// TODO: This shouldn't be the case; may be safe to remove? // TODO: This shouldn't be the case; may be safe to remove?
if (result.ContainsKey(typeInfo.AsType())) if (result.ContainsKey(typeInfo.AsType()))


Loading…
Cancel
Save