diff --git a/CHANGELOG.md b/CHANGELOG.md index 674fee9e46..2de68efacd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,8 @@ These changes are available on the `master` branch, but have not yet been releas ([#1940](https://github.com/Pycord-Development/pycord/pull/1940)) - Added support for text-related features in `StageChannel`. ([#1936](https://github.com/Pycord-Development/pycord/pull/1936)) +- Added `current_page` argument to Paginator.update() + ([#1983](https://github.com/Pycord-Development/pycord/pull/1983)) ## [2.4.1] - 2023-03-20 diff --git a/discord/ext/pages/pagination.py b/discord/ext/pages/pagination.py index 463992988b..6228158c63 100644 --- a/discord/ext/pages/pagination.py +++ b/discord/ext/pages/pagination.py @@ -465,6 +465,7 @@ async def update( custom_buttons: list[PaginatorButton] | None = None, trigger_on_display: bool | None = None, interaction: discord.Interaction | None = None, + current_page: int = 0, ): """Updates the existing :class:`Paginator` instance with the provided options. @@ -505,6 +506,8 @@ async def update( interaction: Optional[:class:`discord.Interaction`] The interaction to use when updating the paginator. If not provided, the paginator will be updated by using its stored :attr:`message` attribute instead. + current_page: :class:`int` + The initial page number to display when updating the paginator. """ # Update pages and reset current_page to 0 (default) @@ -527,7 +530,7 @@ async def update( self.page_groups[self.default_page_group] ) self.page_count = max(len(self.pages) - 1, 0) - self.current_page = 0 + self.current_page = current_page if current_page <= self.page_count else 0 # Apply config changes, if specified self.show_disabled = ( show_disabled if show_disabled is not None else self.show_disabled