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.
- Added an option to delete paginator message upon timeout.
Use the package manager pip to install the library.
pip install git+https://github.com/FaddyManatee/embed-pagination
Important: discord.py or a form that has the discord.ui.View class is required to use this library!
from paginator 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")]
... # use the following inside a command.
await Paginator().start(ctx, pages=embeds)
Hint: The
ctx
parameter is an instance ofdiscord.Interaction
orcommands.Context
"""
These arguments override the defaults.
"""
# Override appearance of the default paginator buttons.
new_prev = discord.ui.Button(...)
new_next = discord.ui.Button(...)
counter_style = discord.ButtonStyle(...) # Only accepts discord.ButtonStyle
page_number = 2 # Page to start the paginator on. Default is 0.
delete_on_timeout = True # Delete paginator message on timeout. Default is False.
timeout = 400 # Seconds until timeout. Default is 60.
ephemeral = True # Defaults to false if not passed in.
await Paginator(
previous_button=new_prev,
next_button=new_next,
page_counter_style=counter_style,
initial_page=page_number,
delete_on_timeout=delete_on_timeout,
timeout=timeout,
ephemeral=ephemeral).start(ctx, pages=embeds)
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.