Skip to content

Commit

Permalink
Allow nested ModuleBase classes to be built when declared from non-mo…
Browse files Browse the repository at this point in the history
…dule classes. (#969)

* Allow modules to be built regardless of their declaring type.

* Need to exclude submodules.
  • Loading branch information
AntiTcb authored and foxbot committed Mar 4, 2018
1 parent f19730e commit 4edbd8d
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/Discord.Net.Commands/Builders/ModuleClassBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ public static async Task<Dictionary<Type, ModuleInfo>> BuildAsync(IEnumerable<Ty
/*if (!validTypes.Any())
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 topLevelGroups = validTypes.Where(x => x.DeclaringType == null || !IsValidModuleDefinition(x.DeclaringType.GetTypeInfo()));

var builtTypes = new List<TypeInfo>();

Expand Down

0 comments on commit 4edbd8d

Please sign in to comment.