abstracted showinprettycode out
This commit is contained in:
parent
4c5b5348ba
commit
b41a78f674
@ -377,5 +377,13 @@ namespace NadekoBot.Classes
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
||||
public static string ShowInPrettyCode<T>(IEnumerable<T> items, Func<T, string> howToPrint, int cols = 3)
|
||||
{
|
||||
var i = 0;
|
||||
return "```xl\n" + string.Join("\n", items.GroupBy(item => (i++) / cols)
|
||||
.Select(ig => string.Join("", ig.Select(el => howToPrint(el)))))
|
||||
+ $"\n```";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
using Discord.Commands;
|
||||
using Discord.Modules;
|
||||
using NadekoBot.Classes;
|
||||
using NadekoBot.Classes.Help.Commands;
|
||||
using NadekoBot.Extensions;
|
||||
using NadekoBot.Modules.Permissions.Classes;
|
||||
@ -54,10 +55,8 @@ namespace NadekoBot.Modules.Help
|
||||
}
|
||||
var i = 0;
|
||||
if (module != "customreactions" && module != "conversations")
|
||||
await e.Channel.SendMessage("`List Of Commands:`\n```xl\n" +
|
||||
string.Join("\n", cmdsArray.GroupBy(item => (i++) / 3)
|
||||
.Select(ig => string.Join("", ig.Select(el => $"{el.Text,-15}" + $"{"[" + el.Aliases.FirstOrDefault() + "]",-8}"))))
|
||||
+ $"\n```")
|
||||
await e.Channel.SendMessage("`List Of Commands:`\n" + SearchHelper.ShowInPrettyCode<Command>(cmdsArray,
|
||||
el => $"{el.Text,-15}{"[" + el.Aliases.FirstOrDefault() + "]",-8}"))
|
||||
.ConfigureAwait(false);
|
||||
else
|
||||
await e.Channel.SendMessage("`List Of Commands:`\n• " + string.Join("\n• ", cmdsArray.Select(c => $"{c.Text}")));
|
||||
|
Loading…
Reference in New Issue
Block a user