Add Autoload to Module Attribute

[UNTESTED] Adds an optional parameter to the Module attribute, "autoload", which defaults to true.

Specifies whether or not the assembly crawler should load this module.
This commit is contained in:
Christopher F
2016-07-20 17:20:37 -04:00
parent ba370aa865
commit 6e42acba68
2 changed files with 6 additions and 3 deletions

View File

@@ -174,7 +174,7 @@ namespace Discord.Commands
{
var typeInfo = type.GetTypeInfo();
var moduleAttr = typeInfo.GetCustomAttribute<ModuleAttribute>();
if (moduleAttr != null)
if (moduleAttr != null && moduleAttr.Autoload)
{
var moduleInstance = ReflectionUtils.CreateObject(typeInfo);
modules.Add(LoadInternal(moduleInstance, moduleAttr, typeInfo));