Skip to content

Commit 792eb11

Browse files
authored
fix: AsyncIterator buttons not getting displayed (#25)
1 parent 8f8ddd4 commit 792eb11

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

nextcord/ext/menus/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
from .utils import *
77

88
# Needed for the setup.py script
9-
__version__ = "1.3.3"
9+
__version__ = "1.3.4"

nextcord/ext/menus/menu_pages.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ async def start(
121121
):
122122
await self._source._prepare_once()
123123
await super().start(ctx, channel=channel, wait=wait)
124+
# If we're not paginating, we can remove the pagination buttons
125+
if not self._source.is_paginating():
126+
await self.clear()
124127

125128
async def show_checked_page(self, page_number: int):
126129
max_pages = self._source.get_max_pages()

nextcord/ext/menus/page_source.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,10 @@ async def prepare(self, *, _aiter=_aiter):
339339

340340
def is_paginating(self) -> bool:
341341
""":class:`bool`: Whether pagination is required."""
342-
return len(self._cache) > self.per_page
342+
# If we have not prepared yet, we do not know if we are paginating, so we return True
343+
# This is to ensure that the buttons will be created in the case we are paginating
344+
# If we have prepared, but we are exhausted before 1 page, we are not paginating
345+
return not self._cache or len(self._cache) > self.per_page
343346

344347
async def _get_single_page(self, page_number: int) -> DataType:
345348
if page_number < 0:

0 commit comments

Comments
 (0)