Skip to main content

Easily create pagination for discord.py embeds.

Project description

embed-pagination

Notes

This project is a fork of an inactive repository at https://github.com/soosBot-com/Pagination
Credit is due to the contributors of the original project.

New features 💡

  • Added new on_timeout options
  • Added buttons for first/last page
  • Improved button layout
  • Many more general improvements

Installation

Use the package manager pip to install the library.

pip install simple-embed-pagination

Usage

Important: discord.py master, or a form that has discord.ui.View is required to use this library!

Quickstart

import paginator

# Create a list of embeds to paginate.
embeds = [discord.Embed(title="First embed"),
          discord.Embed(title="Second embed"),
          discord.Embed(title="Third embed")]

... # Inside a command.
await paginator.Simple().start(ctx, pages=embeds)

Hint: The ctx parameter is of type discord.Interaction

Advanced

To use custom buttons, pass in the corresponding argument when you initiate the paginator. THESE ARE OPTIONAL
# These arguments override the default ones.

PreviousButton = discord.ui.Button(...)
NextButton = discord.ui.Button(...)
PageCounterStyle = discord.ButtonStyle(...) # Only accepts discord.ButtonStyle
InitialPage = 0 # Page to start the paginator on.
OnTimeout = 'disable_view' # Delete paginator message on timeout. Default is False.
timeout = 400 # Seconds to timeout. Default is 60.
ephemeral = True # Defaults to False if not passed in.
FirstButton = discord.ui.Button(...)
LastButton = discord.ui.Button(...)

await paginator.Simple(
    previous_button=">",
    next_buttom=NextButton,
    page_counter_style=PageCounterStyle,
    initial_page=InitialPage,
    allow_ext_input=True,
    on_timeout=DeleteOnTimeout,
    timeout=timeout,
    ephemeral=ephemeral,
    first_button=FirstButton,
    last_button=LastButton
    
).start(ctx, pages=embeds)

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simple-embed-pagination-1.0.2.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

simple_embed_pagination-1.0.2-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file simple-embed-pagination-1.0.2.tar.gz.

File metadata

File hashes

Hashes for simple-embed-pagination-1.0.2.tar.gz
Algorithm Hash digest
SHA256 d2f8895e34a5a037f76d0f44bb19d2c9449e73e6ee619cd3490e0ed31da4a166
MD5 578e94fcee750be055921ac03b20c193
BLAKE2b-256 d3ebfbc5d693bd7d656197973bfac53dc3ff1f14b766ee02b40a418a591a6660

See more details on using hashes here.

File details

Details for the file simple_embed_pagination-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for simple_embed_pagination-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c89f2439637255cc8f86afbb99056f289050db8ce5ee9b6376c8690c526d9386
MD5 72583838acf365dd46766224eb832cc7
BLAKE2b-256 a634099cb7f52f65f675a46fb06d53f0637d73353b9a1169412d5b2505d5fad1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page