Skip to main content

buttonPages

An powerful yet customizable Embed Paginator

Implementation

const embeds = [] // Contains array of EmbedBuilder(s)

simplydjs.buttonPages(interaction, {
embeds: embeds // embeds (required)
// options (Optional)
})

Output

embed pages with button

Types

simplydjs.buttonPages(
msgOrInt: ExtendedMessage | ExtendedInteraction,
options: pagesOptions = {}
): Promise<void>

Options

pagesOptions

ParameterTypeRequiredDefaultDescription
buttonsPagebuttonsdefault buttonsPass a Pagebuttons Object to customize the button
skipsbooleantrueEnable/Disable the first/last page buttons
deletebooleantrue_Enable/Disable the Delete message button
dynamicbooleanfalse_Change buttons corresponding to the page you are in
countbooleanfalseShow the current page number you are in
rowsActionRowBuilder[]noneAdd custom rows to the message
embedsEmbedBuilder[]noneList of embeds for pagination of the embeds
timeoutnumber120000Show the current page number you are in
disable'Label'/'Emoji'/'None''Label'Disable emoji or label of the button
export type pagesOptions = {
buttons?: Pagebuttons;

skips?: boolean;
delete?: boolean;
dynamic?: boolean;
count?: boolean;

rows?: ActionRowBuilder<ButtonBuilder>[];
embeds?: EmbedBuilder[];
timeout?: number;

disable?: 'Label' | 'Emoji' | 'None';
strict?: boolean;
};

Pagebuttons

ParameterTypeDescription
firstCustomizableButtonPass an CustomizableButton Object to customize the button
nextCustomizableButtonPass an CustomizableButton Object to customize the button
backCustomizableButtonPass an CustomizableButton Object to customize the button
lastCustomizableButtonPass an CustomizableButton Object to customize the button
deleteCustomizableButtonPass an CustomizableButton Object to customize the button
export interface Pagebuttons {
first?: CustomizableButton;
next?: CustomizableButton;
back?: CustomizableButton;
last?: CustomizableButton;
delete?: CustomizableButton;
}

Example

  • Default settings

buttonPages.js
const { EmbedBuilder } = require("discord.js")
const simplydjs = require('simply-djs')

const firstEmbed = new EmbedBuilder().setTitle('first embed')
const lastEmbed = new EmbedBuilder().setTitle('last embed')

simplydjs.buttonPages(interaction, {
embeds: [firstEmbed, lastEmbed]
})
  • Customized with options

buttonPages.js
const { EmbedBuilder, ButtonStyle } = require("discord.js")
const simplydjs = require('simply-djs')

const firstEmbed = new EmbedBuilder().setTitle('first embed')
const lastEmbed = new EmbedBuilder().setTitle('last embed')

simplydjs.buttonPages(interaction, {
embeds: [firstEmbed, lastEmbed],
strict: true,

buttons: {
first: { style: ButtonStyle.Primary },
next: { style: ButtonStyle.Success },
back: { style: ButtonStyle.Success },
last: { style: ButtonStyle.Primary },
delete: { style: ButtonStyle.Danger }
},

skips: true,
delete: true,
dynamic: false,
count: false,

timeout: 120000,
disable: 'None'
})