An easy-to-use pagination wrapper for discord.py
Project description
Pygicord
An easy-to-use pagination wrapper for discord.py
Installing
pip install pygicord
Getting started
The following examples help you understand how pygicord works.
Basic paginator
import discord
from discord.ext import commands
from pygicord import Paginator
bot = commands.Bot(command_prefix=".")
def get_pages():
pages = []
# Generate a list of 5 embeds
for i in range(1, 6):
embed = discord.Embed()
embed.title = f"I'm the embed {i}!"
pages.append(embed)
return pages
@bot.command()
async def test(ctx):
paginator = Paginator(pages=get_pages())
await paginator.start(ctx)
@bot.event
async def on_ready():
print("I'm ready!")
bot.run("token")
Custom paginator
import discord
from discord.ext import commands
from pygicord import Paginator
bot = commands.Bot(command_prefix=".")
def get_pages():
pages = []
for i in range(1, 6):
embed = discord.Embed()
embed.title = f"I'm the embed {i}!"
pages.append(embed)
return pages
@bot.command()
async def test(ctx):
paginator = Paginator(
pages=get_pages(),
timeout=60.0,
has_input=False,
)
await paginator.start(ctx)
@bot.event
async def on_ready():
print("I'm ready!")
bot.run("token")
Attributes
Name | Description | Type | Default |
---|---|---|---|
pages | A list of embeds you want the paginator to paginate or a discord.Embed instance. | List[discord.Embed], discord.Embed | None |
timeout | The timeout to wait before stopping the paginator session. | float | 90.0 |
compact | Whether the paginator should only use three reactions: previous, stop and next. | bool | False |
has_input | Whether the paginator should add a reaction for taking input numbers. | bool | True |
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
pygicord-0.4.1.tar.gz
(5.2 kB
view hashes)