Skip to main content

Class: LazyPaginatedMessage

@sapphire/discord.js-utilities.LazyPaginatedMessage

This is a LazyPaginatedMessage. Instead of resolving all pages that are functions on PaginatedMessage.run will resolve when requested.

Hierarchy

Constructors

constructor

new LazyPaginatedMessage(__namedParameters?)

Constructor for the PaginatedMessage class

Parameters

NameTypeDescription
__namedParametersPaginatedMessageOptionsThe PaginatedMessageOptions for this instance of the PaginatedMessage class

Inherited from

PaginatedMessage.constructor

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:178

Properties

actions

actions: Map<string, PaginatedMessageAction>

The actions which are to be used.

Inherited from

PaginatedMessage.actions

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:131


collector

collector: null | InteractionCollector<MessageComponentInteraction<CacheType>> = null

The collector used for handling button clicks.

Inherited from

PaginatedMessage.collector

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:121


constructor

constructor: typeof PaginatedMessage

Inherited from

PaginatedMessage.constructor

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:1226


embedFooterSeparator

embedFooterSeparator: string = PaginatedMessage.embedFooterSeparator

Custom separator to show after the page index in the embed footer. PaginatedMessage will automatically add a space ( ) after the given text. You do not have to add it yourself.

default PaginatedMessage.embedFooterSeparator (static property)

Inherited from

PaginatedMessage.embedFooterSeparator

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:161


hasEmittedWarning

Protected hasEmittedWarning: boolean = false

Tracks whether a warning was already emitted for this PaginatedMessage

Inherited from

PaginatedMessage.hasEmittedWarning

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:172


idle

idle: number

The amount of milliseconds to idle before the paginator is closed. Defaults to 20 minutes.

Inherited from

PaginatedMessage.idle

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:141


index

index: number = 0

The handler's current page/message index.

Inherited from

PaginatedMessage.index

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:136


messages

messages: (null | PaginatedMessagePage)[] = []

The pages which were converted from PaginatedMessage.pages

Inherited from

PaginatedMessage.messages

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:126


pageIndexPrefix

pageIndexPrefix: string = PaginatedMessage.pageIndexPrefix

Custom text to show in front of the page index in the embed footer. PaginatedMessage will automatically add a space ( ) after the given text. You do not have to add it yourself.

default PaginatedMessage.pageIndexPrefix (static property)

Inherited from

PaginatedMessage.pageIndexPrefix

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:154


pages

pages: PaginatedMessagePage[]

The pages to be converted to PaginatedMessage.messages

Inherited from

PaginatedMessage.pages

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:111


paginatedMessageData

Protected paginatedMessageData: null | Omit<PaginatedMessageMessageOptionsUnion, "components"> = null

Inherited from

PaginatedMessage.paginatedMessageData

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:163


response

response: null | Message<boolean> = null

The response message used to edit on page changes.

Inherited from

PaginatedMessage.response

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:116


selectMenuOptions

Protected selectMenuOptions: PaginatedMessageSelectMenuOptionsFunction = PaginatedMessage.selectMenuOptions

Inherited from

PaginatedMessage.selectMenuOptions

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:165


template

template: PaginatedMessageMessageOptionsUnion

The template for this PaginatedMessage. You can use templates to set defaults that will apply to each and every page in the PaginatedMessage

Inherited from

PaginatedMessage.template

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:147


wrongUserInteractionReply

Protected wrongUserInteractionReply: PaginatedMessageWrongUserInteractionReplyFunction = PaginatedMessage.wrongUserInteractionReply

Inherited from

PaginatedMessage.wrongUserInteractionReply

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:167


defaultActions

Static defaultActions: PaginatedMessageAction[]

The default actions of this handler.

Inherited from

PaginatedMessage.defaultActions

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:1025


deletionStopReasons

Static deletionStopReasons: string[]

The reasons sent by InteractionCollector#end event when the message (or its owner) has been deleted.

Inherited from

PaginatedMessage.deletionStopReasons

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:1087


embedFooterSeparator

Static embedFooterSeparator: string = '•'

Custom separator for the page index in the embed footer.

default "•"

remark To overwrite this property change it somewhere in a "setup" file, i.e. where you also call client.login() for your bot. Alternatively, you can also customize it on a per-PaginatedMessage basis by passing embedFooterSeparator in the options of the constructor.

example

import { PaginatedMessage } from '@sapphire/discord.js-utilities';

PaginatedMessage.embedFooterSeparator = '|';
// This will make the separator of the embed footer something like "Page 1/2 | Today at 4:20"

Inherited from

PaginatedMessage.embedFooterSeparator

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:1117


handlers

Static Readonly handlers: Map<string, PaginatedMessage>

The current {@link InteractionCollector} handlers that are active. The key is the ID of of the author who sent the message that triggered this PaginatedMessage

This is to ensure that any given author can only trigger 1 PaginatedMessage. This is important for performance reasons, and users should not have more than 1 PaginatedMessage open at once.

Inherited from

PaginatedMessage.handlers

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:1135


messages

Static Readonly messages: Map<string, PaginatedMessage>

The messages that are currently being handled by a PaginatedMessage The key is the ID of the message that triggered this PaginatedMessage

This is to ensure that only 1 PaginatedMessage can run on a specified message at once. This is important when having an editable commands solution.

Inherited from

PaginatedMessage.messages

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:1126


pageIndexPrefix

Static pageIndexPrefix: string = ''

Custom text to show in front of the page index in the embed footer. PaginatedMessage will automatically add a space ( ) after the given text. You do not have to add it yourself.

default ""

remark To overwrite this property change it somewhere in a "setup" file, i.e. where you also call client.login() for your bot.

example

import { PaginatedMessage } from '@sapphire/discord.js-utilities';

PaginatedMessage.pageIndexPrefix = 'Page';
// This will make the footer of the embed something like "Page 1/2"

Inherited from

PaginatedMessage.pageIndexPrefix

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:1102


selectMenuOptions

Static selectMenuOptions: PaginatedMessageSelectMenuOptionsFunction

A generator for {@link MessageSelectOption} that will be used to generate the options for the {@link MessageSelectMenu}. We do not allow overwriting the {@link MessageSelectOption#value} property with this, as it is vital to how we handle select menu interactions.

param The index of the page to add to the {@link MessageSelectMenu}. We will add 1 to this number because our pages are 0 based, so this will represent the pages as seen by the user.

default

{
label: `Page ${pageIndex}`
}

remark To overwrite this property change it in a "setup" file prior to calling client.login() for your bot.

example

import { PaginatedMessage } from '@sapphire/discord.js-utilities';

PaginatedMessage.selectMenuOptions = (pageIndex) => ({
label: `Go to page: ${pageIndex}`,
description: 'This is a description'
});

Inherited from

PaginatedMessage.selectMenuOptions

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:1162


wrongUserInteractionReply

Static wrongUserInteractionReply: PaginatedMessageWrongUserInteractionReplyFunction

A generator for {@link MessageComponentInteraction#reply} that will be called and sent whenever an untargeted user interacts with one of the buttons. When modifying this it is recommended that the message is set to be ephemeral so only the user that is pressing the buttons can see them. Furthermore, we also recommend setting allowedMentions: { users: [], roles: [] }, so you don't have to worry about accidentally pinging anyone.

When setting just a string, we will add { ephemeral: true, allowedMentions: { users: [], roles: [] } } for you.

param The {@link User} this PaginatedMessage was intended for.

param The {@link User} that actually clicked the button.

default

{
content: `Please stop clicking the buttons on this message. They are only for ${Formatters.userMention(targetUser.id)}.`,
ephemeral: true,
allowedMentions: { users: [], roles: [] }
}

remark To overwrite this property change it in a "setup" file prior to calling client.login() for your bot.

example

import { PaginatedMessage } from '@sapphire/discord.js-utilities';

// We will add ephemeral and no allowed mention for string only overwrites
PaginatedMessage.wrongUserInteractionReply = (targetUser) =>
`These buttons are only for ${Formatters.userMention(targetUser.id)}. Press them as much as you want, but I won't do anything with your clicks.`;

example

import { PaginatedMessage } from '@sapphire/discord.js-utilities';
import { Formatters } from 'discord.js';

PaginatedMessage.wrongUserInteractionReply = (targetUser) => ({
content: `These buttons are only for ${Formatters.userMention(
targetUser.id
)}. Press them as much as you want, but I won't do anything with your clicks.`,
ephemeral: true,
allowedMentions: { users: [], roles: [] }
});

Inherited from

PaginatedMessage.wrongUserInteractionReply

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:1206

Methods

addAction

addAction(action): LazyPaginatedMessage

Adds an action to the existing ones. This will be added as the last action.

see PaginatedMessage.setActions for examples on how to structure the action.

Parameters

NameTypeDescription
actionPaginatedMessageActionThe action to add.

Returns

LazyPaginatedMessage

Inherited from

PaginatedMessage.addAction

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:331


addActions

addActions(actions): LazyPaginatedMessage

Adds actions to the existing ones. The order given is the order they will be used.

see PaginatedMessage.setActions for examples on how to structure the actions.

Parameters

NameTypeDescription
actionsPaginatedMessageAction[]The actions to add.

Returns

LazyPaginatedMessage

Inherited from

PaginatedMessage.addActions

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:321


addAsyncPageBuilder

addAsyncPageBuilder(builder): LazyPaginatedMessage

Adds a page to the existing ones asynchronously using a MessageBuilder. This wil be added as the last page.

example

const { PaginatedMessage } = require('@sapphire/discord.js-utilities');
const { MessageEmbed } = require('discord.js');

const paginatedMessage = new PaginatedMessage()
.addAsyncPageBuilder(async (builder) => {
const someRemoteData = await fetch('https://contoso.com/api/users');

const embed = new MessageEmbed()
.setColor('#FF0000')
.setDescription(someRemoteData.data);

return builder
.setContent('example content')
.setEmbeds([embed]);
});

Parameters

NameTypeDescription
builderMessageBuilder | (builder: MessageBuilder) => Promise<MessageBuilder>Either a callback whose first parameter is new MessageBuilder(), or an already constructed MessageBuilder

Returns

LazyPaginatedMessage

Inherited from

PaginatedMessage.addAsyncPageBuilder

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:455


addAsyncPageEmbed

addAsyncPageEmbed(embed): LazyPaginatedMessage

Adds a page to the existing ones asynchronously using a {@link MessageEmbed}. This wil be added as the last page.

example

const { PaginatedMessage } = require('@sapphire/discord.js-utilities');

const paginatedMessage = new PaginatedMessage()
.addAsyncPageEmbed(async (embed) => {
const someRemoteData = await fetch('https://contoso.com/api/users');

embed
.setColor('#FF0000')
.setDescription(someRemoteData.data);

return embed;
});

Parameters

NameTypeDescription
embedMessageEmbed | (builder: MessageEmbed) => Promise<MessageEmbed>Either a callback whose first parameter is new MessageEmbed(), or an already constructed {@link MessageEmbed}

Returns

LazyPaginatedMessage

Inherited from

PaginatedMessage.addAsyncPageEmbed

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:525


addAsyncPageEmbeds

addAsyncPageEmbeds(embeds): LazyPaginatedMessage

Adds a page to the existing ones using multiple {@link MessageEmbed}'s. This wil be added as the last page.

remark When using this with a callback this will construct 10 {@link MessageEmbed}'s in the callback parameters, regardless of how many are actually used. If this a performance impact you do not want to cope with then it is recommended to use PaginatedMessage.addPageBuilder instead, which will let you add as many embeds as you want, albeit manually

example

const { PaginatedMessage } = require('@sapphire/discord.js-utilities');

const paginatedMessage = new PaginatedMessage().addAsyncPageEmbeds(async (embed0, embed1, embed2) => {
const someRemoteData = (await fetch('https://contoso.com/api/users')) as any;

for (const [index, user] of Object.entries(someRemoteData.users.slice(0, 10)) as [`${0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10}`, any][]) {
switch (index) {
case '0': {
embed0.setColor('#FF0000').setDescription('example description 1').setAuthor(user.name);
break;
}
case '1': {
embed1.setColor('#00FF00').setDescription('example description 2').setAuthor(user.name);
break;
}
case '2': {
embed2.setColor('#0000FF').setDescription('example description 3').setAuthor(user.name);
break;
}
}
}

return [embed0, embed1, embed2];
});

example

const { PaginatedMessage } = require('@sapphire/discord.js-utilities');

const embed1 = new MessageEmbed()
.setColor('#FF0000')
.setDescription('example description 1');

const embed2 = new MessageEmbed()
.setColor('#00FF00')
.setDescription('example description 2');

const embed3 = new MessageEmbed()
.setColor('#0000FF')
.setDescription('example description 3');

const paginatedMessage = new PaginatedMessage()
.addAsyncPageEmbeds([embed1, embed2, embed3]); // You can add up to 10 embeds

Parameters

NameTypeDescription
embedsMessageEmbed[] | (embed1: MessageEmbed, embed2: MessageEmbed, embed3: MessageEmbed, embed4: MessageEmbed, embed5: MessageEmbed, embed6: MessageEmbed, embed7: MessageEmbed, embed8: MessageEmbed, embed9: MessageEmbed, embed10: MessageEmbed) => Promise<MessageEmbed[]>Either a callback which receives 10 parameters of new MessageEmbed(), or an array of already constructed {@link MessageEmbed}'s

Returns

LazyPaginatedMessage

Inherited from

PaginatedMessage.addAsyncPageEmbeds

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:667


addPage

addPage(page): LazyPaginatedMessage

Adds a page to the existing ones. This will be added as the last page.

remark While you can use this method you should first check out PaginatedMessage.addPageBuilder, PaginatedMessage.addPageContent and PaginatedMessage.addPageEmbed as these are easier functional methods of adding pages and will likely already suffice for your needs.

Parameters

NameTypeDescription
pagePaginatedMessagePageThe page to add.

Returns

LazyPaginatedMessage

Inherited from

PaginatedMessage.addPage

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:370


addPageBuilder

addPageBuilder(builder): LazyPaginatedMessage

Adds a page to the existing ones using a MessageBuilder. This will be added as the last page.

Parameters

NameType
builderMessageBuilder | (builder: MessageBuilder) => MessageBuilder

Returns

LazyPaginatedMessage

Overrides

PaginatedMessage.addPageBuilder

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/LazyPaginatedMessage.ts:31


addPageContent

addPageContent(content): LazyPaginatedMessage

Adds a page to the existing ones using simple message content. This will be added as the last page.

Parameters

NameType
contentstring

Returns

LazyPaginatedMessage

Overrides

PaginatedMessage.addPageContent

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/LazyPaginatedMessage.ts:35


addPageEmbed

addPageEmbed(embed): LazyPaginatedMessage

Adds a page to the existing ones using a {@link MessageEmbed}. This wil be added as the last page.

Parameters

NameType
embedMessageEmbed | (builder: MessageEmbed) => MessageEmbed

Returns

LazyPaginatedMessage

Overrides

PaginatedMessage.addPageEmbed

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/LazyPaginatedMessage.ts:39


addPageEmbeds

addPageEmbeds(embeds): LazyPaginatedMessage

Adds a page to the existing ones asynchronously using multiple {@link MessageEmbed}'s. This wil be added as the last page.

Parameters

NameType
embedsMessageEmbed[] | (embed1: MessageEmbed, embed2: MessageEmbed, embed3: MessageEmbed, embed4: MessageEmbed, embed5: MessageEmbed, embed6: MessageEmbed, embed7: MessageEmbed, embed8: MessageEmbed, embed9: MessageEmbed, embed10: MessageEmbed) => MessageEmbed[]

Returns

LazyPaginatedMessage

Overrides

PaginatedMessage.addPageEmbeds

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/LazyPaginatedMessage.ts:43


addPages

addPages(pages): LazyPaginatedMessage

Add pages to the existing ones. The order given is the order they will be used.

Parameters

NameTypeDescription
pagesPaginatedMessagePage[]The pages to add.

Returns

LazyPaginatedMessage

Inherited from

PaginatedMessage.addPages

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:711


applyFooter

Protected applyFooter(message, index): PaginatedMessageMessageOptionsUnion

Parameters

NameType
messagePaginatedMessageMessageOptionsUnion
indexnumber

Returns

PaginatedMessageMessageOptionsUnion

Inherited from

PaginatedMessage.applyFooter

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:941


clone

clone(): PaginatedMessage

Clones the current handler into a new instance.

Returns

PaginatedMessage

Inherited from

PaginatedMessage.clone

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:785


handleCollect

Protected handleCollect(targetUser, channel, interaction): Promise<void>

Handles the collect event from the collector.

Parameters

NameTypeDescription
targetUserUserThe user the handler is for.
channelDMChannel | PartialDMChannel | NewsChannel | TextChannel | ThreadChannelThe channel the handler is running at.
interactionButtonInteraction<CacheType> | SelectMenuInteraction<CacheType>The button interaction that was received.

Returns

Promise<void>

Inherited from

PaginatedMessage.handleCollect

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:882


handleEnd

Protected handleEnd(_, reason): void

Handles the end event from the collector.

Parameters

NameTypeDescription
_Collection<string, ButtonInteraction<CacheType> | SelectMenuInteraction<CacheType>>-
reasonstringThe reason for which the collector was ended.

Returns

void

Inherited from

PaginatedMessage.handleEnd

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:931


handlePageLoad

Protected handlePageLoad(page, index): Promise<PaginatedMessageMessageOptionsUnion>

Handles the load of a page.

Parameters

NameTypeDescription
pagePaginatedMessagePageThe page to be loaded.
indexnumberThe index of the current page.

Returns

Promise<PaginatedMessageMessageOptionsUnion>

Inherited from

PaginatedMessage.handlePageLoad

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:862


hasPage

hasPage(index): boolean

Checks whether or not the handler has a specific page.

Parameters

NameTypeDescription
indexnumberThe index to check.

Returns

boolean

Inherited from

PaginatedMessage.hasPage

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:345


resolvePage

resolvePage(index): Promise<PaginatedMessagePage>

Resolves the page corresponding with the given index. This also resolves the index's before and after the given index.

Parameters

NameTypeDescription
indexnumberThe index to resolve. Defaults to handler's current index.

Returns

Promise<PaginatedMessagePage>

Overrides

PaginatedMessage.resolvePage

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/LazyPaginatedMessage.ts:22


resolvePagesOnRun

resolvePagesOnRun(): Promise<void>

Only resolves the page corresponding with the handler's current index.

Returns

Promise<void>

Overrides

PaginatedMessage.resolvePagesOnRun

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/LazyPaginatedMessage.ts:14


run

run(message, target?): Promise<LazyPaginatedMessage>

Executes the PaginatedMessage and sends the pages corresponding with PaginatedMessage.index. The handler will start collecting message button interactions.

Parameters

NameTypeDefault valueDescription
messageMessage<boolean>undefinedThe message that triggered this PaginatedMessage. Generally this will be the command message, but it can also be another message from your client, i.e. to indicate a loading state.
targetUsermessage.authorThe user who will be able to interact with the message buttons of this PaginatedMessage. Defaults to message.author.

Returns

Promise<LazyPaginatedMessage>

Inherited from

PaginatedMessage.run

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:723


setActions

setActions(actions, includeDefaultActions?): LazyPaginatedMessage

Clears all current actions and sets them. The order given is the order they will be used.

remark You can retrieve the default actions for the regular pagination

example

const display = new PaginatedMessage();

display.setActions([
...PaginatedMessage.defaultActions,
])

remark You can add custom Message Buttons by providing style, customId, type, run and at least one of label or emoji.

example

const display = new PaginatedMessage();

display.setActions([
{
style: 'PRIMARY',
label: 'My Button',
customId: 'custom_button',
type: Constants.MessageComponentTypes.BUTTON,
run: (context) => console.log(context)
}
], true);

remark You can add custom Message Link Buttons by providing style, url, type, and at least one of label or emoji.

example

const display = new PaginatedMessage();

display.setActions([
{
style: 'LINK',
label: 'Sapphire Website',
emoji: '🔷',
url: 'https://sapphirejs.dev',
type: Constants.MessageComponentTypes.BUTTON
}
], true);

remark You can add custom Select Menus by providing customId, type, and run.

example

const display = new PaginatedMessage();

display.setActions([
{
customId: 'custom_menu',
type: Constants.MessageComponentTypes.SELECT_MENU,
run: (context) => console.log(context) // Do something here
}
], true);

Parameters

NameTypeDefault valueDescription
actionsPaginatedMessageAction[]undefinedThe actions to set. This can be either a Button, Link Button, or Select Menu.
includeDefaultActionsbooleanfalseWhether to merge in the PaginatedMessage.defaultActions when setting the actions. If you set this to true then you do not need to manually add ...PaginatedMessage.defaultActions as seen in the first example. The default value is false for backwards compatibility within the current major version.

Returns

LazyPaginatedMessage

Inherited from

PaginatedMessage.setActions

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:311


setIdle

setIdle(idle): LazyPaginatedMessage

Sets the amount of time to idle before the paginator is closed.

Parameters

NameTypeDescription
idlenumberThe number to set the idle to.

Returns

LazyPaginatedMessage

Inherited from

PaginatedMessage.setIdle

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:243


setIndex

setIndex(index): LazyPaginatedMessage

Sets the handler's current page/message index.

Parameters

NameTypeDescription
indexnumberThe number to set the index to.

Returns

LazyPaginatedMessage

Inherited from

PaginatedMessage.setIndex

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:234


setPages

setPages(pages): LazyPaginatedMessage

Clears all current pages and messages and sets them. The order given is the order they will be used.

Parameters

NameTypeDescription
pagesPaginatedMessagePage[]The pages to set.

Returns

LazyPaginatedMessage

Inherited from

PaginatedMessage.setPages

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:353


setSelectMenuOptions

setSelectMenuOptions(newOptions): LazyPaginatedMessage

Sets the PaginatedMessage.selectMenuOptions for this instance of PaginatedMessage. This will only apply to this one instance and no others.

Parameters

NameTypeDescription
newOptionsPaginatedMessageSelectMenuOptionsFunctionThe new options generator to set

Returns

LazyPaginatedMessage

The current instance of PaginatedMessage

Inherited from

PaginatedMessage.setSelectMenuOptions

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:214


setUpCollector

Protected setUpCollector(channel, targetUser): void

Sets up the message's collector.

Parameters

NameTypeDescription
channelDMChannel | PartialDMChannel | NewsChannel | TextChannel | ThreadChannelThe channel the handler is running at.
targetUserUserThe user the handler is for.

Returns

void

Inherited from

PaginatedMessage.setUpCollector

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:845


setUpMessage

Protected setUpMessage(channel, targetUser): Promise<void>

Sets up the message.

Parameters

NameTypeDescription
channelDMChannel | PartialDMChannel | NewsChannel | TextChannel | ThreadChannelThe channel the handler is running at.
targetUserUser-

Returns

Promise<void>

Inherited from

PaginatedMessage.setUpMessage

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:798


setWrongUserInteractionReply

setWrongUserInteractionReply(wrongUserInteractionReply): LazyPaginatedMessage

Sets the PaginatedMessage.wrongUserInteractionReply for this instance of PaginatedMessage. This will only apply to this one instance and no others.

Parameters

NameTypeDescription
wrongUserInteractionReplyPaginatedMessageWrongUserInteractionReplyFunctionThe new wrongUserInteractionReply to set

Returns

LazyPaginatedMessage

The current instance of PaginatedMessage

Inherited from

PaginatedMessage.setWrongUserInteractionReply

Defined in

projects/utilities/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts:225