diff --git a/src/Discord.Net.Commands/Attributes/ModuleAttribute.cs b/src/Discord.Net.Commands/Attributes/ModuleAttribute.cs index 59e6a6aca..57f525389 100644 --- a/src/Discord.Net.Commands/Attributes/ModuleAttribute.cs +++ b/src/Discord.Net.Commands/Attributes/ModuleAttribute.cs @@ -6,13 +6,16 @@ namespace Discord.Commands public class ModuleAttribute : Attribute { public string Prefix { get; } - public ModuleAttribute() + public bool Autoload { get; } + public ModuleAttribute(bool autoload = true) { Prefix = null; + Autoload = autoload; } - public ModuleAttribute(string prefix) + public ModuleAttribute(string prefix, bool autoload = true) { Prefix = prefix; + Autoload = autoload; } } } diff --git a/src/Discord.Net.Commands/CommandService.cs b/src/Discord.Net.Commands/CommandService.cs index f762ae366..9fd8aecc9 100644 --- a/src/Discord.Net.Commands/CommandService.cs +++ b/src/Discord.Net.Commands/CommandService.cs @@ -174,7 +174,7 @@ namespace Discord.Commands { var typeInfo = type.GetTypeInfo(); var moduleAttr = typeInfo.GetCustomAttribute(); - if (moduleAttr != null) + if (moduleAttr != null && moduleAttr.Autoload) { var moduleInstance = ReflectionUtils.CreateObject(typeInfo); modules.Add(LoadInternal(moduleInstance, moduleAttr, typeInfo));