Resolves #304pull/382/head
@@ -20,6 +20,7 @@ namespace Discord.Commands | |||||
private readonly CommandMap _map; | private readonly CommandMap _map; | ||||
internal readonly RunMode _defaultRunMode; | internal readonly RunMode _defaultRunMode; | ||||
internal readonly string _nodeSeparator; | |||||
public IEnumerable<ModuleInfo> Modules => _moduleDefs.Select(x => x); | public IEnumerable<ModuleInfo> Modules => _moduleDefs.Select(x => x); | ||||
public IEnumerable<CommandInfo> Commands => _moduleDefs.SelectMany(x => x.Commands); | public IEnumerable<CommandInfo> Commands => _moduleDefs.SelectMany(x => x.Commands); | ||||
@@ -68,6 +69,7 @@ namespace Discord.Commands | |||||
[typeof(IGuildUser)] = new UserTypeReader<IGuildUser>(), | [typeof(IGuildUser)] = new UserTypeReader<IGuildUser>(), | ||||
}; | }; | ||||
_defaultRunMode = config.DefaultRunMode; | _defaultRunMode = config.DefaultRunMode; | ||||
_nodeSeparator = config.NodeSeparator; | |||||
} | } | ||||
//Modules | //Modules | ||||
@@ -4,5 +4,7 @@ | |||||
{ | { | ||||
/// <summary> The default RunMode commands should have, if one is not specified on the Command attribute or builder. </summary> | /// <summary> The default RunMode commands should have, if one is not specified on the Command attribute or builder. </summary> | ||||
public RunMode DefaultRunMode { get; set; } = RunMode.Mixed; | public RunMode DefaultRunMode { get; set; } = RunMode.Mixed; | ||||
/// <summary> What character should be used between command nodes</summary> | |||||
public string NodeSeparator { get; set; } = " "; | |||||
} | } | ||||
} | } |
@@ -42,7 +42,6 @@ namespace Discord.Commands | |||||
// both command and module provide aliases | // both command and module provide aliases | ||||
if (module.Aliases.Count > 0 && builder.Aliases.Count > 0) | if (module.Aliases.Count > 0 && builder.Aliases.Count > 0) | ||||
Aliases = module.Aliases.Permutate(builder.Aliases, (first, second) => second != null ? first + " " + second : first).ToImmutableArray(); | |||||
// only module provides aliases | // only module provides aliases | ||||
else if (module.Aliases.Count > 0) | else if (module.Aliases.Count > 0) | ||||
Aliases = module.Aliases.ToImmutableArray(); | Aliases = module.Aliases.ToImmutableArray(); | ||||
@@ -50,6 +49,7 @@ namespace Discord.Commands | |||||
else if (builder.Aliases.Count > 0) | else if (builder.Aliases.Count > 0) | ||||
Aliases = builder.Aliases.ToImmutableArray(); | Aliases = builder.Aliases.ToImmutableArray(); | ||||
// neither provide aliases | // neither provide aliases | ||||
Aliases = module.Aliases.Permutate(builder.Aliases, (first, second) => second != null ? first + " " + second : first).ToImmutableArray(); | |||||
else | else | ||||
throw new InvalidOperationException("Cannot build a command without any aliases"); | throw new InvalidOperationException("Cannot build a command without any aliases"); | ||||