@eugabrielsilva/djs-paginate

1.0.1 • Public • Published

djs-paginate

Simpler discord.js v13 embed pagination tool inspired by discordjs-button-pagination.

Installation

npm install @eugabrielsilva/djs-paginate

Usage

// Import the module
const paginate = require('@eugabrielsilva/djs-paginate');

// Create your embed pages
const { MessageEmbed } = require('discord.js');

let page1 = new MessageEmbed({
    title: 'Page 1',
    description: 'This is the first page'
});

let page2 = new MessageEmbed({
    title: 'Page 2',
    description: 'This is the second page'
});

// Create an array with your pages
let pages = [page1, page2];

// Call the paginate() method passing the message object (from client messageCreate event) and the pages array
paginate(message, pages);

Options

The third argument to the paginate() function is an object with one or more of the following parameters:

Parameter Description Type Default
timeout Time (in seconds) to disable the paginator collector after no interactions are received. int 60
prevText Text to show in the previous button. string "⏪ Anterior"
nextText Text to show in the next button. string "Próxima ⏩"
pageText Text to show before the page counter. string "📄 Página"
pageSeparator Text to show between the page counter. string "/"

Example:

paginate(message, pages, {
    timeout: 120,
    prevText: 'Previous',
    nextText: 'Next',
    pageText: 'Page',
    separatorText: 'from'
});

Credits

Library developed and currently maintained by Gabriel Silva.
Special thanks to ryzyx for the original idea.

Readme

Keywords

none

Package Sidebar

Install

npm i @eugabrielsilva/djs-paginate

Weekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

6.04 kB

Total Files

4

Last publish

Collaborators

  • eugabrielsilva