Skip to content
acegoal07 edited this page Jul 17, 2023 · 15 revisions

discordjs-pagination

Repository size npm NPM npm (prod) dependency version Libraries.io dependency status for latest release GitHub contributors Monthly Downloads

This wiki is for @acegoal07/discordjs-paginaiton version 1.4.0 which is a rework of the package

Pagination functions

.setInterface()
.setPageList()
.setImageList()
.setButtonList()
.setTimeout()
.setProgressBar()
.enableReplyMessage()
.enableAutoDelete()
.enablePrivateReply()
.enableAuthorIndependent()
.enableAutoButton()
.enableAutoDelButtons()
.createPages()
.createButtons()
.paginate()

Example

const { Pagination } = require("@acegoal07/discordjs-pagination");

// Message example
new Pagination().setPortal(message)
   .setPageList([
      new EmbedBuilder()
         .setTitle("Embed 1")
         .setDescription("page 1"),
      new EmbedBuilder()
         .setTitle("Embed 2")
         .setDescription("page 2")
   ])
   .setButtonList([
      new ButtonBuilder()
         .setLabel(`1`)
         .setStyle("Secondary")
         .setCustomId(`1`),
      new ButtonBuilder()
         .setLabel(`2`)
         .setStyle("Secondary")
         .setCustomId(`2`)
   ])
   .paginate()

// Interaction example
new Pagination().setPortal(interaction)
   .setPageList([
      new EmbedBuilder()
         .setTitle("Embed 1")
         .setDescription("page 1"),
      new EmbedBuilder()
         .setTitle("Embed 2")
         .setDescription("page 2")
   ])
   .setButtonList([
      new ButtonBuilder()
         .setLabel(`1`)
         .setStyle("Secondary")
         .setCustomId(`1`),
      new ButtonBuilder()
         .setLabel(`2`)
         .setStyle("Secondary")
         .setCustomId(`2`)
   ])
   .paginate()

// Interaction ephemeral examples
   // way 1 sends a deferred interaction with it enabled
   await deferReply({ephemeral: true})
   new Pagination().setPortal(interaction)
      .setPageList([ ........

   // way 2 sends an un-deferred interaction which is used to enable it
   new Pagination().setPortal(interaction, {interaction_ephemeral: true}) 
      .setPageList([ ........
Clone this wiki locally