diff --git a/src/Discord.Net.Commands/Command.cs b/src/Discord.Net.Commands/Command.cs index 61eff4877..9df0bcc9d 100644 --- a/src/Discord.Net.Commands/Command.cs +++ b/src/Discord.Net.Commands/Command.cs @@ -38,7 +38,15 @@ namespace Discord.Commands _instance = instance; Name = source.Name; - Text = groupPrefix + attribute.Text; + + if (attribute.Text == null) + Text = groupPrefix; + + if (groupPrefix != "") + groupPrefix += " "; + + if (attribute.Text != null) + Text = groupPrefix + attribute.Text; var aliasesBuilder = ImmutableArray.CreateBuilder(); diff --git a/src/Discord.Net.Commands/Module.cs b/src/Discord.Net.Commands/Module.cs index 0624e6ef3..7b8113252 100644 --- a/src/Discord.Net.Commands/Module.cs +++ b/src/Discord.Net.Commands/Module.cs @@ -48,8 +48,6 @@ namespace Discord.Commands private void SearchClass(TypeInfo parentType, object instance, List commands, string groupPrefix, IDependencyMap dependencyMap) { - if (groupPrefix != "") - groupPrefix += " "; foreach (var method in parentType.DeclaredMethods) { var cmdAttr = method.GetCustomAttribute(); @@ -62,10 +60,12 @@ namespace Discord.Commands if (groupAttrib != null) { string nextGroupPrefix; - if (groupAttrib.Prefix != null) - nextGroupPrefix = groupPrefix + groupAttrib.Prefix ?? type.Name; + + if (groupPrefix != "") + nextGroupPrefix = groupPrefix + " " + (groupAttrib.Prefix ?? type.Name.ToLowerInvariant()); else - nextGroupPrefix = groupPrefix; + nextGroupPrefix = groupAttrib.Prefix ?? type.Name.ToLowerInvariant(); + SearchClass(type, ReflectionUtils.CreateObject(type, Service, dependencyMap), commands, nextGroupPrefix, dependencyMap); } }