-h now properly shows and works with aliases

This commit is contained in:
Kwoth 2016-09-04 01:21:08 +02:00
parent a6fce3f6c8
commit da7dbb7f32

View File

@ -76,11 +76,19 @@ namespace NadekoBot.Modules.Help
await (await (umsg.Author as IGuildUser).CreateDMChannelAsync()).SendMessageAsync(HelpString).ConfigureAwait(false); await (await (umsg.Author as IGuildUser).CreateDMChannelAsync()).SendMessageAsync(HelpString).ConfigureAwait(false);
return; return;
} }
var com = _commands.Commands.FirstOrDefault(c => c.Text.ToLowerInvariant() == comToFind); var com = _commands.Commands.FirstOrDefault(c => c.Text.ToLowerInvariant() == comToFind || c.Aliases.Select(a=>a.ToLowerInvariant()).Contains(comToFind));
if (com == null)
{
await channel.SendMessageAsync("`No command found.`");
return;
}
var str = $"**__Help for:__ `{com.Text}`**";
var alias = com.Aliases.Skip(1).FirstOrDefault();
if (alias != null)
str += $" / `{ alias }`";
if (com != null) if (com != null)
await channel.SendMessageAsync($@"**__Help for:__ `{com.Text}`** await channel.SendMessageAsync(str + $@"{Environment.NewLine}**Desc:** {com.Description}
**Desc:** {com.Description}
**Usage:** {com.Summary}").ConfigureAwait(false); **Usage:** {com.Summary}").ConfigureAwait(false);
} }