Avoid a blank overflow page when showing paginated cards (closes #171)

This commit is contained in:
Ske 2020-06-15 13:00:28 +02:00
parent 5280e48b09
commit 7fde54050a

View File

@ -103,7 +103,7 @@ namespace PluralKit.Bot {
var buffer = new List<T>(); var buffer = new List<T>();
await using var enumerator = items.GetAsyncEnumerator(); await using var enumerator = items.GetAsyncEnumerator();
var pageCount = (totalCount / itemsPerPage) + 1; var pageCount = (int) Math.Ceiling(totalCount / (double) itemsPerPage);
async Task<DiscordEmbed> MakeEmbedForPage(int page) async Task<DiscordEmbed> MakeEmbedForPage(int page)
{ {
var bufferedItemsNeeded = (page + 1) * itemsPerPage; var bufferedItemsNeeded = (page + 1) * itemsPerPage;