Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ext-pages] Fix for specifying an initial page before sending the paginator #859

Merged
merged 3 commits into from
Jan 26, 2022
Merged

[ext-pages] Fix for specifying an initial page before sending the paginator #859

merged 3 commits into from
Jan 26, 2022

Conversation

krittick
Copy link
Contributor

Summary

This sets the initial page in Paginator.respond() and Paginator.send() to Paginator.current_page instead of the current value of 0. Since current_page defaults to 0, this should not be a breaking change.

This allows users to set the initial page before sending the paginator. For example:

@slash_command()
async def pagetest_initial(self, ctx: discord.ApplicationContext):
    """Demonstrates setting an initial page before sending."""
    paginator = pages.Paginator(pages=["Page 1", "Page 2", "Page 3", "Page 4"])
    paginator.current_page = 2
    await paginator.respond(ctx.interaction)

Fixes #858

Checklist

  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • If type: ignore comments were used, a comment is also left explaining why
  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, typehinting, examples, ...)

Copy link

@bensaine bensaine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me!

@Lulalaby Lulalaby enabled auto-merge (rebase) January 26, 2022 06:20
@Lulalaby Lulalaby enabled auto-merge (squash) January 26, 2022 06:21
@Lulalaby Lulalaby merged commit eb981d3 into Pycord-Development:master Jan 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ext.pages Relating to ext.pages feature request New feature request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set pagination's current page before pagination is sent or responded
4 participants