diff --git a/src/Discord.Net.Commands/Attributes/ModuleAttribute.cs b/src/Discord.Net.Commands/Attributes/ModuleAttribute.cs index ec04041e8..3a5d9363e 100644 --- a/src/Discord.Net.Commands/Attributes/ModuleAttribute.cs +++ b/src/Discord.Net.Commands/Attributes/ModuleAttribute.cs @@ -6,16 +6,14 @@ namespace Discord.Commands public class ModuleAttribute : Attribute { public string Prefix { get; } - public bool AutoLoad { get; set; } - public ModuleAttribute() - { - Prefix = null; - AutoLoad = true; - } - public ModuleAttribute(string prefix) + public bool AutoLoad { get; } + public bool ForceWhitespace { get; } + + public ModuleAttribute(string prefix = null) { Prefix = prefix; AutoLoad = true; + ForceWhitespace = true; } } } diff --git a/src/Discord.Net.Commands/Module.cs b/src/Discord.Net.Commands/Module.cs index f965d78ab..1dcd95801 100644 --- a/src/Discord.Net.Commands/Module.cs +++ b/src/Discord.Net.Commands/Module.cs @@ -34,15 +34,15 @@ namespace Discord.Commands Description = descriptionAttr.Text; List commands = new List(); - SearchClass(source, instance, commands, moduleAttr.Prefix ?? ""); + SearchClass(source, instance, commands, moduleAttr.Prefix ?? "", moduleAttr.ForceWhitespace); Commands = commands; Preconditions = BuildPreconditions(); } - private void SearchClass(TypeInfo parentType, object instance, List commands, string groupPrefix) + private void SearchClass(TypeInfo parentType, object instance, List commands, string groupPrefix, bool forceWhitespace) { - if (groupPrefix != "") + if (groupPrefix != "" && forceWhitespace) groupPrefix += " "; foreach (var method in parentType.DeclaredMethods) { @@ -60,7 +60,7 @@ namespace Discord.Commands nextGroupPrefix = groupPrefix + groupAttrib.Prefix ?? type.Name; else nextGroupPrefix = groupPrefix; - SearchClass(type, ReflectionUtils.CreateObject(type, Service), commands, nextGroupPrefix); + SearchClass(type, ReflectionUtils.CreateObject(type, Service), commands, nextGroupPrefix, forceWhitespace); } } }