Skip to content
acegoal07 edited this page Nov 26, 2022 · 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

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