feat: ignore user commands
This commit is contained in:
parent
a50a8567dd
commit
b52df95b65
4 changed files with 143 additions and 3 deletions
|
|
@ -44,4 +44,28 @@ public static class DiscordUtils
|
|||
description,
|
||||
new Embed(Title: title, Colour: Purple)
|
||||
);
|
||||
|
||||
public static List<Embed> PaginateStrings(
|
||||
IEnumerable<string> strings,
|
||||
Optional<string> title = default,
|
||||
int stringsPerPage = 20
|
||||
)
|
||||
{
|
||||
var pages = strings.ToArray().Split(stringsPerPage);
|
||||
return pages
|
||||
.Select(p => new Embed(
|
||||
Title: title,
|
||||
Colour: Purple,
|
||||
Description: string.Join("\n", p.Select((row, i) => $"{i + 1}. {row}"))
|
||||
))
|
||||
.ToList();
|
||||
}
|
||||
|
||||
private static IEnumerable<IEnumerable<T>> Split<T>(this T[] arr, int size)
|
||||
{
|
||||
for (var i = 0; i < arr.Length / size + 1; i++)
|
||||
{
|
||||
yield return arr.Skip(i * size).Take(size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue