Decently sized C#6 refactor
Also removed unused using statements
This commit is contained in:
@@ -6,32 +6,29 @@ namespace NadekoBot
|
||||
{
|
||||
class HelpCommand : DiscordCommand
|
||||
{
|
||||
public override Func<CommandEventArgs, Task> DoFunc()
|
||||
public override Func<CommandEventArgs, Task> DoFunc() => async e =>
|
||||
{
|
||||
return async e =>
|
||||
{
|
||||
string helpstr = "Official repo: **github.com/Kwoth/NadekoBot/** \n";
|
||||
string helpstr = "Official repo: **github.com/Kwoth/NadekoBot/** \n";
|
||||
|
||||
string lastCategory = "";
|
||||
foreach (var com in client.Commands().AllCommands)
|
||||
{
|
||||
if (com.Category != lastCategory)
|
||||
{
|
||||
helpstr += "\n`----`**`" + com.Category + "`**`----`\n";
|
||||
lastCategory = com.Category;
|
||||
}
|
||||
helpstr += PrintCommandHelp(com);
|
||||
}
|
||||
helpstr = helpstr.Replace(NadekoBot.botMention, "@BotName");
|
||||
while (helpstr.Length > 2000)
|
||||
{
|
||||
var curstr = helpstr.Substring(0, 2000);
|
||||
await client.SendMessage(e.User, curstr.Substring(0, curstr.LastIndexOf("\n")+1));
|
||||
helpstr = curstr.Substring(curstr.LastIndexOf("\n")+1) + helpstr.Substring(2000);
|
||||
}
|
||||
await client.SendMessage(e.User, helpstr);
|
||||
};
|
||||
}
|
||||
string lastCategory = "";
|
||||
foreach (var com in client.Commands().AllCommands)
|
||||
{
|
||||
if (com.Category != lastCategory)
|
||||
{
|
||||
helpstr += "\n`----`**`" + com.Category + "`**`----`\n";
|
||||
lastCategory = com.Category;
|
||||
}
|
||||
helpstr += PrintCommandHelp(com);
|
||||
}
|
||||
helpstr = helpstr.Replace(NadekoBot.botMention, "@BotName");
|
||||
while (helpstr.Length > 2000)
|
||||
{
|
||||
var curstr = helpstr.Substring(0, 2000);
|
||||
await client.SendMessage(e.User, curstr.Substring(0, curstr.LastIndexOf("\n") + 1));
|
||||
helpstr = curstr.Substring(curstr.LastIndexOf("\n") + 1) + helpstr.Substring(2000);
|
||||
}
|
||||
await client.SendMessage(e.User, helpstr);
|
||||
};
|
||||
|
||||
public override void Init(CommandGroupBuilder cgb)
|
||||
{
|
||||
|
Reference in New Issue
Block a user