diff options
author | Kobert-P <kassiaK@yahoo.de> | 2018-06-07 11:21:55 +0200 |
---|---|---|
committer | Kobert-P <kassiaK@yahoo.de> | 2018-06-07 11:21:55 +0200 |
commit | 5b87516befe2e4fd0d2f4b372747836d2abf0c8c (patch) | |
tree | 3287f86d862a26b401992bdf9eb2752c8bc517b3 /DiscoBot/Commands/Help.cs | |
parent | a8ec8940142303504f51c99384c6f86ee8fd7b2d (diff) |
Multiline help description
Diffstat (limited to 'DiscoBot/Commands/Help.cs')
-rw-r--r-- | DiscoBot/Commands/Help.cs | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/DiscoBot/Commands/Help.cs b/DiscoBot/Commands/Help.cs index 2ba3fb6..d6c0e68 100644 --- a/DiscoBot/Commands/Help.cs +++ b/DiscoBot/Commands/Help.cs @@ -25,13 +25,23 @@ namespace DiscoBot.Commands reader.Read(); // step into structure, until the array starts reader.Read(); reader.Read(); - var test = new JsonSerializer().Deserialize<List<CommandInfo>>(reader); // Deserialize Data and create CommandInfo Struct - Commands.AddRange(test); // Add new CommandInfos to List + + try + { + var test = new JsonSerializer().Deserialize<List<CommandInfo>>(reader); // Deserialize Data and create CommandInfo Struct + + Commands.AddRange(test); // Add new CommandInfos to List + } + catch (Exception e) + { + // ignored + } } public static List<CommandInfo> Commands { get; } = new List<CommandInfo>(); [Command("help"), Summary("prints the help menu.")] + [Alias("Help", "man", "Man")] public async Task ShowHelpAsync(string command = "") { if (command.Equals(string.Empty)) // return generic Help @@ -40,10 +50,12 @@ namespace DiscoBot.Commands return; } + + // return command specific help - var com = Commands.OrderBy(x => SpellCorrect.CompareEasy(x.Name, command)).First(); // get best fit command + var com = Commands.OrderBy(x => SpellCorrect.CompareEasy(x.Name, command.ToLower())).First(); // get best fit command - await this.ReplyAsync("```\n" + com.Name + "\n" + com.Description + "\n```"); + await this.ReplyAsync("```xl\n" + com.GetDescription() + "\n```"); } } } |