To install you need git installed. After installing it, run
pip install git+https://github.com/andrewthederp/Button_paginator
import button_paginator as pg
@bot.command()
async def test(ctx):
embeds = pg.embed_creator("Very long text"*10000, 1995, prefix='```\n', suffix='\n```')
paginator = pg.Paginator(bot, embeds, ctx)
paginator.default_pagination()
await paginator.start()
import button_paginator as pg
@bot.command()
async def test(ctx):
embeds = pg.embed_creator("Very long text"*10000, 1995, prefix='```\n', suffix='\n```')
paginator = pg.Paginator(bot, embeds, ctx)
paginator.add_button('prev', emoji='◀')
paginator.add_button('delete', label='Close the paginator', emoji='⏹')
paginator.add_button('next', emoji='▶')
await paginator.start()
- All actions
first
: Goes to the first embedprev
/previous
/back
: Goes to the embed before the current embeddelete
: Deletes the messagenext
: Goes to the embed after the current embedlast
: Goes to the last embedend
: Disables all the buttonspage
/show
: Shows the current embed number (always disabled)goto
: same as page/show will show the current embed number but when pressed will prompt the user to type a page number then will go to the number writtenlock
: Removes all the buttons
Since pg.Paginator
is a normal discord.ui.View subclassed class, you can add your own buttons to it!
import button_paginator as pg
class some_button(discord.ui.Button):
def __init__(self):
super().__init__(label='Hi', style=discord.ButtonStyle.danger)
@bot.command()
async def test(ctx):
embeds = pg.embed_creator("Very long text"*10000, 1995, prefix='```\n', suffix='\n```')
paginator = pg.Paginator(bot, embeds, ctx)
paginator.default_pagination()
paginator.add_item(some_button())
await paginator.start()
import button_paginator as pg
@bot.command()
async def test(ctx):
contents = ('Hello World!', discord.Embed(title='Hello World!'), ('Hello World!', discord.Embed(title="Hello World!")))
# Does not support attachments
paginator = pg.Paginator(bot, contents, ctx)
paginator.default_pagination()
await paginator.start()
I do not plan on updating this library unless some new cool button update or something similar happens