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 typediscord.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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file simple-embed-pagination-1.0.2.tar.gz
.
File metadata
- Download URL: simple-embed-pagination-1.0.2.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2f8895e34a5a037f76d0f44bb19d2c9449e73e6ee619cd3490e0ed31da4a166 |
|
MD5 | 578e94fcee750be055921ac03b20c193 |
|
BLAKE2b-256 | d3ebfbc5d693bd7d656197973bfac53dc3ff1f14b766ee02b40a418a591a6660 |
File details
Details for the file simple_embed_pagination-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: simple_embed_pagination-1.0.2-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c89f2439637255cc8f86afbb99056f289050db8ce5ee9b6376c8690c526d9386 |
|
MD5 | 72583838acf365dd46766224eb832cc7 |
|
BLAKE2b-256 | a634099cb7f52f65f675a46fb06d53f0637d73353b9a1169412d5b2505d5fad1 |