JSPM

  • Created
  • Published
  • Downloads 75
  • Score
    100M100P100Q82645F
  • License MIT

A simple pagination for Discord.js

Package Exports

  • @acegoal07/discordjs-pagination
  • @acegoal07/discordjs-pagination/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@acegoal07/discordjs-pagination) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

discordjs-pagination

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

About   |   Example   |   Wrapper functions   |   Optional settings help   |   Page and button builder   |   NPM   |   Author


Version 1.2.9 contains major changes that affects how you call upon the pagination please check the example to see how to update to the new version

About

This pagination supports both Message and Interaction and automaticity switches between which interface is provided

All wrapper functions

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

Example

const { MessageEmbed, MessageButton } = require('discord.js');
const paginationWrapper = require('@acegoal07/discordjs-pagination');

// Message example
new paginationWrapper().setMessage(message)
   .setPageList([
      new MessageEmbed()
         .setTitle("Embed 1")
         .setDescription("page 1"),
      new MessageEmbed()
         .setTitle("Embed 2")
         .setDescription("page 2")
   ])
   .setButtonList([
      new MessageButton()
         .setLabel(`1`)
         .setStyle(`1`)
         .setCustomId(`1`),
      new MessageButton()
         .setLabel(`2`)
         .setStyle(`2`)
         .setCustomId(`2`)
   ])
   .paginate()

// Interaction example
new paginationWrapper().setInteraction(interaction)
   .setPageList([
      new MessageEmbed()
         .setTitle("Embed 1")
         .setDescription("page 1"),
      new MessageEmbed()
         .setTitle("Embed 2")
         .setDescription("page 2")
   ])
   .setButtonList([
      new MessageButton()
         .setLabel(`1`)
         .setStyle(`1`)
         .setCustomId(`1`),
      new MessageButton()
         .setLabel(`2`)
         .setStyle(`2`)
         .setCustomId(`2`)
   ])
   .paginate()

Optional settings help

Just add these methods before the paginate function to enable the addons e.g.

new paginationWrapper().setInteraction(interaction)
   .setPageList([
      new MessageEmbed()
         .setTitle("Embed 1")
         .setDescription("page 1"),
      new MessageEmbed()
         .setTitle("Embed 2")
         .setDescription("page 2")
   ])
   .setButtonList([
      new MessageButton()
         .setLabel(`1`)
         .setStyle(`1`)
         .setCustomId(`1`),
      new MessageButton()
         .setLabel(`2`)
         .setStyle(`2`)
         .setCustomId(`2`)
   ])
   .enableAutoDelete() // <---- Make sure its before the paginate function or it wont enable
   .paginate()

All the available settings and the input they need

.setTimeout(timeInMilliseconds) // Allows you to set a custom timeOut for your pagination
.enableAuthorIndependent() // Enables authorIndependent for your pagination
.enableAutoDelete() // Enables autoDelete for your pagination
.enablePrivateReply() // Enables privateReply for your pagination
.enableReplyMessage() // Enables replyMessage for your pagination
.setProgressBar({newSliderIcon, newBarIcon}) // Enables pagination for your pagination and allows you to edit the characters
.enableAutoButton() // Enables autoButton for your pagination
.enableAutoDelButton() // Enables autoDelButton for your pagination
.enableSelectMenu() // Enables selectMenu for your pagination
.createPages() // View create help to see how to use this feature
.createButtons() // View create help to see how to use this feature

Create help

Create Pages example

// This feature replaces the .setPageList() function
.createPages([
   {
      color: "RED",
       title: "page1",
      url: "https://acegoal07.dev",
      description: "page1 is here",
      author: {
         name: "acegoal07",
         icon_url: "https://acegoal07.dev/Resources/Pictures/acegoal07.webP",
         url: "https://acegoal07.dev",
      },
      thumbnailUrl: "https://acegoal07.dev/Resources/Pictures/acegoal07.webP",
      fields: [
         {
            name: "Look i work",
            value: "Hello World!",
            inline: false,
         },
         {
            // And carry on like so
         }
      ],
      imageUrl: "https://acegoal07.dev/Resources/Pictures/acegoal07.webP",
   },
   {
      // And carry on like so
   }
])

create Buttons example

// This feature replaces the .setButtonList() function
.createButtons([
   {
      customId: "button1",
      label: "i am button 1",
      emoji: "123456789012345678", // emoji replaces the label
      style: "SUCCESS"
   },
   {
      // And carry on like so
   }
])