A simple reaction-based paginator for discord.js.
# For stable
npm i @shane4368/discord.js-paginator
# For development (requires git)
npm i shane4368/discord.js-paginator
This package does not work with discord.js v11 and previous versions. Only discord.js v12 is currently supported.
See full documentation.
const { Paginator } = require("@shane4368/discord.js-paginator");
const paginator = new Paginator({ userID: message.author.id });
// Log message when destroyed or timed out.
paginator.on("end", console.log);
// Log error when it occurs.
paginator.on("error", console.error);
// {0} - first occurrence will be replaced with current page number.
// {1} - first occurrence will be replaced with total page count.
paginator.addPage("This is the first page.\n\nPage {0}/{1}")
.addPage("This is the second page.\n\nPage {0}/{1}")
.addPage("This is the third page.\n\nPage {0}/{1}")
.addPage("This is the fourth page.\n\nPage {0}/{1}");
// Ensure your function is async before using 'await' keyword.
await paginator.start(message.channel).catch(console.error);
// Setting embed template.
paginator.setEmbedTemplate({
color: 0x00b6eb,
title: "Constant Title",
footer: {
text: "Custom footer format {0}/{1}"
}
});
// Adding embed pages.
paginator.addPage({ description: "This is the first page." })
.addPage({ description: "This is the second page." });
// Disabling front, rear and trash emojis.
paginator.setEmojis({ front: null, rear: null, trash: null });
// Overriding defaults for front, rear and trash emojis.
paginator.setEmojis({ front: "👈", rear: "👉", trash: "474075113176825866" });
The text to be displayed when using embed pages.
Whether or not to delete the paginator when timed out.
Embed template to use across pages. All properties on this object will be shown on every page.
The emojis to use for skipping the pages. Specify the id for custom guild emojis.
Options to use for the 'info' emoji.
Options to use for the 'jump' emoji.
The pages to use in the paginator. Must contain at least one page.
The time in milliseconds of how long to keep the paginator running.
The id of the user to listen to.
Whether or not to show prompt.
Generated using TypeDoc
If set to
true
, the pages will loop on 'back' and 'next.'true