How to create pagination in Slash Commands bot

Md Shahriyar Alam

22 days ago

Creating pagination is simple using Slash Commands bot

Code

pypages = Paginator(
    interaction, 
    user_id=user.id,
    prev_text="Prev",
    next_text="Next",
    stop_text="Stop",
)

pages.add_page(
    Page(
        content="",
        embed=embed, # you can use load_embed()
        message=Message(), # see docs for custom message
        attachments=[], # list of attachments 
    )   
)
# add as many pages as you want

await pages.start()

Now running the command will show a paginator.

Example

We will make a command named pagination and put the following code inside Hooks (pre)

pypages = Paginator(interaction, user_id=user.id)

pages.add_page(Page(content="This is page 1"))
pages.add_page(Page(content="This is page 2"))

await pages.start()

Here is the output example

Need help?

If you still need any kind of help, have a suggestion for us or having a question in mind? Feel free to reach us out.

DiscordJoin support server
logoCustom Commands

#1 Custom commands discord bot available on the internet

stripe

Contact

20-22 Wenlock RoadEnglandN1 7GU

© WEiRDSOFT LTD. All rights reserved.