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 git+https://github.com/FaddyManatee/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
Close
Hashes for simple-embed-pagination-1.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ea175d4e0efe7b9562b8dfb51bf4f55c7cc900abd75f5ed5283165223a9f9b7 |
|
MD5 | d700a3e437000afc3074b9bcd2b06656 |
|
BLAKE2b-256 | d6a9ec37ccfa338f8a5d8492fc1393ed6e666e666b4f750e867b1148fd036bc2 |
Close
Hashes for simple_embed_pagination-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7515492a685a91166a3e3aae0e28054f308fdd4564391be40c5ec49afe0c2708 |
|
MD5 | ea15d110ac5ec6a2f8d2bc9d66332486 |
|
BLAKE2b-256 | 4edf0460d5f960bdce75a41e8b10b1e8a11b71078aaa6e7f27f349801624961b |