@xoalone/discordjs-pagination

2.2.3 • Public • Published

NPM info

@xoalone/discordjs-pagination

A simple utility to paginate Discord embeds. Built on discord.js@^12.0.0 (master) but should work on older versions. Compatible with MessageEmbeds, RichEmbeds (not tested). Pages are embeds.

NOTE: This is an edit of discord.js-pagination, I have added a lot of useful features.

Installation

  • npm install @xoalone/discordjs-pagination

Usage

Basic Bot Example

// Import the discord.js-pagination package
const paginationEmbed = require("@xoalone/discordjs-pagination");

// Use either MessageEmbed or RichEmbed to make pages
// Keep in mind that Embeds should't have their footers set since the pagination method sets page info there
const { MessageEmbed } = require("discord.js");
const embed1 = new MessageEmbed();

// Create an array of embeds
const pages = [
  embed1,
  embed2,
  //....
  embedn,
];

/* Call the paginationEmbed method, first two arguments are required.
- `msg` is your Message class object (REQUIRED).

- `pages` is your array of pages (REQUIRED).

- `emojiList` is an array and the pagination controls, defaults to ['⏪', '◀️', '⏹️', '▶️', '⏩']. 
- Also, you can use custom emojis, just provide their IDs instead of an unicode emoji.

- `timeout` is an integer and the time until the reaction collectors are going to stop collection (in ms), after this you can't change pages, defaults to 120000ms.

// `botReaction` is a boolean and if it is set to true then bots can react to messages, defaults to false.

// `userIDs` is an array and it allows you to add users who can react to the message with their ID, defaults to message.author.id.

*/
paginationEmbed(msg, pages, emojiList, timeout, botReaction, userIDs);
// There you go, now you have paged embeds

Preview

DEMO

Here is the package used as an example.

Readme

Keywords

Package Sidebar

Install

npm i @xoalone/discordjs-pagination

Weekly Downloads

2

Version

2.2.3

License

MIT

Unpacked Size

25 kB

Total Files

6

Last publish

Collaborators

  • xoalone