Socket
Book a DemoInstallSign in
Socket

@eugabrielsilva/djs-paginate

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eugabrielsilva/djs-paginate

Simpler discord.js v13 embed pagination tool

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

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:

ParameterDescriptionTypeDefault
timeoutTime (in seconds) to disable the paginator collector after no interactions are received.int60
prevTextText to show in the previous button.string"⏪ Anterior"
nextTextText to show in the next button.string"Próxima ⏩"
pageTextText to show before the page counter.string"📄 Página"
pageSeparatorText 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.

FAQs

Package last updated on 03 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts