Emitted after the initial embed has been sent (technically, after the client finished reacting with enabled navigation and function emojis).
Emitted when the instance is finished by a user reacting with delete
navigation emoji
or a function emoji that throws non-Error type.
Emitted after the page number is updated and before the client sends the embed.
Emitted upon a user reacting on the instance.
Emitted when the awaiting timeout is reached.
Emitted upon an occurance of error.
An array of elements to paginate.
The authorized users to navigate the pages. Default: everyone
The channel where to send the embed.
Settings for assets for the client.
The client's message content options.
Whether the client's message will be deleted upon timeout. Default: false
The disabled navigation emojis. Available navigation emojis to disable:
Maximum number of elements to be displayed per page.
The MessageEmbed being used for this mode.
To customise the MessageEmbed for this mode, please access this property. Example:
<FieldsEmbed>.embed.setColor('red')
Whether to set function emojis after navigation emojis. Default: false
The emojis used for function emojis. Function emojis are user-customised message reactions for modifying the current instance of the pagination such as modifying embed texts, stopping the pagination, etc.
The emojis used for navigation emojis. Navigation emojis are the default message reactions for navigating through the pagination.
The current page. Default: 1
The time for awaiting a user action before timeout in ms. Default: 30000
Whether to show page indicator, or put it in embed's footer text (replaces the existing text) instead.
Default: false
Elements in the current page.
The formatted page indicator. Default format: text
Number of pages for this instance.
Adds a function emoji to the embed.
<PaginationEmbed>.addFunctionEmoji('π
±', (_, instance) => {
const field = instance.embed.fields[0];
if (field.name.includes('π
±'))
field.name = 'Name';
else
field.name = 'Naπ
±e';
});
The emoji to use as the function's emoji.
The function to call upon pressing the function emoji.
Build the Pagination Fields Embed.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed()
.setAuthorizedUsers([message.author.id])
.setChannel(message.channel)
.setClientAssets({ prompt: 'Yo {{user}} wat peige?!?!?' })
.setArray([{ name: 'John Doe' }, { name: 'Jane Doe' }])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('Name', el => el.name)
.setPage(1)
.setTimeout(69000)
.setNavigationEmojis({
back: 'β',
jump: 'β',
forward: 'βΆ',
delete: 'π'
})
.setFunctionEmojis({
'π': (user, instance) => {
const field = instance.embed.fields[0];
if (field.name === 'Name')
field.name = user.tag;
else
field.name = 'Name';
}
})
.build();```
Deletes a function emoji.
The emoji key to delete.
Adds a field to the embed. Same as MessageEmbed.addField, but value takes a function instead.
Name of the field.
Value of the field. Function for Array.prototype.map().join('\n')
.
Whether the field is inline with other field. Default: true
Deletes all function emojis, and then re-enables all navigation emojis.
Sets the array of elements to paginate. This must be called first before any other methods.
An array of elements to paginate.
Set the authorized users to navigate the pages.
A user ID or an array of user IDs.
The channel where to send the embed.
The channel object.
Sets the settings for assets for the client.
The assets for the client.
Sets the client's message content.
The message content.
The string to separate the content from the page indicator.
Sets whether the client's message will be deleted upon timeout.
Sets the disabled navigation emojis.
// Disable specific navigation emojis
<PaginationEmbed>.setDisabledNavigationEmojis(['delete', 'jump']);
// Disable all navigation emojis
<PaginationEmbed>.setDisabledNavigationEmojis(['all']);
An array of navigation emojis to disable.
Sets the maximum number of elements to be displayed per page.
Maximum number of elements to be displayed per page.
Sets whether to set function emojis after navigation emojis.
Set function emojis after navigation emojis?
Sets the emojis used for function emojis.
<PaginationEmbed>.setFunctionEmojis({
'π': (user, instance) => {
const field = instance.embed.fields[0];
if (field.name === 'Name')
field.name = user.tag;
else
field.name = 'Name';
}
});
An object containing customised emojis to use as function emojis.
Sets the emojis used for navigation emojis.
An object containing customised emojis to use as navigation emojis.
Sets to jump to a certain page upon calling PaginationEmbed.build().
The page number to jump to.
Sets the page indicator formatting function and placement.
Whether to show page indicator.
Pass footer
to display the indicator in embed's footer text (replaces existing text) instead.
Function for indicator formatting.
Sets the time for awaiting a user action before timeout in ms.
Timeout value in ms.
Generated using TypeDoc
A pagination mode that uses a MessageEmbed with a field(s) containing the elements to paginate.