Skip to main content

menuPages

An Embed paginator using Select Menus

Implementation

simplydjs.menuPages(interaction, { 
data: [
{...}
], // array of data objects (required)
// options (Optional)
})

Output

menu pagination

Types

simplydjs.menuPages(
msgOrInt: ExtendedMessage | ExtendedInteraction,
options: menuPagesOptions = { strict: false }
): Promise<void>

Options

ParameterTypeRequiredDefaultDescription
strictbooleanfalseEnables strict mode in menuPages
type'Send'/'Edit'"Send"The type of menuPages. ("Send" for ephemeral reply & "Edit" for editing the page panel)
rowsActionRowBuilder[]noneAdd custom rows to the message
embedEmbedBuildernoneThe embed of your message that is sent with the select menu
deleteDeleteOptiondefault objectThe DeleteOption object for the custom delete menu option
dataPagemenus[]noneArray of data necessary to create the pages
placeHolderstring'Dropdown pages'Placeholder of the select menu
export type menuPagesOptions = {
type?: 'Send' | 'Edit';
rows?: ActionRowBuilder<StringSelectMenuBuilder>[];
embed?: EmbedBuilder;

delete?: DeleteOption;

data?: Pagemenus[];

placeHolder?: string;
strict?: boolean;
};

ParameterTypeRequiredDefaultDescription
labelstringnoneThe label of the option
descriptionstringnoneThe description of the option
embedEmbedBuildernoneThe embed of your message when the option is selected
emojistringnoneThe emoji of the option
export interface Pagemenus {
label?: string;
description?: string;
embed?: EmbedBuilder;
emoji?: string;
}

DeleteOption

ParameterTypeRequiredDefaultDescription
enablebooleantrueEnable/ Disable the delete option
labelstringnoneThe label of the delete option
descriptionstringnoneThe description of the delete option
emojistringnoneThe emoji of the delete option
export interface DeleteOption {
enable?: boolean;
label?: string;
description?: string;
emoji?: string;
}

Example

  • Default settings

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

const pageEmbed = new EmbedBuilder().setTitle('Use menus to move pages')
const firstEmbed = new EmbedBuilder().setTitle('first embed')
const lastEmbed = new EmbedBuilder().setTitle('last embed')

simplydjs.menuPages(interaction, {
embed: pageEmbed,
data: [
{
label: "First page",
description: "This is the first page of the pagination",
embed: firstEmbed
},
{
label: "Last page",
description: "This is the last page of the pagination",
embed: lastEmbed
}
],
})
  • Customized with options

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

const pageEmbed = new EmbedBuilder().setTitle('Use menus to move pages')
const firstEmbed = new EmbedBuilder().setTitle('first embed')
const lastEmbed = new EmbedBuilder().setTitle('last embed')

simplydjs.menuPages(interaction, {
strict: true,
type: 'Send',
placeHolder: 'Dropdown Pages',
embed: pageEmbed,
data: [
{
label: "First page",
description: "This is the first page of the pagination",
embed: firstEmbed
},
{
label: "Last page",
description: "This is the last page of the pagination",
embed: lastEmbed
}
],

delete: {
enable: true,
label: "Delete message",
description: "Delete the menu pagination"
}
})