authorSource:
@@ -377,7 +377,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -399,7 +399,7 @@ authori
Inherited From:
@@ -433,7 +433,7 @@ authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -684,7 +684,7 @@ Type:
-currentEmbed
+currentEmbed :MessageEmbed
@@ -695,7 +695,7 @@ currentEm
Source:
@@ -740,6 +740,16 @@ currentEm
+ Type:
+
+ -
+
+MessageEmbed
+
+
+
+
+
@@ -982,7 +992,7 @@ footerSource:
@@ -1055,7 +1065,7 @@ imageSource:
@@ -1276,7 +1286,7 @@ Type:
-thumbnail
+thumbnail :string
@@ -1287,7 +1297,7 @@ thumbnailSource:
@@ -1332,6 +1342,16 @@ thumbnailType:
+
+ -
+
+string
+
+
+
+
+
@@ -1645,7 +1665,7 @@ Methods
- addBlankField(inlineopt) → {Embeds}
+ addBlankField(inlineopt) → {PaginationEmbed}
@@ -1657,7 +1677,7 @@ addBlank
Source:
@@ -1794,10 +1814,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -1806,7 +1822,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -1820,7 +1836,7 @@ Returns:
- addField(name, value, inlineopt) → {Embeds}
+ addField(name, value, inlineopt) → {PaginationEmbed}
@@ -1832,7 +1848,7 @@ addFieldSource:
@@ -2039,10 +2055,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -2051,7 +2063,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -2077,7 +2089,7 @@ (async) buildSource:
@@ -2130,9 +2142,9 @@ (async) buildExamples
- // Object as constructor.
const Embeds = require('discord-paginationembed').Embeds;
const { MessageEmbed } = require('discord.js');
// Under message event.
new Embeds({
authorisedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
new MessageEmbed({ title: 'John Doe' }),
new MessageEmbed({ title: 'Jane Doe' })
],
pageIndicator: false,
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
},
description: 'This is one of my embeds with this message!',
color: 0xFF00AE,
timestamp: true
}).build();
+ // Object as constructor.
const { Embeds } = require('discord-paginationembed');
const { MessageEmbed } = require('discord.js');
// Under message event.
new Embeds({
authorizedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
new MessageEmbed({ title: 'John Doe' }),
new MessageEmbed({ title: 'Jane Doe' })
],
pageIndicator: false,
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
},
description: 'This is one of my embeds with this message!',
color: 0xFF00AE,
timestamp: true
}).build();
- // Methods as constructor.
const Embeds = require('discord-paginationembed').Embeds;
const { MessageEmbed } = require('discord.js');
// Under message event.
new Embeds()
.setAuthorisedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
new MessageEmbed({ title: 'John Doe' }),
new MessageEmbed({ title: 'Jane Doe' })
])
.setPageIndicator(false)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.setDescription('This is one of my embeds with this message!')
.setColor(0xFF00AE)
.setTimestamp()
.build();
+ // Methods as constructor.
const { Embeds } = require('discord-paginationembed');
const { MessageEmbed } = require('discord.js');
// Under message event.
new Embeds()
.setAuthorizedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
new MessageEmbed({ title: 'John Doe' }),
new MessageEmbed({ title: 'Jane Doe' })
])
.setPageIndicator(false)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.setDescription('This is one of my embeds with this message!')
.setColor(0xFF00AE)
.setTimestamp()
.build();
@@ -2156,7 +2168,7 @@ Examples
- setArray(array) → {Embeds}
+ setArray(array) → {PaginationEmbed}
@@ -2168,7 +2180,7 @@ setArraySource:
@@ -2290,10 +2302,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -2302,7 +2310,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -2316,7 +2324,7 @@ Returns:
- setAuthor(name, iconURLopt, urlopt) → {Embeds}
+ setAuthor(name, iconURLopt, urlopt) → {PaginationEmbed}
@@ -2328,7 +2336,7 @@ setAuthorSource:
@@ -2539,10 +2547,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -2551,7 +2555,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -2565,7 +2569,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -2588,7 +2592,7 @@ setA
- Inherited From:
@@ -2622,7 +2626,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -2648,12 +2652,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2677,23 +2677,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -2719,10 +2703,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2879,10 +2859,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2905,7 +2881,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -3019,8 +2995,6 @@ Parameters:
- <optional>
-
@@ -3031,12 +3005,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -3098,10 +3070,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -3124,7 +3092,7 @@ Returns:
- setColor(color) → {Embeds}
+ setColor(color) → {PaginationEmbed}
@@ -3136,7 +3104,7 @@ setColorSource:
@@ -3253,10 +3221,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3265,7 +3229,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3279,7 +3243,7 @@ Returns:
- setDescription(description) → {Embeds}
+ setDescription(description) → {PaginationEmbed}
@@ -3291,7 +3255,7 @@ setDesc
- Source:
@@ -3408,10 +3372,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3420,7 +3380,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3434,7 +3394,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -3517,12 +3477,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -3546,23 +3502,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -3588,10 +3528,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -3614,7 +3550,7 @@ Returns:
- setFooter(text, iconURLopt) → {Embeds}
+ setFooter(text, iconURLopt) → {PaginationEmbed}
@@ -3626,7 +3562,7 @@ setFooterSource:
@@ -3798,10 +3734,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3810,7 +3742,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3824,7 +3756,7 @@ Returns:
- setImage(image) → {Embeds}
+ setImage(image) → {PaginationEmbed}
@@ -3836,7 +3768,7 @@ setImageSource:
@@ -3953,10 +3885,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3965,7 +3893,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3979,7 +3907,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -4062,12 +3990,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -4094,23 +4018,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -4136,10 +4044,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -4162,7 +4066,7 @@ Returns:
- setThumbnail(thumbnail) → {Embeds}
+ setThumbnail(thumbnail) → {PaginationEmbed}
@@ -4174,7 +4078,7 @@ setThumbn
- Source:
@@ -4291,10 +4195,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4303,7 +4203,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4317,7 +4217,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -4400,12 +4300,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -4429,23 +4325,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -4471,10 +4351,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -4497,7 +4373,7 @@ Returns:
- setTimestamp() → {Embeds}
+ setTimestamp() → {PaginationEmbed}
@@ -4509,7 +4385,7 @@ setTimest
- Source:
@@ -4577,10 +4453,6 @@ setTimest
Returns:
-
- - Instance of Embeds
-
-
@@ -4589,7 +4461,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4603,7 +4475,7 @@ Returns:
- setTitle(title) → {Embeds}
+ setTitle(title) → {PaginationEmbed}
@@ -4615,7 +4487,7 @@ setTitleSource:
@@ -4732,10 +4604,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4744,7 +4612,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4758,7 +4626,7 @@ Returns:
- setURL(url) → {Embeds}
+ setURL(url) → {PaginationEmbed}
@@ -4770,7 +4638,7 @@ setURLSource:
@@ -4887,10 +4755,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4899,7 +4763,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4913,7 +4777,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -4996,12 +4860,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -5025,23 +4885,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- true
-
-
Show page indicator?
@@ -5067,10 +4911,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -5106,7 +4946,7 @@ Returns:
diff --git a/docs/Embeds.js.html b/docs/Embeds.js.html
index 637f285..ba6e1c4 100644
--- a/docs/Embeds.js.html
+++ b/docs/Embeds.js.html
@@ -22,7 +22,7 @@
@@ -111,6 +111,7 @@ Embeds.js
/**
* The thumbnail of all embeds.
+ * @type {string}
*/
this.thumbnail = options.thumbnail || null;
@@ -135,7 +136,7 @@ Embeds.js
/**
* Embed in the current page.
- * @returns {MessageEmbed} - An instance of MessageEmbed.
+ * @type {MessageEmbed}
*/
get currentEmbed() {
return this.array[this.page - 1];
@@ -144,7 +145,7 @@ Embeds.js
/**
* Adds a blank field to the fields of all embeds.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addBlankField(inline = false) {
const arr = this.array;
@@ -160,7 +161,7 @@ Embeds.js
* @param {string} name - The name of the field.
* @param {string} value - The value of the field.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addField(name, value, inline = false) {
if (!name && !value) return this;
@@ -179,12 +180,12 @@ Embeds.js
* @example
*
* // Object as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -208,12 +209,12 @@ Embeds.js
* @example
*
* // Methods as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -269,7 +270,7 @@ Embeds.js
/**
* Sets the array of embeds to paginate.
* @param {Array} array - An array of embeds to paginate.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -290,7 +291,7 @@ Embeds.js
* @param {StringResolvable} name - The name of the author.
* @param {string} [iconURL=null] - The icon URL of the author.
* @param {string} [url=null] - The URL of the author.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setAuthor(name, iconURL = null, url = null) {
if (!name) return this;
@@ -306,7 +307,7 @@ Embeds.js
/**
* Sets the color of all embeds.
* @param {ColorResolvable} color - The color of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setColor(color) {
if (!color) return this;
@@ -322,7 +323,7 @@ Embeds.js
/**
* Sets the description of all embeds.
* @param {string} description - The description of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setDescription(description) {
if (!description) return this;
@@ -339,7 +340,7 @@ Embeds.js
* Sets the footer of all embeds.
* @param {string} text - The footer text.
* @param {string} [iconURL=null] - URL for the footer's icon.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setFooter(text, iconURL = null) {
if (!text) return this;
@@ -355,7 +356,7 @@ Embeds.js
/**
* Sets the image of all embeds.
* @param {string} image - The image of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setImage(image) {
if (!image) return this;
@@ -371,7 +372,7 @@ Embeds.js
/**
* Sets the thumbnail of all embeds.
* @param {string} thumbnail - The thumbnail of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setThumbnail(thumbnail) {
if (!thumbnail) return this;
@@ -386,7 +387,7 @@ Embeds.js
/**
* Sets the timestamp of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTimestamp() {
const arr = this.array;
@@ -400,7 +401,7 @@ Embeds.js
/**
* Sets the title of all embeds.
* @param {string} title - The title of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTitle(title) {
if (!title) return this;
@@ -416,7 +417,7 @@ Embeds.js
/**
* Sets the URL of all embeds.
* @param {string} url - The URL of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setURL(url) {
if (!url) return this;
@@ -455,7 +456,7 @@ Embeds.js
diff --git a/docs/FieldsEmbed.html b/docs/FieldsEmbed.html
index 948c77a..e3a7000 100644
--- a/docs/FieldsEmbed.html
+++ b/docs/FieldsEmbed.html
@@ -22,7 +22,7 @@
@@ -304,7 +304,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -326,7 +326,7 @@ authori
- Inherited From:
@@ -360,7 +360,7 @@ authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -538,7 +538,7 @@ Type:
-elementList
+elementList :Array.<*>
@@ -594,6 +594,16 @@ elementLis
+ Type:
+
+ -
+
+Array.<*>
+
+
+
+
+
@@ -1063,9 +1073,9 @@ (async) buildExamples
- // Object as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed({
authorisedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
+ // Object as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed({
authorizedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
- // Methods as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed()
.setAuthorisedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
+ // Methods as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed()
.setAuthorizedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
@@ -1089,7 +1099,7 @@ Examples
- formatField(name, value, inlineopt) → {FieldsEmbed}
+ formatField(name, value, inlineopt) → {PaginationEmbed}
@@ -1308,10 +1318,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -1320,7 +1326,7 @@ Returns:
-
-FieldsEmbed
+PaginationEmbed
@@ -1468,10 +1474,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1494,7 +1496,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1517,7 +1519,7 @@ setA
- Inherited From:
@@ -1551,7 +1553,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1577,12 +1579,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1606,23 +1604,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1648,10 +1630,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1808,10 +1786,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1834,7 +1808,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1948,8 +1922,6 @@ Parameters:
- <optional>
-
@@ -1960,12 +1932,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -2027,10 +1997,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2053,7 +2019,7 @@ Returns:
- setElementsPerPage(numberopt) → {FieldsEmbed}
+ setElementsPerPage(number) → {PaginationEmbed}
@@ -2131,12 +2097,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2160,24 +2122,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 10
-
-
-
Maximum number of elements to be displayed per page.
@@ -2202,10 +2148,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -2214,7 +2156,7 @@ Returns:
-
-FieldsEmbed
+PaginationEmbed
@@ -2228,7 +2170,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -2311,12 +2253,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2340,23 +2278,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -2382,10 +2304,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2408,7 +2326,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -2491,12 +2409,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2523,24 +2437,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 1
-
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -2565,10 +2463,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2591,7 +2485,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -2674,12 +2568,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2703,23 +2593,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2745,10 +2619,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2771,7 +2641,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2854,12 +2724,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2883,24 +2749,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2925,10 +2775,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2964,7 +2810,7 @@ Returns:
diff --git a/docs/FieldsEmbed.js.html b/docs/FieldsEmbed.js.html
index 5d36097..9bad270 100644
--- a/docs/FieldsEmbed.js.html
+++ b/docs/FieldsEmbed.js.html
@@ -22,7 +22,7 @@
@@ -81,7 +81,7 @@ FieldsEmbed.js
/**
* Elements in the current page.
- * @returns {Array.<*>} - An array for a page.
+ * @type {Array.<*>}
*/
get elementList() {
const begin = (this.page - 1) * this.elementsPerPage;
@@ -96,11 +96,11 @@ FieldsEmbed.js
* @example
*
* // Object as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -126,11 +126,11 @@ FieldsEmbed.js
* @example
*
* // Methods as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -185,7 +185,7 @@ FieldsEmbed.js
* @param {string} name - Name of the field.
* @param {Function} value - Value of the field. Function for Array.prototype.map().join('\n').
* @param {boolean} [inline=true] - Whether the field is inline with other field or not.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @returns {PaginationEmbed}
*/
formatField(name, value, inline = true) {
this.fields.push({ name, value, inline });
@@ -195,10 +195,10 @@ FieldsEmbed.js
/**
* Sets the maximum number of elements to be displayed per page.
- * @param {number} [number=10] - Maximum number of elements to be displayed per page.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @param {number} number - Maximum number of elements to be displayed per page.
+ * @returns {PaginationEmbed}
*/
- setElementsPerPage(number = 10) {
+ setElementsPerPage(number) {
if (typeof number !== 'number') throw new Error('setElementsPerPage() only accepts number type.');
this.elementsPerPage = number;
@@ -266,7 +266,7 @@ FieldsEmbed.js
diff --git a/docs/PaginationEmbed.html b/docs/PaginationEmbed.html
index 58d735a..994485d 100644
--- a/docs/PaginationEmbed.html
+++ b/docs/PaginationEmbed.html
@@ -22,7 +22,7 @@
@@ -299,7 +299,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -350,7 +350,7 @@ authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -951,10 +951,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -977,7 +973,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1029,7 +1025,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1055,12 +1051,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1084,23 +1076,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1126,10 +1102,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1281,10 +1253,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1307,7 +1275,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1416,8 +1384,6 @@ Parameters:
- <optional>
-
@@ -1428,12 +1394,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -1495,10 +1459,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1521,7 +1481,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -1599,12 +1559,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1628,23 +1584,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -1670,10 +1610,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1696,7 +1632,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -1774,12 +1710,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1806,23 +1738,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -1848,10 +1764,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1874,7 +1786,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -1952,12 +1864,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1981,23 +1889,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2023,10 +1915,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2049,7 +1937,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2127,12 +2015,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2156,24 +2040,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2198,10 +2066,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2237,7 +2101,7 @@ Returns:
diff --git a/docs/base_PaginationEmbed.js.html b/docs/base_PaginationEmbed.js.html
index c40af28..e74e322 100644
--- a/docs/base_PaginationEmbed.js.html
+++ b/docs/base_PaginationEmbed.js.html
@@ -22,7 +22,7 @@
@@ -63,7 +63,7 @@ base/PaginationEmbed.js
/**
* Options for the constructor.
* @typedef {Object} PaginationEmbedOptions
- * @property {User} [authorisedUser=null] - The authorised user to navigate the pages.
+ * @property {User} [authorizedUser=null] - The authorized user to navigate the pages.
* @property {TextChannel} channel - The channel where to send the embed.
* @property {ClientMessageOptions} [clientMessage=null] - Settings for the message sent by the client.
* @property {Array.<*>} array - An array of elements to paginate.
@@ -82,10 +82,10 @@ base/PaginationEmbed.js
super(options);
/**
- * The authorised user to navigate the pages.
+ * The authorized user to navigate the pages.
* @type {User}
*/
- this.authorisedUser = options.authorisedUser || null;
+ this.authorizedUser = options.authorizedUser || null;
/**
* The channel where to send the embed.
@@ -149,7 +149,7 @@ base/PaginationEmbed.js
/**
* Sets the array of elements to paginate.
* @param {Array} array - An array of elements to paginate.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -162,12 +162,12 @@ base/PaginationEmbed.js
}
/**
- * Set the authorised person to navigate the pages.
- * @param {User} [user=null] - The user object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * Set the authorized person to navigate the pages.
+ * @param {User} user - The user object.
+ * @returns {PaginationEmbed}
*/
- setAuthorisedUser(user = null) {
- this.authorisedUser = user;
+ setAuthorizedUser(user) {
+ this.authorizedUser = user;
return this;
}
@@ -175,7 +175,7 @@ base/PaginationEmbed.js
/**
* The channel where to send the embed.
* @param {TextChannel} channel - The channel object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setChannel(channel) {
this.channel = channel;
@@ -185,11 +185,11 @@ base/PaginationEmbed.js
/**
* Sets the settings for the message sent by the client.
- * @param {Message} [message=null] - The message object sent by the client, if there is any.
+ * @param {Message} message - The message object sent by the client.
* @param {string} [content='Preparing...'] - The custom message content while preparing the embed.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
- setClientMessage(message = null, content = null) {
+ setClientMessage(message, content = null) {
if (!content) content = 'Preparing...';
Object.assign(this.clientMessage, { message, content });
@@ -199,8 +199,8 @@ base/PaginationEmbed.js
/**
* Sets the emojis used for navigation buttons.
- * @param {NavigationButtons} [emojis={}] - An object containing customised emojis to use as navigation buttons.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {NavigationButtons} emojis - An object containing customised emojis to use as navigation buttons.
+ * @returns {PaginationEmbed}
*/
setEmojis(emojis) {
Object.assign(this.emojis, emojis);
@@ -210,10 +210,10 @@ base/PaginationEmbed.js
/**
* Sets to jump to a certain page upon calling PaginationEmbed.build().
- * @param {number|string} [param=1] - The page number to jump to. As String: 'back', 'forward'
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number|string} param - The page number to jump to. As String: 'back', 'forward'
+ * @returns {PaginationEmbed}
*/
- setPage(param = 1) {
+ setPage(param) {
const isString = typeof param === 'string';
if (!(!isNaN(param) || isString)) throw new Error('setPage() only accepts number/string type.');
@@ -229,10 +229,10 @@ base/PaginationEmbed.js
/**
* Sets the time for awaiting a user action before timeout in ms.
- * @param {number} [timeout=30000] Timeout value in ms.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number} timeout Timeout value in ms.
+ * @returns {PaginationEmbed}
*/
- setTimeout(timeout = 30000) {
+ setTimeout(timeout) {
if (typeof timeout !== 'number') throw new Error('setTimeout() only accepts number type.');
this.timeout = timeout;
@@ -242,10 +242,10 @@ base/PaginationEmbed.js
/**
* Sets whether page number indicator on client's message is shown or not.
- * @param {boolean} [boolean=true] - Show page indicator?
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {boolean} boolean - Show page indicator?
+ * @returns {PaginationEmbed}
*/
- showPageIndicator(boolean = true) {
+ showPageIndicator(boolean) {
if (typeof boolean !== 'boolean') throw new Error('showPageIndicator() only accepts boolean type.');
this.pageIndicator = boolean;
@@ -261,7 +261,7 @@ base/PaginationEmbed.js
async _verify(pages) {
this
.setChannel(this.channel)
- .setAuthorisedUser(this.authorisedUser)
+ .setAuthorizedUser(this.authorizedUser)
.setClientMessage(this.clientMessage.message, this.clientMessage.content)
.setArray(this.array)
.showPageIndicator(this.pageIndicator)
@@ -337,8 +337,8 @@ base/PaginationEmbed.js
async _awaitResponse() {
const emojis = Object.values(this.emojis);
const filter = (r, u) => {
- if (this.authorisedUser)
- return u.id === this.authorisedUser.id && emojis.includes(r.emoji.name);
+ if (this.authorizedUser)
+ return u.id === this.authorizedUser.id && emojis.includes(r.emoji.name);
return !u.bot && emojis.includes(r.emoji.name);
};
@@ -432,7 +432,7 @@ base/PaginationEmbed.js
diff --git a/docs/global.html b/docs/global.html
index 23000ba..3f7e34b 100644
--- a/docs/global.html
+++ b/docs/global.html
@@ -22,7 +22,7 @@
@@ -1487,7 +1487,7 @@ Properties:
- authorisedUser
+ authorizedUser
@@ -1517,7 +1517,7 @@ Properties:
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -1820,7 +1820,7 @@ Type:
diff --git a/docs/index.html b/docs/index.html
index 80eb8c4..c53f893 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -22,7 +22,7 @@
@@ -51,20 +51,21 @@ Home
Classes
const FieldsEmbedMode = require('discord-paginationembed').FieldsEmbed;
+const { FieldsEmbed: FieldsEmbedMode } = require('discord-paginationembed');
new FieldsEmbedMode()
.setArray([ { name: "John Doe" }, { name: "Jane Doe" } ])
- .setAuthorisedUser(message.author)
+ .setAuthorizedUser(message.author)
.setChannel(message.channel)
.setElementsPerPage(1)
.setPage(2)
.showPageIndicator(false)
- .build();
const EmbedsMode = require('discord-paginationembed').Embeds;
+ .build();
const { Embeds: EmbedsMode } = require('discord-paginationembed');
const { MessageEmbed } = require("discord.js");
const embeds = [];
@@ -76,7 +77,7 @@ Under message
event
new EmbedsMode()
.setArray(embeds)
- .setAuthorisedUser(message.author)
+ .setAuthorizedUser(message.author)
.setChannel(message.channel)
.showPageIndicator(true)
.setPage(3)
@@ -99,7 +100,7 @@ Contributing
- Fork this repository.
- Execute
npm install
- Code and code and code and code and... code!
-npm test
to verify your additions/adjustments are following ESLint's rules and verify docs are valid.
+npm test
to verify if your additions/adjustments are following ESLint's rules and to verify if the docs are valid.
- File a Pull Request!
License
MIT
@@ -115,7 +116,7 @@ License
MIT
diff --git a/package.json b/package.json
index f30a2be..44c632d 100644
--- a/package.json
+++ b/package.json
@@ -1,11 +1,11 @@
{
"name": "discord-paginationembed",
- "version": "0.1.0",
+ "version": "0.2.0",
"description": "Pagination Embed for Discord.JS",
"main": "./src/index.js",
"scripts": {
- "test": "eslint --ignore-path .eslintignore . && npm run generate-docs",
- "generate-docs": "jsdoc -c jsdoc.json"
+ "test": "eslint ./src && npm run docs",
+ "docs": "node_modules/.bin/jsdoc -c .jsdoc.json"
},
"repository": {
"type": "git",
@@ -27,7 +27,7 @@
"url": "https://github.com/gazmull/discord-paginationembed/issues"
},
"homepage": "https://github.com/gazmull/discord-paginationembed#readme",
- "dependencies": {
+ "peerDependencies": {
"discord.js": "discordjs/discord.js"
},
"devDependencies": {
diff --git a/src/struct/Embeds.js b/src/struct/Embeds.js
index e8ed7be..ac4fb33 100644
--- a/src/struct/Embeds.js
+++ b/src/struct/Embeds.js
@@ -72,6 +72,7 @@ class Embeds extends PaginationEmbed {
/**
* The thumbnail of all embeds.
+ * @type {string}
*/
this.thumbnail = options.thumbnail || null;
@@ -96,7 +97,7 @@ class Embeds extends PaginationEmbed {
/**
* Embed in the current page.
- * @returns {MessageEmbed} - An instance of MessageEmbed.
+ * @type {MessageEmbed}
*/
get currentEmbed() {
return this.array[this.page - 1];
@@ -105,7 +106,7 @@ class Embeds extends PaginationEmbed {
/**
* Adds a blank field to the fields of all embeds.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addBlankField(inline = false) {
const arr = this.array;
@@ -121,7 +122,7 @@ class Embeds extends PaginationEmbed {
* @param {string} name - The name of the field.
* @param {string} value - The value of the field.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addField(name, value, inline = false) {
if (!name && !value) return this;
@@ -140,12 +141,12 @@ class Embeds extends PaginationEmbed {
* @example
*
* // Object as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -169,12 +170,12 @@ class Embeds extends PaginationEmbed {
* @example
*
* // Methods as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -230,7 +231,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the array of embeds to paginate.
* @param {Array} array - An array of embeds to paginate.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -251,7 +252,7 @@ class Embeds extends PaginationEmbed {
* @param {StringResolvable} name - The name of the author.
* @param {string} [iconURL=null] - The icon URL of the author.
* @param {string} [url=null] - The URL of the author.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setAuthor(name, iconURL = null, url = null) {
if (!name) return this;
@@ -267,7 +268,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the color of all embeds.
* @param {ColorResolvable} color - The color of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setColor(color) {
if (!color) return this;
@@ -283,7 +284,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the description of all embeds.
* @param {string} description - The description of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setDescription(description) {
if (!description) return this;
@@ -300,7 +301,7 @@ class Embeds extends PaginationEmbed {
* Sets the footer of all embeds.
* @param {string} text - The footer text.
* @param {string} [iconURL=null] - URL for the footer's icon.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setFooter(text, iconURL = null) {
if (!text) return this;
@@ -316,7 +317,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the image of all embeds.
* @param {string} image - The image of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setImage(image) {
if (!image) return this;
@@ -332,7 +333,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the thumbnail of all embeds.
* @param {string} thumbnail - The thumbnail of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setThumbnail(thumbnail) {
if (!thumbnail) return this;
@@ -347,7 +348,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the timestamp of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTimestamp() {
const arr = this.array;
@@ -361,7 +362,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the title of all embeds.
* @param {string} title - The title of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTitle(title) {
if (!title) return this;
@@ -377,7 +378,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the URL of all embeds.
* @param {string} url - The URL of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setURL(url) {
if (!url) return this;
diff --git a/src/struct/FieldsEmbed.js b/src/struct/FieldsEmbed.js
index 71b2281..d631b76 100644
--- a/src/struct/FieldsEmbed.js
+++ b/src/struct/FieldsEmbed.js
@@ -42,7 +42,7 @@ class FieldsEmbed extends PaginationEmbed {
/**
* Elements in the current page.
- * @returns {Array.<*>} - An array for a page.
+ * @type {Array.<*>}
*/
get elementList() {
const begin = (this.page - 1) * this.elementsPerPage;
@@ -57,11 +57,11 @@ class FieldsEmbed extends PaginationEmbed {
* @example
*
* // Object as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -87,11 +87,11 @@ class FieldsEmbed extends PaginationEmbed {
* @example
*
* // Methods as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -146,7 +146,7 @@ class FieldsEmbed extends PaginationEmbed {
* @param {string} name - Name of the field.
* @param {Function} value - Value of the field. Function for Array.prototype.map().join('\n').
* @param {boolean} [inline=true] - Whether the field is inline with other field or not.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @returns {PaginationEmbed}
*/
formatField(name, value, inline = true) {
this.fields.push({ name, value, inline });
@@ -156,10 +156,10 @@ class FieldsEmbed extends PaginationEmbed {
/**
* Sets the maximum number of elements to be displayed per page.
- * @param {number} [number=10] - Maximum number of elements to be displayed per page.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @param {number} number - Maximum number of elements to be displayed per page.
+ * @returns {PaginationEmbed}
*/
- setElementsPerPage(number = 10) {
+ setElementsPerPage(number) {
if (typeof number !== 'number') throw new Error('setElementsPerPage() only accepts number type.');
this.elementsPerPage = number;
diff --git a/src/struct/base/PaginationEmbed.js b/src/struct/base/PaginationEmbed.js
index 11a5a9f..9f9ec45 100644
--- a/src/struct/base/PaginationEmbed.js
+++ b/src/struct/base/PaginationEmbed.js
@@ -24,7 +24,7 @@ class PaginationEmbed extends MessageEmbed {
/**
* Options for the constructor.
* @typedef {Object} PaginationEmbedOptions
- * @property {User} [authorisedUser=null] - The authorised user to navigate the pages.
+ * @property {User} [authorizedUser=null] - The authorized user to navigate the pages.
* @property {TextChannel} channel - The channel where to send the embed.
* @property {ClientMessageOptions} [clientMessage=null] - Settings for the message sent by the client.
* @property {Array.<*>} array - An array of elements to paginate.
@@ -43,10 +43,10 @@ class PaginationEmbed extends MessageEmbed {
super(options);
/**
- * The authorised user to navigate the pages.
+ * The authorized user to navigate the pages.
* @type {User}
*/
- this.authorisedUser = options.authorisedUser || null;
+ this.authorizedUser = options.authorizedUser || null;
/**
* The channel where to send the embed.
@@ -110,7 +110,7 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the array of elements to paginate.
* @param {Array} array - An array of elements to paginate.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -123,12 +123,12 @@ class PaginationEmbed extends MessageEmbed {
}
/**
- * Set the authorised person to navigate the pages.
- * @param {User} [user=null] - The user object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * Set the authorized person to navigate the pages.
+ * @param {User} user - The user object.
+ * @returns {PaginationEmbed}
*/
- setAuthorisedUser(user = null) {
- this.authorisedUser = user;
+ setAuthorizedUser(user) {
+ this.authorizedUser = user;
return this;
}
@@ -136,7 +136,7 @@ class PaginationEmbed extends MessageEmbed {
/**
* The channel where to send the embed.
* @param {TextChannel} channel - The channel object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setChannel(channel) {
this.channel = channel;
@@ -146,11 +146,11 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the settings for the message sent by the client.
- * @param {Message} [message=null] - The message object sent by the client, if there is any.
+ * @param {Message} message - The message object sent by the client.
* @param {string} [content='Preparing...'] - The custom message content while preparing the embed.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
- setClientMessage(message = null, content = null) {
+ setClientMessage(message, content = null) {
if (!content) content = 'Preparing...';
Object.assign(this.clientMessage, { message, content });
@@ -160,8 +160,8 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the emojis used for navigation buttons.
- * @param {NavigationButtons} [emojis={}] - An object containing customised emojis to use as navigation buttons.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {NavigationButtons} emojis - An object containing customised emojis to use as navigation buttons.
+ * @returns {PaginationEmbed}
*/
setEmojis(emojis) {
Object.assign(this.emojis, emojis);
@@ -171,10 +171,10 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets to jump to a certain page upon calling PaginationEmbed.build().
- * @param {number|string} [param=1] - The page number to jump to. As String: 'back', 'forward'
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number|string} param - The page number to jump to. As String: 'back', 'forward'
+ * @returns {PaginationEmbed}
*/
- setPage(param = 1) {
+ setPage(param) {
const isString = typeof param === 'string';
if (!(!isNaN(param) || isString)) throw new Error('setPage() only accepts number/string type.');
@@ -190,10 +190,10 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the time for awaiting a user action before timeout in ms.
- * @param {number} [timeout=30000] Timeout value in ms.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number} timeout Timeout value in ms.
+ * @returns {PaginationEmbed}
*/
- setTimeout(timeout = 30000) {
+ setTimeout(timeout) {
if (typeof timeout !== 'number') throw new Error('setTimeout() only accepts number type.');
this.timeout = timeout;
@@ -203,10 +203,10 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets whether page number indicator on client's message is shown or not.
- * @param {boolean} [boolean=true] - Show page indicator?
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {boolean} boolean - Show page indicator?
+ * @returns {PaginationEmbed}
*/
- showPageIndicator(boolean = true) {
+ showPageIndicator(boolean) {
if (typeof boolean !== 'boolean') throw new Error('showPageIndicator() only accepts boolean type.');
this.pageIndicator = boolean;
@@ -222,7 +222,7 @@ class PaginationEmbed extends MessageEmbed {
async _verify(pages) {
this
.setChannel(this.channel)
- .setAuthorisedUser(this.authorisedUser)
+ .setAuthorizedUser(this.authorizedUser)
.setClientMessage(this.clientMessage.message, this.clientMessage.content)
.setArray(this.array)
.showPageIndicator(this.pageIndicator)
@@ -298,8 +298,8 @@ class PaginationEmbed extends MessageEmbed {
async _awaitResponse() {
const emojis = Object.values(this.emojis);
const filter = (r, u) => {
- if (this.authorisedUser)
- return u.id === this.authorisedUser.id && emojis.includes(r.emoji.name);
+ if (this.authorizedUser)
+ return u.id === this.authorizedUser.id && emojis.includes(r.emoji.name);
return !u.bot && emojis.includes(r.emoji.name);
};
authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -684,7 +684,7 @@ Type:
-currentEmbed
+currentEmbed :MessageEmbed
@@ -695,7 +695,7 @@ currentEm
Source:
@@ -740,6 +740,16 @@ currentEm
+ Type:
+
+ -
+
+MessageEmbed
+
+
+
+
+
@@ -982,7 +992,7 @@ footerSource:
@@ -1055,7 +1065,7 @@ imageSource:
@@ -1276,7 +1286,7 @@ Type:
-thumbnail
+thumbnail :string
@@ -1287,7 +1297,7 @@ thumbnailSource:
@@ -1332,6 +1342,16 @@ thumbnailType:
+
+ -
+
+string
+
+
+
+
+
@@ -1645,7 +1665,7 @@ Methods
- addBlankField(inlineopt) → {Embeds}
+ addBlankField(inlineopt) → {PaginationEmbed}
@@ -1657,7 +1677,7 @@ addBlank
Source:
@@ -1794,10 +1814,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -1806,7 +1822,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -1820,7 +1836,7 @@ Returns:
- addField(name, value, inlineopt) → {Embeds}
+ addField(name, value, inlineopt) → {PaginationEmbed}
@@ -1832,7 +1848,7 @@ addFieldSource:
@@ -2039,10 +2055,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -2051,7 +2063,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -2077,7 +2089,7 @@ (async) buildSource:
@@ -2130,9 +2142,9 @@ (async) buildExamples
- // Object as constructor.
const Embeds = require('discord-paginationembed').Embeds;
const { MessageEmbed } = require('discord.js');
// Under message event.
new Embeds({
authorisedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
new MessageEmbed({ title: 'John Doe' }),
new MessageEmbed({ title: 'Jane Doe' })
],
pageIndicator: false,
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
},
description: 'This is one of my embeds with this message!',
color: 0xFF00AE,
timestamp: true
}).build();
+ // Object as constructor.
const { Embeds } = require('discord-paginationembed');
const { MessageEmbed } = require('discord.js');
// Under message event.
new Embeds({
authorizedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
new MessageEmbed({ title: 'John Doe' }),
new MessageEmbed({ title: 'Jane Doe' })
],
pageIndicator: false,
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
},
description: 'This is one of my embeds with this message!',
color: 0xFF00AE,
timestamp: true
}).build();
- // Methods as constructor.
const Embeds = require('discord-paginationembed').Embeds;
const { MessageEmbed } = require('discord.js');
// Under message event.
new Embeds()
.setAuthorisedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
new MessageEmbed({ title: 'John Doe' }),
new MessageEmbed({ title: 'Jane Doe' })
])
.setPageIndicator(false)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.setDescription('This is one of my embeds with this message!')
.setColor(0xFF00AE)
.setTimestamp()
.build();
+ // Methods as constructor.
const { Embeds } = require('discord-paginationembed');
const { MessageEmbed } = require('discord.js');
// Under message event.
new Embeds()
.setAuthorizedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
new MessageEmbed({ title: 'John Doe' }),
new MessageEmbed({ title: 'Jane Doe' })
])
.setPageIndicator(false)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.setDescription('This is one of my embeds with this message!')
.setColor(0xFF00AE)
.setTimestamp()
.build();
@@ -2156,7 +2168,7 @@ Examples
- setArray(array) → {Embeds}
+ setArray(array) → {PaginationEmbed}
@@ -2168,7 +2180,7 @@ setArraySource:
@@ -2290,10 +2302,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -2302,7 +2310,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -2316,7 +2324,7 @@ Returns:
- setAuthor(name, iconURLopt, urlopt) → {Embeds}
+ setAuthor(name, iconURLopt, urlopt) → {PaginationEmbed}
@@ -2328,7 +2336,7 @@ setAuthorSource:
@@ -2539,10 +2547,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -2551,7 +2555,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -2565,7 +2569,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -2588,7 +2592,7 @@ setA
- Inherited From:
@@ -2622,7 +2626,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -2648,12 +2652,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2677,23 +2677,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -2719,10 +2703,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2879,10 +2859,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2905,7 +2881,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -3019,8 +2995,6 @@ Parameters:
- <optional>
-
@@ -3031,12 +3005,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -3098,10 +3070,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -3124,7 +3092,7 @@ Returns:
- setColor(color) → {Embeds}
+ setColor(color) → {PaginationEmbed}
@@ -3136,7 +3104,7 @@ setColorSource:
@@ -3253,10 +3221,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3265,7 +3229,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3279,7 +3243,7 @@ Returns:
- setDescription(description) → {Embeds}
+ setDescription(description) → {PaginationEmbed}
@@ -3291,7 +3255,7 @@ setDesc
- Source:
@@ -3408,10 +3372,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3420,7 +3380,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3434,7 +3394,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -3517,12 +3477,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -3546,23 +3502,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -3588,10 +3528,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -3614,7 +3550,7 @@ Returns:
- setFooter(text, iconURLopt) → {Embeds}
+ setFooter(text, iconURLopt) → {PaginationEmbed}
@@ -3626,7 +3562,7 @@ setFooterSource:
@@ -3798,10 +3734,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3810,7 +3742,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3824,7 +3756,7 @@ Returns:
- setImage(image) → {Embeds}
+ setImage(image) → {PaginationEmbed}
@@ -3836,7 +3768,7 @@ setImageSource:
@@ -3953,10 +3885,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3965,7 +3893,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3979,7 +3907,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -4062,12 +3990,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -4094,23 +4018,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -4136,10 +4044,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -4162,7 +4066,7 @@ Returns:
- setThumbnail(thumbnail) → {Embeds}
+ setThumbnail(thumbnail) → {PaginationEmbed}
@@ -4174,7 +4078,7 @@ setThumbn
- Source:
@@ -4291,10 +4195,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4303,7 +4203,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4317,7 +4217,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -4400,12 +4300,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -4429,23 +4325,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -4471,10 +4351,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -4497,7 +4373,7 @@ Returns:
- setTimestamp() → {Embeds}
+ setTimestamp() → {PaginationEmbed}
@@ -4509,7 +4385,7 @@ setTimest
- Source:
@@ -4577,10 +4453,6 @@ setTimest
Returns:
-
- - Instance of Embeds
-
-
@@ -4589,7 +4461,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4603,7 +4475,7 @@ Returns:
- setTitle(title) → {Embeds}
+ setTitle(title) → {PaginationEmbed}
@@ -4615,7 +4487,7 @@ setTitleSource:
@@ -4732,10 +4604,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4744,7 +4612,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4758,7 +4626,7 @@ Returns:
- setURL(url) → {Embeds}
+ setURL(url) → {PaginationEmbed}
@@ -4770,7 +4638,7 @@ setURLSource:
@@ -4887,10 +4755,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4899,7 +4763,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4913,7 +4777,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -4996,12 +4860,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -5025,23 +4885,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- true
-
-
Show page indicator?
@@ -5067,10 +4911,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -5106,7 +4946,7 @@ Returns:
diff --git a/docs/Embeds.js.html b/docs/Embeds.js.html
index 637f285..ba6e1c4 100644
--- a/docs/Embeds.js.html
+++ b/docs/Embeds.js.html
@@ -22,7 +22,7 @@
@@ -111,6 +111,7 @@ Embeds.js
/**
* The thumbnail of all embeds.
+ * @type {string}
*/
this.thumbnail = options.thumbnail || null;
@@ -135,7 +136,7 @@ Embeds.js
/**
* Embed in the current page.
- * @returns {MessageEmbed} - An instance of MessageEmbed.
+ * @type {MessageEmbed}
*/
get currentEmbed() {
return this.array[this.page - 1];
@@ -144,7 +145,7 @@ Embeds.js
/**
* Adds a blank field to the fields of all embeds.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addBlankField(inline = false) {
const arr = this.array;
@@ -160,7 +161,7 @@ Embeds.js
* @param {string} name - The name of the field.
* @param {string} value - The value of the field.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addField(name, value, inline = false) {
if (!name && !value) return this;
@@ -179,12 +180,12 @@ Embeds.js
* @example
*
* // Object as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -208,12 +209,12 @@ Embeds.js
* @example
*
* // Methods as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -269,7 +270,7 @@ Embeds.js
/**
* Sets the array of embeds to paginate.
* @param {Array} array - An array of embeds to paginate.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -290,7 +291,7 @@ Embeds.js
* @param {StringResolvable} name - The name of the author.
* @param {string} [iconURL=null] - The icon URL of the author.
* @param {string} [url=null] - The URL of the author.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setAuthor(name, iconURL = null, url = null) {
if (!name) return this;
@@ -306,7 +307,7 @@ Embeds.js
/**
* Sets the color of all embeds.
* @param {ColorResolvable} color - The color of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setColor(color) {
if (!color) return this;
@@ -322,7 +323,7 @@ Embeds.js
/**
* Sets the description of all embeds.
* @param {string} description - The description of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setDescription(description) {
if (!description) return this;
@@ -339,7 +340,7 @@ Embeds.js
* Sets the footer of all embeds.
* @param {string} text - The footer text.
* @param {string} [iconURL=null] - URL for the footer's icon.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setFooter(text, iconURL = null) {
if (!text) return this;
@@ -355,7 +356,7 @@ Embeds.js
/**
* Sets the image of all embeds.
* @param {string} image - The image of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setImage(image) {
if (!image) return this;
@@ -371,7 +372,7 @@ Embeds.js
/**
* Sets the thumbnail of all embeds.
* @param {string} thumbnail - The thumbnail of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setThumbnail(thumbnail) {
if (!thumbnail) return this;
@@ -386,7 +387,7 @@ Embeds.js
/**
* Sets the timestamp of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTimestamp() {
const arr = this.array;
@@ -400,7 +401,7 @@ Embeds.js
/**
* Sets the title of all embeds.
* @param {string} title - The title of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTitle(title) {
if (!title) return this;
@@ -416,7 +417,7 @@ Embeds.js
/**
* Sets the URL of all embeds.
* @param {string} url - The URL of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setURL(url) {
if (!url) return this;
@@ -455,7 +456,7 @@ Embeds.js
diff --git a/docs/FieldsEmbed.html b/docs/FieldsEmbed.html
index 948c77a..e3a7000 100644
--- a/docs/FieldsEmbed.html
+++ b/docs/FieldsEmbed.html
@@ -22,7 +22,7 @@
@@ -304,7 +304,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -326,7 +326,7 @@ authori
- Inherited From:
@@ -360,7 +360,7 @@ authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -538,7 +538,7 @@ Type:
-elementList
+elementList :Array.<*>
@@ -594,6 +594,16 @@ elementLis
+ Type:
+
+ -
+
+Array.<*>
+
+
+
+
+
@@ -1063,9 +1073,9 @@ (async) buildExamples
- // Object as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed({
authorisedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
+ // Object as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed({
authorizedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
- // Methods as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed()
.setAuthorisedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
+ // Methods as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed()
.setAuthorizedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
@@ -1089,7 +1099,7 @@ Examples
- formatField(name, value, inlineopt) → {FieldsEmbed}
+ formatField(name, value, inlineopt) → {PaginationEmbed}
@@ -1308,10 +1318,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -1320,7 +1326,7 @@ Returns:
-
-FieldsEmbed
+PaginationEmbed
@@ -1468,10 +1474,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1494,7 +1496,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1517,7 +1519,7 @@ setA
- Inherited From:
@@ -1551,7 +1553,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1577,12 +1579,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1606,23 +1604,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1648,10 +1630,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1808,10 +1786,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1834,7 +1808,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1948,8 +1922,6 @@ Parameters:
- <optional>
-
@@ -1960,12 +1932,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -2027,10 +1997,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2053,7 +2019,7 @@ Returns:
- setElementsPerPage(numberopt) → {FieldsEmbed}
+ setElementsPerPage(number) → {PaginationEmbed}
@@ -2131,12 +2097,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2160,24 +2122,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 10
-
-
-
Maximum number of elements to be displayed per page.
@@ -2202,10 +2148,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -2214,7 +2156,7 @@ Returns:
-
-FieldsEmbed
+PaginationEmbed
@@ -2228,7 +2170,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -2311,12 +2253,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2340,23 +2278,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -2382,10 +2304,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2408,7 +2326,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -2491,12 +2409,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2523,24 +2437,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 1
-
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -2565,10 +2463,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2591,7 +2485,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -2674,12 +2568,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2703,23 +2593,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2745,10 +2619,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2771,7 +2641,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2854,12 +2724,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2883,24 +2749,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2925,10 +2775,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2964,7 +2810,7 @@ Returns:
diff --git a/docs/FieldsEmbed.js.html b/docs/FieldsEmbed.js.html
index 5d36097..9bad270 100644
--- a/docs/FieldsEmbed.js.html
+++ b/docs/FieldsEmbed.js.html
@@ -22,7 +22,7 @@
@@ -81,7 +81,7 @@ FieldsEmbed.js
/**
* Elements in the current page.
- * @returns {Array.<*>} - An array for a page.
+ * @type {Array.<*>}
*/
get elementList() {
const begin = (this.page - 1) * this.elementsPerPage;
@@ -96,11 +96,11 @@ FieldsEmbed.js
* @example
*
* // Object as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -126,11 +126,11 @@ FieldsEmbed.js
* @example
*
* // Methods as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -185,7 +185,7 @@ FieldsEmbed.js
* @param {string} name - Name of the field.
* @param {Function} value - Value of the field. Function for Array.prototype.map().join('\n').
* @param {boolean} [inline=true] - Whether the field is inline with other field or not.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @returns {PaginationEmbed}
*/
formatField(name, value, inline = true) {
this.fields.push({ name, value, inline });
@@ -195,10 +195,10 @@ FieldsEmbed.js
/**
* Sets the maximum number of elements to be displayed per page.
- * @param {number} [number=10] - Maximum number of elements to be displayed per page.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @param {number} number - Maximum number of elements to be displayed per page.
+ * @returns {PaginationEmbed}
*/
- setElementsPerPage(number = 10) {
+ setElementsPerPage(number) {
if (typeof number !== 'number') throw new Error('setElementsPerPage() only accepts number type.');
this.elementsPerPage = number;
@@ -266,7 +266,7 @@ FieldsEmbed.js
diff --git a/docs/PaginationEmbed.html b/docs/PaginationEmbed.html
index 58d735a..994485d 100644
--- a/docs/PaginationEmbed.html
+++ b/docs/PaginationEmbed.html
@@ -22,7 +22,7 @@
@@ -299,7 +299,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -350,7 +350,7 @@ authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -951,10 +951,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -977,7 +973,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1029,7 +1025,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1055,12 +1051,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1084,23 +1076,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1126,10 +1102,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1281,10 +1253,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1307,7 +1275,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1416,8 +1384,6 @@ Parameters:
- <optional>
-
@@ -1428,12 +1394,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -1495,10 +1459,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1521,7 +1481,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -1599,12 +1559,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1628,23 +1584,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -1670,10 +1610,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1696,7 +1632,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -1774,12 +1710,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1806,23 +1738,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -1848,10 +1764,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1874,7 +1786,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -1952,12 +1864,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1981,23 +1889,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2023,10 +1915,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2049,7 +1937,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2127,12 +2015,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2156,24 +2040,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2198,10 +2066,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2237,7 +2101,7 @@ Returns:
diff --git a/docs/base_PaginationEmbed.js.html b/docs/base_PaginationEmbed.js.html
index c40af28..e74e322 100644
--- a/docs/base_PaginationEmbed.js.html
+++ b/docs/base_PaginationEmbed.js.html
@@ -22,7 +22,7 @@
@@ -63,7 +63,7 @@ base/PaginationEmbed.js
/**
* Options for the constructor.
* @typedef {Object} PaginationEmbedOptions
- * @property {User} [authorisedUser=null] - The authorised user to navigate the pages.
+ * @property {User} [authorizedUser=null] - The authorized user to navigate the pages.
* @property {TextChannel} channel - The channel where to send the embed.
* @property {ClientMessageOptions} [clientMessage=null] - Settings for the message sent by the client.
* @property {Array.<*>} array - An array of elements to paginate.
@@ -82,10 +82,10 @@ base/PaginationEmbed.js
super(options);
/**
- * The authorised user to navigate the pages.
+ * The authorized user to navigate the pages.
* @type {User}
*/
- this.authorisedUser = options.authorisedUser || null;
+ this.authorizedUser = options.authorizedUser || null;
/**
* The channel where to send the embed.
@@ -149,7 +149,7 @@ base/PaginationEmbed.js
/**
* Sets the array of elements to paginate.
* @param {Array} array - An array of elements to paginate.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -162,12 +162,12 @@ base/PaginationEmbed.js
}
/**
- * Set the authorised person to navigate the pages.
- * @param {User} [user=null] - The user object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * Set the authorized person to navigate the pages.
+ * @param {User} user - The user object.
+ * @returns {PaginationEmbed}
*/
- setAuthorisedUser(user = null) {
- this.authorisedUser = user;
+ setAuthorizedUser(user) {
+ this.authorizedUser = user;
return this;
}
@@ -175,7 +175,7 @@ base/PaginationEmbed.js
/**
* The channel where to send the embed.
* @param {TextChannel} channel - The channel object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setChannel(channel) {
this.channel = channel;
@@ -185,11 +185,11 @@ base/PaginationEmbed.js
/**
* Sets the settings for the message sent by the client.
- * @param {Message} [message=null] - The message object sent by the client, if there is any.
+ * @param {Message} message - The message object sent by the client.
* @param {string} [content='Preparing...'] - The custom message content while preparing the embed.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
- setClientMessage(message = null, content = null) {
+ setClientMessage(message, content = null) {
if (!content) content = 'Preparing...';
Object.assign(this.clientMessage, { message, content });
@@ -199,8 +199,8 @@ base/PaginationEmbed.js
/**
* Sets the emojis used for navigation buttons.
- * @param {NavigationButtons} [emojis={}] - An object containing customised emojis to use as navigation buttons.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {NavigationButtons} emojis - An object containing customised emojis to use as navigation buttons.
+ * @returns {PaginationEmbed}
*/
setEmojis(emojis) {
Object.assign(this.emojis, emojis);
@@ -210,10 +210,10 @@ base/PaginationEmbed.js
/**
* Sets to jump to a certain page upon calling PaginationEmbed.build().
- * @param {number|string} [param=1] - The page number to jump to. As String: 'back', 'forward'
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number|string} param - The page number to jump to. As String: 'back', 'forward'
+ * @returns {PaginationEmbed}
*/
- setPage(param = 1) {
+ setPage(param) {
const isString = typeof param === 'string';
if (!(!isNaN(param) || isString)) throw new Error('setPage() only accepts number/string type.');
@@ -229,10 +229,10 @@ base/PaginationEmbed.js
/**
* Sets the time for awaiting a user action before timeout in ms.
- * @param {number} [timeout=30000] Timeout value in ms.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number} timeout Timeout value in ms.
+ * @returns {PaginationEmbed}
*/
- setTimeout(timeout = 30000) {
+ setTimeout(timeout) {
if (typeof timeout !== 'number') throw new Error('setTimeout() only accepts number type.');
this.timeout = timeout;
@@ -242,10 +242,10 @@ base/PaginationEmbed.js
/**
* Sets whether page number indicator on client's message is shown or not.
- * @param {boolean} [boolean=true] - Show page indicator?
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {boolean} boolean - Show page indicator?
+ * @returns {PaginationEmbed}
*/
- showPageIndicator(boolean = true) {
+ showPageIndicator(boolean) {
if (typeof boolean !== 'boolean') throw new Error('showPageIndicator() only accepts boolean type.');
this.pageIndicator = boolean;
@@ -261,7 +261,7 @@ base/PaginationEmbed.js
async _verify(pages) {
this
.setChannel(this.channel)
- .setAuthorisedUser(this.authorisedUser)
+ .setAuthorizedUser(this.authorizedUser)
.setClientMessage(this.clientMessage.message, this.clientMessage.content)
.setArray(this.array)
.showPageIndicator(this.pageIndicator)
@@ -337,8 +337,8 @@ base/PaginationEmbed.js
async _awaitResponse() {
const emojis = Object.values(this.emojis);
const filter = (r, u) => {
- if (this.authorisedUser)
- return u.id === this.authorisedUser.id && emojis.includes(r.emoji.name);
+ if (this.authorizedUser)
+ return u.id === this.authorizedUser.id && emojis.includes(r.emoji.name);
return !u.bot && emojis.includes(r.emoji.name);
};
@@ -432,7 +432,7 @@ base/PaginationEmbed.js
diff --git a/docs/global.html b/docs/global.html
index 23000ba..3f7e34b 100644
--- a/docs/global.html
+++ b/docs/global.html
@@ -22,7 +22,7 @@
@@ -1487,7 +1487,7 @@ Properties:
- authorisedUser
+ authorizedUser
@@ -1517,7 +1517,7 @@ Properties:
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -1820,7 +1820,7 @@ Type:
diff --git a/docs/index.html b/docs/index.html
index 80eb8c4..c53f893 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -22,7 +22,7 @@
@@ -51,20 +51,21 @@ Home
Classes
const FieldsEmbedMode = require('discord-paginationembed').FieldsEmbed;
+const { FieldsEmbed: FieldsEmbedMode } = require('discord-paginationembed');
new FieldsEmbedMode()
.setArray([ { name: "John Doe" }, { name: "Jane Doe" } ])
- .setAuthorisedUser(message.author)
+ .setAuthorizedUser(message.author)
.setChannel(message.channel)
.setElementsPerPage(1)
.setPage(2)
.showPageIndicator(false)
- .build();
const EmbedsMode = require('discord-paginationembed').Embeds;
+ .build();
const { Embeds: EmbedsMode } = require('discord-paginationembed');
const { MessageEmbed } = require("discord.js");
const embeds = [];
@@ -76,7 +77,7 @@ Under message
event
new EmbedsMode()
.setArray(embeds)
- .setAuthorisedUser(message.author)
+ .setAuthorizedUser(message.author)
.setChannel(message.channel)
.showPageIndicator(true)
.setPage(3)
@@ -99,7 +100,7 @@ Contributing
- Fork this repository.
- Execute
npm install
- Code and code and code and code and... code!
-npm test
to verify your additions/adjustments are following ESLint's rules and verify docs are valid.
+npm test
to verify if your additions/adjustments are following ESLint's rules and to verify if the docs are valid.
- File a Pull Request!
License
MIT
@@ -115,7 +116,7 @@ License
MIT
diff --git a/package.json b/package.json
index f30a2be..44c632d 100644
--- a/package.json
+++ b/package.json
@@ -1,11 +1,11 @@
{
"name": "discord-paginationembed",
- "version": "0.1.0",
+ "version": "0.2.0",
"description": "Pagination Embed for Discord.JS",
"main": "./src/index.js",
"scripts": {
- "test": "eslint --ignore-path .eslintignore . && npm run generate-docs",
- "generate-docs": "jsdoc -c jsdoc.json"
+ "test": "eslint ./src && npm run docs",
+ "docs": "node_modules/.bin/jsdoc -c .jsdoc.json"
},
"repository": {
"type": "git",
@@ -27,7 +27,7 @@
"url": "https://github.com/gazmull/discord-paginationembed/issues"
},
"homepage": "https://github.com/gazmull/discord-paginationembed#readme",
- "dependencies": {
+ "peerDependencies": {
"discord.js": "discordjs/discord.js"
},
"devDependencies": {
diff --git a/src/struct/Embeds.js b/src/struct/Embeds.js
index e8ed7be..ac4fb33 100644
--- a/src/struct/Embeds.js
+++ b/src/struct/Embeds.js
@@ -72,6 +72,7 @@ class Embeds extends PaginationEmbed {
/**
* The thumbnail of all embeds.
+ * @type {string}
*/
this.thumbnail = options.thumbnail || null;
@@ -96,7 +97,7 @@ class Embeds extends PaginationEmbed {
/**
* Embed in the current page.
- * @returns {MessageEmbed} - An instance of MessageEmbed.
+ * @type {MessageEmbed}
*/
get currentEmbed() {
return this.array[this.page - 1];
@@ -105,7 +106,7 @@ class Embeds extends PaginationEmbed {
/**
* Adds a blank field to the fields of all embeds.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addBlankField(inline = false) {
const arr = this.array;
@@ -121,7 +122,7 @@ class Embeds extends PaginationEmbed {
* @param {string} name - The name of the field.
* @param {string} value - The value of the field.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addField(name, value, inline = false) {
if (!name && !value) return this;
@@ -140,12 +141,12 @@ class Embeds extends PaginationEmbed {
* @example
*
* // Object as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -169,12 +170,12 @@ class Embeds extends PaginationEmbed {
* @example
*
* // Methods as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -230,7 +231,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the array of embeds to paginate.
* @param {Array} array - An array of embeds to paginate.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -251,7 +252,7 @@ class Embeds extends PaginationEmbed {
* @param {StringResolvable} name - The name of the author.
* @param {string} [iconURL=null] - The icon URL of the author.
* @param {string} [url=null] - The URL of the author.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setAuthor(name, iconURL = null, url = null) {
if (!name) return this;
@@ -267,7 +268,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the color of all embeds.
* @param {ColorResolvable} color - The color of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setColor(color) {
if (!color) return this;
@@ -283,7 +284,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the description of all embeds.
* @param {string} description - The description of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setDescription(description) {
if (!description) return this;
@@ -300,7 +301,7 @@ class Embeds extends PaginationEmbed {
* Sets the footer of all embeds.
* @param {string} text - The footer text.
* @param {string} [iconURL=null] - URL for the footer's icon.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setFooter(text, iconURL = null) {
if (!text) return this;
@@ -316,7 +317,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the image of all embeds.
* @param {string} image - The image of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setImage(image) {
if (!image) return this;
@@ -332,7 +333,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the thumbnail of all embeds.
* @param {string} thumbnail - The thumbnail of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setThumbnail(thumbnail) {
if (!thumbnail) return this;
@@ -347,7 +348,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the timestamp of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTimestamp() {
const arr = this.array;
@@ -361,7 +362,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the title of all embeds.
* @param {string} title - The title of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTitle(title) {
if (!title) return this;
@@ -377,7 +378,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the URL of all embeds.
* @param {string} url - The URL of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setURL(url) {
if (!url) return this;
diff --git a/src/struct/FieldsEmbed.js b/src/struct/FieldsEmbed.js
index 71b2281..d631b76 100644
--- a/src/struct/FieldsEmbed.js
+++ b/src/struct/FieldsEmbed.js
@@ -42,7 +42,7 @@ class FieldsEmbed extends PaginationEmbed {
/**
* Elements in the current page.
- * @returns {Array.<*>} - An array for a page.
+ * @type {Array.<*>}
*/
get elementList() {
const begin = (this.page - 1) * this.elementsPerPage;
@@ -57,11 +57,11 @@ class FieldsEmbed extends PaginationEmbed {
* @example
*
* // Object as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -87,11 +87,11 @@ class FieldsEmbed extends PaginationEmbed {
* @example
*
* // Methods as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -146,7 +146,7 @@ class FieldsEmbed extends PaginationEmbed {
* @param {string} name - Name of the field.
* @param {Function} value - Value of the field. Function for Array.prototype.map().join('\n').
* @param {boolean} [inline=true] - Whether the field is inline with other field or not.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @returns {PaginationEmbed}
*/
formatField(name, value, inline = true) {
this.fields.push({ name, value, inline });
@@ -156,10 +156,10 @@ class FieldsEmbed extends PaginationEmbed {
/**
* Sets the maximum number of elements to be displayed per page.
- * @param {number} [number=10] - Maximum number of elements to be displayed per page.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @param {number} number - Maximum number of elements to be displayed per page.
+ * @returns {PaginationEmbed}
*/
- setElementsPerPage(number = 10) {
+ setElementsPerPage(number) {
if (typeof number !== 'number') throw new Error('setElementsPerPage() only accepts number type.');
this.elementsPerPage = number;
diff --git a/src/struct/base/PaginationEmbed.js b/src/struct/base/PaginationEmbed.js
index 11a5a9f..9f9ec45 100644
--- a/src/struct/base/PaginationEmbed.js
+++ b/src/struct/base/PaginationEmbed.js
@@ -24,7 +24,7 @@ class PaginationEmbed extends MessageEmbed {
/**
* Options for the constructor.
* @typedef {Object} PaginationEmbedOptions
- * @property {User} [authorisedUser=null] - The authorised user to navigate the pages.
+ * @property {User} [authorizedUser=null] - The authorized user to navigate the pages.
* @property {TextChannel} channel - The channel where to send the embed.
* @property {ClientMessageOptions} [clientMessage=null] - Settings for the message sent by the client.
* @property {Array.<*>} array - An array of elements to paginate.
@@ -43,10 +43,10 @@ class PaginationEmbed extends MessageEmbed {
super(options);
/**
- * The authorised user to navigate the pages.
+ * The authorized user to navigate the pages.
* @type {User}
*/
- this.authorisedUser = options.authorisedUser || null;
+ this.authorizedUser = options.authorizedUser || null;
/**
* The channel where to send the embed.
@@ -110,7 +110,7 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the array of elements to paginate.
* @param {Array} array - An array of elements to paginate.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -123,12 +123,12 @@ class PaginationEmbed extends MessageEmbed {
}
/**
- * Set the authorised person to navigate the pages.
- * @param {User} [user=null] - The user object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * Set the authorized person to navigate the pages.
+ * @param {User} user - The user object.
+ * @returns {PaginationEmbed}
*/
- setAuthorisedUser(user = null) {
- this.authorisedUser = user;
+ setAuthorizedUser(user) {
+ this.authorizedUser = user;
return this;
}
@@ -136,7 +136,7 @@ class PaginationEmbed extends MessageEmbed {
/**
* The channel where to send the embed.
* @param {TextChannel} channel - The channel object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setChannel(channel) {
this.channel = channel;
@@ -146,11 +146,11 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the settings for the message sent by the client.
- * @param {Message} [message=null] - The message object sent by the client, if there is any.
+ * @param {Message} message - The message object sent by the client.
* @param {string} [content='Preparing...'] - The custom message content while preparing the embed.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
- setClientMessage(message = null, content = null) {
+ setClientMessage(message, content = null) {
if (!content) content = 'Preparing...';
Object.assign(this.clientMessage, { message, content });
@@ -160,8 +160,8 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the emojis used for navigation buttons.
- * @param {NavigationButtons} [emojis={}] - An object containing customised emojis to use as navigation buttons.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {NavigationButtons} emojis - An object containing customised emojis to use as navigation buttons.
+ * @returns {PaginationEmbed}
*/
setEmojis(emojis) {
Object.assign(this.emojis, emojis);
@@ -171,10 +171,10 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets to jump to a certain page upon calling PaginationEmbed.build().
- * @param {number|string} [param=1] - The page number to jump to. As String: 'back', 'forward'
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number|string} param - The page number to jump to. As String: 'back', 'forward'
+ * @returns {PaginationEmbed}
*/
- setPage(param = 1) {
+ setPage(param) {
const isString = typeof param === 'string';
if (!(!isNaN(param) || isString)) throw new Error('setPage() only accepts number/string type.');
@@ -190,10 +190,10 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the time for awaiting a user action before timeout in ms.
- * @param {number} [timeout=30000] Timeout value in ms.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number} timeout Timeout value in ms.
+ * @returns {PaginationEmbed}
*/
- setTimeout(timeout = 30000) {
+ setTimeout(timeout) {
if (typeof timeout !== 'number') throw new Error('setTimeout() only accepts number type.');
this.timeout = timeout;
@@ -203,10 +203,10 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets whether page number indicator on client's message is shown or not.
- * @param {boolean} [boolean=true] - Show page indicator?
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {boolean} boolean - Show page indicator?
+ * @returns {PaginationEmbed}
*/
- showPageIndicator(boolean = true) {
+ showPageIndicator(boolean) {
if (typeof boolean !== 'boolean') throw new Error('showPageIndicator() only accepts boolean type.');
this.pageIndicator = boolean;
@@ -222,7 +222,7 @@ class PaginationEmbed extends MessageEmbed {
async _verify(pages) {
this
.setChannel(this.channel)
- .setAuthorisedUser(this.authorisedUser)
+ .setAuthorizedUser(this.authorizedUser)
.setClientMessage(this.clientMessage.message, this.clientMessage.content)
.setArray(this.array)
.showPageIndicator(this.pageIndicator)
@@ -298,8 +298,8 @@ class PaginationEmbed extends MessageEmbed {
async _awaitResponse() {
const emojis = Object.values(this.emojis);
const filter = (r, u) => {
- if (this.authorisedUser)
- return u.id === this.authorisedUser.id && emojis.includes(r.emoji.name);
+ if (this.authorizedUser)
+ return u.id === this.authorizedUser.id && emojis.includes(r.emoji.name);
return !u.bot && emojis.includes(r.emoji.name);
};
currentEm
+ Type:
+
+ -
+
+MessageEmbed
+
+
+
+
+
@@ -982,7 +992,7 @@ footerSource:
@@ -1055,7 +1065,7 @@ imageSource:
@@ -1276,7 +1286,7 @@ Type:
-thumbnail
+thumbnail :string
@@ -1287,7 +1297,7 @@ thumbnailSource:
@@ -1332,6 +1342,16 @@ thumbnailType:
+
+ -
+
+string
+
+
+
+
+
@@ -1645,7 +1665,7 @@ Methods
- addBlankField(inlineopt) → {Embeds}
+ addBlankField(inlineopt) → {PaginationEmbed}
@@ -1657,7 +1677,7 @@ addBlank
Source:
@@ -1794,10 +1814,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -1806,7 +1822,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -1820,7 +1836,7 @@ Returns:
- addField(name, value, inlineopt) → {Embeds}
+ addField(name, value, inlineopt) → {PaginationEmbed}
@@ -1832,7 +1848,7 @@ addFieldSource:
@@ -2039,10 +2055,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -2051,7 +2063,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -2077,7 +2089,7 @@ (async) buildSource:
@@ -2130,9 +2142,9 @@ (async) buildExamples
- // Object as constructor.
const Embeds = require('discord-paginationembed').Embeds;
const { MessageEmbed } = require('discord.js');
// Under message event.
new Embeds({
authorisedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
new MessageEmbed({ title: 'John Doe' }),
new MessageEmbed({ title: 'Jane Doe' })
],
pageIndicator: false,
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
},
description: 'This is one of my embeds with this message!',
color: 0xFF00AE,
timestamp: true
}).build();
+ // Object as constructor.
const { Embeds } = require('discord-paginationembed');
const { MessageEmbed } = require('discord.js');
// Under message event.
new Embeds({
authorizedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
new MessageEmbed({ title: 'John Doe' }),
new MessageEmbed({ title: 'Jane Doe' })
],
pageIndicator: false,
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
},
description: 'This is one of my embeds with this message!',
color: 0xFF00AE,
timestamp: true
}).build();
- // Methods as constructor.
const Embeds = require('discord-paginationembed').Embeds;
const { MessageEmbed } = require('discord.js');
// Under message event.
new Embeds()
.setAuthorisedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
new MessageEmbed({ title: 'John Doe' }),
new MessageEmbed({ title: 'Jane Doe' })
])
.setPageIndicator(false)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.setDescription('This is one of my embeds with this message!')
.setColor(0xFF00AE)
.setTimestamp()
.build();
+ // Methods as constructor.
const { Embeds } = require('discord-paginationembed');
const { MessageEmbed } = require('discord.js');
// Under message event.
new Embeds()
.setAuthorizedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
new MessageEmbed({ title: 'John Doe' }),
new MessageEmbed({ title: 'Jane Doe' })
])
.setPageIndicator(false)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.setDescription('This is one of my embeds with this message!')
.setColor(0xFF00AE)
.setTimestamp()
.build();
@@ -2156,7 +2168,7 @@ Examples
- setArray(array) → {Embeds}
+ setArray(array) → {PaginationEmbed}
@@ -2168,7 +2180,7 @@ setArraySource:
@@ -2290,10 +2302,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -2302,7 +2310,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -2316,7 +2324,7 @@ Returns:
- setAuthor(name, iconURLopt, urlopt) → {Embeds}
+ setAuthor(name, iconURLopt, urlopt) → {PaginationEmbed}
@@ -2328,7 +2336,7 @@ setAuthorSource:
@@ -2539,10 +2547,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -2551,7 +2555,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -2565,7 +2569,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -2588,7 +2592,7 @@ setA
- Inherited From:
@@ -2622,7 +2626,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -2648,12 +2652,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2677,23 +2677,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -2719,10 +2703,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2879,10 +2859,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2905,7 +2881,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -3019,8 +2995,6 @@ Parameters:
- <optional>
-
@@ -3031,12 +3005,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -3098,10 +3070,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -3124,7 +3092,7 @@ Returns:
- setColor(color) → {Embeds}
+ setColor(color) → {PaginationEmbed}
@@ -3136,7 +3104,7 @@ setColorSource:
@@ -3253,10 +3221,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3265,7 +3229,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3279,7 +3243,7 @@ Returns:
- setDescription(description) → {Embeds}
+ setDescription(description) → {PaginationEmbed}
@@ -3291,7 +3255,7 @@ setDesc
- Source:
@@ -3408,10 +3372,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3420,7 +3380,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3434,7 +3394,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -3517,12 +3477,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -3546,23 +3502,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -3588,10 +3528,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -3614,7 +3550,7 @@ Returns:
- setFooter(text, iconURLopt) → {Embeds}
+ setFooter(text, iconURLopt) → {PaginationEmbed}
@@ -3626,7 +3562,7 @@ setFooterSource:
@@ -3798,10 +3734,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3810,7 +3742,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3824,7 +3756,7 @@ Returns:
- setImage(image) → {Embeds}
+ setImage(image) → {PaginationEmbed}
@@ -3836,7 +3768,7 @@ setImageSource:
@@ -3953,10 +3885,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3965,7 +3893,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3979,7 +3907,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -4062,12 +3990,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -4094,23 +4018,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -4136,10 +4044,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -4162,7 +4066,7 @@ Returns:
- setThumbnail(thumbnail) → {Embeds}
+ setThumbnail(thumbnail) → {PaginationEmbed}
@@ -4174,7 +4078,7 @@ setThumbn
- Source:
@@ -4291,10 +4195,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4303,7 +4203,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4317,7 +4217,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -4400,12 +4300,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -4429,23 +4325,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -4471,10 +4351,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -4497,7 +4373,7 @@ Returns:
- setTimestamp() → {Embeds}
+ setTimestamp() → {PaginationEmbed}
@@ -4509,7 +4385,7 @@ setTimest
- Source:
@@ -4577,10 +4453,6 @@ setTimest
Returns:
-
- - Instance of Embeds
-
-
@@ -4589,7 +4461,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4603,7 +4475,7 @@ Returns:
- setTitle(title) → {Embeds}
+ setTitle(title) → {PaginationEmbed}
@@ -4615,7 +4487,7 @@ setTitleSource:
@@ -4732,10 +4604,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4744,7 +4612,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4758,7 +4626,7 @@ Returns:
- setURL(url) → {Embeds}
+ setURL(url) → {PaginationEmbed}
@@ -4770,7 +4638,7 @@ setURLSource:
@@ -4887,10 +4755,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4899,7 +4763,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4913,7 +4777,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -4996,12 +4860,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -5025,23 +4885,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- true
-
-
Show page indicator?
@@ -5067,10 +4911,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -5106,7 +4946,7 @@ Returns:
diff --git a/docs/Embeds.js.html b/docs/Embeds.js.html
index 637f285..ba6e1c4 100644
--- a/docs/Embeds.js.html
+++ b/docs/Embeds.js.html
@@ -22,7 +22,7 @@
@@ -111,6 +111,7 @@ Embeds.js
/**
* The thumbnail of all embeds.
+ * @type {string}
*/
this.thumbnail = options.thumbnail || null;
@@ -135,7 +136,7 @@ Embeds.js
/**
* Embed in the current page.
- * @returns {MessageEmbed} - An instance of MessageEmbed.
+ * @type {MessageEmbed}
*/
get currentEmbed() {
return this.array[this.page - 1];
@@ -144,7 +145,7 @@ Embeds.js
/**
* Adds a blank field to the fields of all embeds.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addBlankField(inline = false) {
const arr = this.array;
@@ -160,7 +161,7 @@ Embeds.js
* @param {string} name - The name of the field.
* @param {string} value - The value of the field.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addField(name, value, inline = false) {
if (!name && !value) return this;
@@ -179,12 +180,12 @@ Embeds.js
* @example
*
* // Object as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -208,12 +209,12 @@ Embeds.js
* @example
*
* // Methods as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -269,7 +270,7 @@ Embeds.js
/**
* Sets the array of embeds to paginate.
* @param {Array} array - An array of embeds to paginate.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -290,7 +291,7 @@ Embeds.js
* @param {StringResolvable} name - The name of the author.
* @param {string} [iconURL=null] - The icon URL of the author.
* @param {string} [url=null] - The URL of the author.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setAuthor(name, iconURL = null, url = null) {
if (!name) return this;
@@ -306,7 +307,7 @@ Embeds.js
/**
* Sets the color of all embeds.
* @param {ColorResolvable} color - The color of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setColor(color) {
if (!color) return this;
@@ -322,7 +323,7 @@ Embeds.js
/**
* Sets the description of all embeds.
* @param {string} description - The description of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setDescription(description) {
if (!description) return this;
@@ -339,7 +340,7 @@ Embeds.js
* Sets the footer of all embeds.
* @param {string} text - The footer text.
* @param {string} [iconURL=null] - URL for the footer's icon.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setFooter(text, iconURL = null) {
if (!text) return this;
@@ -355,7 +356,7 @@ Embeds.js
/**
* Sets the image of all embeds.
* @param {string} image - The image of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setImage(image) {
if (!image) return this;
@@ -371,7 +372,7 @@ Embeds.js
/**
* Sets the thumbnail of all embeds.
* @param {string} thumbnail - The thumbnail of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setThumbnail(thumbnail) {
if (!thumbnail) return this;
@@ -386,7 +387,7 @@ Embeds.js
/**
* Sets the timestamp of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTimestamp() {
const arr = this.array;
@@ -400,7 +401,7 @@ Embeds.js
/**
* Sets the title of all embeds.
* @param {string} title - The title of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTitle(title) {
if (!title) return this;
@@ -416,7 +417,7 @@ Embeds.js
/**
* Sets the URL of all embeds.
* @param {string} url - The URL of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setURL(url) {
if (!url) return this;
@@ -455,7 +456,7 @@ Embeds.js
diff --git a/docs/FieldsEmbed.html b/docs/FieldsEmbed.html
index 948c77a..e3a7000 100644
--- a/docs/FieldsEmbed.html
+++ b/docs/FieldsEmbed.html
@@ -22,7 +22,7 @@
@@ -304,7 +304,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -326,7 +326,7 @@ authori
- Inherited From:
@@ -360,7 +360,7 @@ authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -538,7 +538,7 @@ Type:
-elementList
+elementList :Array.<*>
@@ -594,6 +594,16 @@ elementLis
+ Type:
+
+ -
+
+Array.<*>
+
+
+
+
+
@@ -1063,9 +1073,9 @@ (async) buildExamples
- // Object as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed({
authorisedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
+ // Object as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed({
authorizedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
- // Methods as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed()
.setAuthorisedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
+ // Methods as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed()
.setAuthorizedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
@@ -1089,7 +1099,7 @@ Examples
- formatField(name, value, inlineopt) → {FieldsEmbed}
+ formatField(name, value, inlineopt) → {PaginationEmbed}
@@ -1308,10 +1318,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -1320,7 +1326,7 @@ Returns:
-
-FieldsEmbed
+PaginationEmbed
@@ -1468,10 +1474,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1494,7 +1496,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1517,7 +1519,7 @@ setA
- Inherited From:
@@ -1551,7 +1553,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1577,12 +1579,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1606,23 +1604,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1648,10 +1630,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1808,10 +1786,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1834,7 +1808,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1948,8 +1922,6 @@ Parameters:
- <optional>
-
@@ -1960,12 +1932,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -2027,10 +1997,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2053,7 +2019,7 @@ Returns:
- setElementsPerPage(numberopt) → {FieldsEmbed}
+ setElementsPerPage(number) → {PaginationEmbed}
@@ -2131,12 +2097,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2160,24 +2122,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 10
-
-
-
Maximum number of elements to be displayed per page.
@@ -2202,10 +2148,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -2214,7 +2156,7 @@ Returns:
-
-FieldsEmbed
+PaginationEmbed
@@ -2228,7 +2170,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -2311,12 +2253,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2340,23 +2278,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -2382,10 +2304,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2408,7 +2326,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -2491,12 +2409,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2523,24 +2437,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 1
-
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -2565,10 +2463,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2591,7 +2485,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -2674,12 +2568,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2703,23 +2593,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2745,10 +2619,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2771,7 +2641,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2854,12 +2724,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2883,24 +2749,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2925,10 +2775,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2964,7 +2810,7 @@ Returns:
diff --git a/docs/FieldsEmbed.js.html b/docs/FieldsEmbed.js.html
index 5d36097..9bad270 100644
--- a/docs/FieldsEmbed.js.html
+++ b/docs/FieldsEmbed.js.html
@@ -22,7 +22,7 @@
@@ -81,7 +81,7 @@ FieldsEmbed.js
/**
* Elements in the current page.
- * @returns {Array.<*>} - An array for a page.
+ * @type {Array.<*>}
*/
get elementList() {
const begin = (this.page - 1) * this.elementsPerPage;
@@ -96,11 +96,11 @@ FieldsEmbed.js
* @example
*
* // Object as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -126,11 +126,11 @@ FieldsEmbed.js
* @example
*
* // Methods as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -185,7 +185,7 @@ FieldsEmbed.js
* @param {string} name - Name of the field.
* @param {Function} value - Value of the field. Function for Array.prototype.map().join('\n').
* @param {boolean} [inline=true] - Whether the field is inline with other field or not.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @returns {PaginationEmbed}
*/
formatField(name, value, inline = true) {
this.fields.push({ name, value, inline });
@@ -195,10 +195,10 @@ FieldsEmbed.js
/**
* Sets the maximum number of elements to be displayed per page.
- * @param {number} [number=10] - Maximum number of elements to be displayed per page.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @param {number} number - Maximum number of elements to be displayed per page.
+ * @returns {PaginationEmbed}
*/
- setElementsPerPage(number = 10) {
+ setElementsPerPage(number) {
if (typeof number !== 'number') throw new Error('setElementsPerPage() only accepts number type.');
this.elementsPerPage = number;
@@ -266,7 +266,7 @@ FieldsEmbed.js
diff --git a/docs/PaginationEmbed.html b/docs/PaginationEmbed.html
index 58d735a..994485d 100644
--- a/docs/PaginationEmbed.html
+++ b/docs/PaginationEmbed.html
@@ -22,7 +22,7 @@
@@ -299,7 +299,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -350,7 +350,7 @@ authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -951,10 +951,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -977,7 +973,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1029,7 +1025,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1055,12 +1051,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1084,23 +1076,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1126,10 +1102,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1281,10 +1253,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1307,7 +1275,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1416,8 +1384,6 @@ Parameters:
- <optional>
-
@@ -1428,12 +1394,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -1495,10 +1459,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1521,7 +1481,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -1599,12 +1559,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1628,23 +1584,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -1670,10 +1610,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1696,7 +1632,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -1774,12 +1710,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1806,23 +1738,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -1848,10 +1764,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1874,7 +1786,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -1952,12 +1864,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1981,23 +1889,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2023,10 +1915,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2049,7 +1937,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2127,12 +2015,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2156,24 +2040,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2198,10 +2066,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2237,7 +2101,7 @@ Returns:
diff --git a/docs/base_PaginationEmbed.js.html b/docs/base_PaginationEmbed.js.html
index c40af28..e74e322 100644
--- a/docs/base_PaginationEmbed.js.html
+++ b/docs/base_PaginationEmbed.js.html
@@ -22,7 +22,7 @@
@@ -63,7 +63,7 @@ base/PaginationEmbed.js
/**
* Options for the constructor.
* @typedef {Object} PaginationEmbedOptions
- * @property {User} [authorisedUser=null] - The authorised user to navigate the pages.
+ * @property {User} [authorizedUser=null] - The authorized user to navigate the pages.
* @property {TextChannel} channel - The channel where to send the embed.
* @property {ClientMessageOptions} [clientMessage=null] - Settings for the message sent by the client.
* @property {Array.<*>} array - An array of elements to paginate.
@@ -82,10 +82,10 @@ base/PaginationEmbed.js
super(options);
/**
- * The authorised user to navigate the pages.
+ * The authorized user to navigate the pages.
* @type {User}
*/
- this.authorisedUser = options.authorisedUser || null;
+ this.authorizedUser = options.authorizedUser || null;
/**
* The channel where to send the embed.
@@ -149,7 +149,7 @@ base/PaginationEmbed.js
/**
* Sets the array of elements to paginate.
* @param {Array} array - An array of elements to paginate.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -162,12 +162,12 @@ base/PaginationEmbed.js
}
/**
- * Set the authorised person to navigate the pages.
- * @param {User} [user=null] - The user object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * Set the authorized person to navigate the pages.
+ * @param {User} user - The user object.
+ * @returns {PaginationEmbed}
*/
- setAuthorisedUser(user = null) {
- this.authorisedUser = user;
+ setAuthorizedUser(user) {
+ this.authorizedUser = user;
return this;
}
@@ -175,7 +175,7 @@ base/PaginationEmbed.js
/**
* The channel where to send the embed.
* @param {TextChannel} channel - The channel object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setChannel(channel) {
this.channel = channel;
@@ -185,11 +185,11 @@ base/PaginationEmbed.js
/**
* Sets the settings for the message sent by the client.
- * @param {Message} [message=null] - The message object sent by the client, if there is any.
+ * @param {Message} message - The message object sent by the client.
* @param {string} [content='Preparing...'] - The custom message content while preparing the embed.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
- setClientMessage(message = null, content = null) {
+ setClientMessage(message, content = null) {
if (!content) content = 'Preparing...';
Object.assign(this.clientMessage, { message, content });
@@ -199,8 +199,8 @@ base/PaginationEmbed.js
/**
* Sets the emojis used for navigation buttons.
- * @param {NavigationButtons} [emojis={}] - An object containing customised emojis to use as navigation buttons.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {NavigationButtons} emojis - An object containing customised emojis to use as navigation buttons.
+ * @returns {PaginationEmbed}
*/
setEmojis(emojis) {
Object.assign(this.emojis, emojis);
@@ -210,10 +210,10 @@ base/PaginationEmbed.js
/**
* Sets to jump to a certain page upon calling PaginationEmbed.build().
- * @param {number|string} [param=1] - The page number to jump to. As String: 'back', 'forward'
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number|string} param - The page number to jump to. As String: 'back', 'forward'
+ * @returns {PaginationEmbed}
*/
- setPage(param = 1) {
+ setPage(param) {
const isString = typeof param === 'string';
if (!(!isNaN(param) || isString)) throw new Error('setPage() only accepts number/string type.');
@@ -229,10 +229,10 @@ base/PaginationEmbed.js
/**
* Sets the time for awaiting a user action before timeout in ms.
- * @param {number} [timeout=30000] Timeout value in ms.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number} timeout Timeout value in ms.
+ * @returns {PaginationEmbed}
*/
- setTimeout(timeout = 30000) {
+ setTimeout(timeout) {
if (typeof timeout !== 'number') throw new Error('setTimeout() only accepts number type.');
this.timeout = timeout;
@@ -242,10 +242,10 @@ base/PaginationEmbed.js
/**
* Sets whether page number indicator on client's message is shown or not.
- * @param {boolean} [boolean=true] - Show page indicator?
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {boolean} boolean - Show page indicator?
+ * @returns {PaginationEmbed}
*/
- showPageIndicator(boolean = true) {
+ showPageIndicator(boolean) {
if (typeof boolean !== 'boolean') throw new Error('showPageIndicator() only accepts boolean type.');
this.pageIndicator = boolean;
@@ -261,7 +261,7 @@ base/PaginationEmbed.js
async _verify(pages) {
this
.setChannel(this.channel)
- .setAuthorisedUser(this.authorisedUser)
+ .setAuthorizedUser(this.authorizedUser)
.setClientMessage(this.clientMessage.message, this.clientMessage.content)
.setArray(this.array)
.showPageIndicator(this.pageIndicator)
@@ -337,8 +337,8 @@ base/PaginationEmbed.js
async _awaitResponse() {
const emojis = Object.values(this.emojis);
const filter = (r, u) => {
- if (this.authorisedUser)
- return u.id === this.authorisedUser.id && emojis.includes(r.emoji.name);
+ if (this.authorizedUser)
+ return u.id === this.authorizedUser.id && emojis.includes(r.emoji.name);
return !u.bot && emojis.includes(r.emoji.name);
};
@@ -432,7 +432,7 @@ base/PaginationEmbed.js
diff --git a/docs/global.html b/docs/global.html
index 23000ba..3f7e34b 100644
--- a/docs/global.html
+++ b/docs/global.html
@@ -22,7 +22,7 @@
@@ -1487,7 +1487,7 @@ Properties:
- authorisedUser
+ authorizedUser
@@ -1517,7 +1517,7 @@ Properties:
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -1820,7 +1820,7 @@ Type:
diff --git a/docs/index.html b/docs/index.html
index 80eb8c4..c53f893 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -22,7 +22,7 @@
@@ -51,20 +51,21 @@ Home
Classes
const FieldsEmbedMode = require('discord-paginationembed').FieldsEmbed;
+const { FieldsEmbed: FieldsEmbedMode } = require('discord-paginationembed');
new FieldsEmbedMode()
.setArray([ { name: "John Doe" }, { name: "Jane Doe" } ])
- .setAuthorisedUser(message.author)
+ .setAuthorizedUser(message.author)
.setChannel(message.channel)
.setElementsPerPage(1)
.setPage(2)
.showPageIndicator(false)
- .build();
const EmbedsMode = require('discord-paginationembed').Embeds;
+ .build();
const { Embeds: EmbedsMode } = require('discord-paginationembed');
const { MessageEmbed } = require("discord.js");
const embeds = [];
@@ -76,7 +77,7 @@ Under message
event
new EmbedsMode()
.setArray(embeds)
- .setAuthorisedUser(message.author)
+ .setAuthorizedUser(message.author)
.setChannel(message.channel)
.showPageIndicator(true)
.setPage(3)
@@ -99,7 +100,7 @@ Contributing
- Fork this repository.
- Execute
npm install
- Code and code and code and code and... code!
-npm test
to verify your additions/adjustments are following ESLint's rules and verify docs are valid.
+npm test
to verify if your additions/adjustments are following ESLint's rules and to verify if the docs are valid.
- File a Pull Request!
License
MIT
@@ -115,7 +116,7 @@ License
MIT
diff --git a/package.json b/package.json
index f30a2be..44c632d 100644
--- a/package.json
+++ b/package.json
@@ -1,11 +1,11 @@
{
"name": "discord-paginationembed",
- "version": "0.1.0",
+ "version": "0.2.0",
"description": "Pagination Embed for Discord.JS",
"main": "./src/index.js",
"scripts": {
- "test": "eslint --ignore-path .eslintignore . && npm run generate-docs",
- "generate-docs": "jsdoc -c jsdoc.json"
+ "test": "eslint ./src && npm run docs",
+ "docs": "node_modules/.bin/jsdoc -c .jsdoc.json"
},
"repository": {
"type": "git",
@@ -27,7 +27,7 @@
"url": "https://github.com/gazmull/discord-paginationembed/issues"
},
"homepage": "https://github.com/gazmull/discord-paginationembed#readme",
- "dependencies": {
+ "peerDependencies": {
"discord.js": "discordjs/discord.js"
},
"devDependencies": {
diff --git a/src/struct/Embeds.js b/src/struct/Embeds.js
index e8ed7be..ac4fb33 100644
--- a/src/struct/Embeds.js
+++ b/src/struct/Embeds.js
@@ -72,6 +72,7 @@ class Embeds extends PaginationEmbed {
/**
* The thumbnail of all embeds.
+ * @type {string}
*/
this.thumbnail = options.thumbnail || null;
@@ -96,7 +97,7 @@ class Embeds extends PaginationEmbed {
/**
* Embed in the current page.
- * @returns {MessageEmbed} - An instance of MessageEmbed.
+ * @type {MessageEmbed}
*/
get currentEmbed() {
return this.array[this.page - 1];
@@ -105,7 +106,7 @@ class Embeds extends PaginationEmbed {
/**
* Adds a blank field to the fields of all embeds.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addBlankField(inline = false) {
const arr = this.array;
@@ -121,7 +122,7 @@ class Embeds extends PaginationEmbed {
* @param {string} name - The name of the field.
* @param {string} value - The value of the field.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addField(name, value, inline = false) {
if (!name && !value) return this;
@@ -140,12 +141,12 @@ class Embeds extends PaginationEmbed {
* @example
*
* // Object as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -169,12 +170,12 @@ class Embeds extends PaginationEmbed {
* @example
*
* // Methods as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -230,7 +231,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the array of embeds to paginate.
* @param {Array} array - An array of embeds to paginate.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -251,7 +252,7 @@ class Embeds extends PaginationEmbed {
* @param {StringResolvable} name - The name of the author.
* @param {string} [iconURL=null] - The icon URL of the author.
* @param {string} [url=null] - The URL of the author.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setAuthor(name, iconURL = null, url = null) {
if (!name) return this;
@@ -267,7 +268,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the color of all embeds.
* @param {ColorResolvable} color - The color of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setColor(color) {
if (!color) return this;
@@ -283,7 +284,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the description of all embeds.
* @param {string} description - The description of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setDescription(description) {
if (!description) return this;
@@ -300,7 +301,7 @@ class Embeds extends PaginationEmbed {
* Sets the footer of all embeds.
* @param {string} text - The footer text.
* @param {string} [iconURL=null] - URL for the footer's icon.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setFooter(text, iconURL = null) {
if (!text) return this;
@@ -316,7 +317,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the image of all embeds.
* @param {string} image - The image of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setImage(image) {
if (!image) return this;
@@ -332,7 +333,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the thumbnail of all embeds.
* @param {string} thumbnail - The thumbnail of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setThumbnail(thumbnail) {
if (!thumbnail) return this;
@@ -347,7 +348,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the timestamp of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTimestamp() {
const arr = this.array;
@@ -361,7 +362,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the title of all embeds.
* @param {string} title - The title of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTitle(title) {
if (!title) return this;
@@ -377,7 +378,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the URL of all embeds.
* @param {string} url - The URL of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setURL(url) {
if (!url) return this;
diff --git a/src/struct/FieldsEmbed.js b/src/struct/FieldsEmbed.js
index 71b2281..d631b76 100644
--- a/src/struct/FieldsEmbed.js
+++ b/src/struct/FieldsEmbed.js
@@ -42,7 +42,7 @@ class FieldsEmbed extends PaginationEmbed {
/**
* Elements in the current page.
- * @returns {Array.<*>} - An array for a page.
+ * @type {Array.<*>}
*/
get elementList() {
const begin = (this.page - 1) * this.elementsPerPage;
@@ -57,11 +57,11 @@ class FieldsEmbed extends PaginationEmbed {
* @example
*
* // Object as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -87,11 +87,11 @@ class FieldsEmbed extends PaginationEmbed {
* @example
*
* // Methods as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -146,7 +146,7 @@ class FieldsEmbed extends PaginationEmbed {
* @param {string} name - Name of the field.
* @param {Function} value - Value of the field. Function for Array.prototype.map().join('\n').
* @param {boolean} [inline=true] - Whether the field is inline with other field or not.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @returns {PaginationEmbed}
*/
formatField(name, value, inline = true) {
this.fields.push({ name, value, inline });
@@ -156,10 +156,10 @@ class FieldsEmbed extends PaginationEmbed {
/**
* Sets the maximum number of elements to be displayed per page.
- * @param {number} [number=10] - Maximum number of elements to be displayed per page.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @param {number} number - Maximum number of elements to be displayed per page.
+ * @returns {PaginationEmbed}
*/
- setElementsPerPage(number = 10) {
+ setElementsPerPage(number) {
if (typeof number !== 'number') throw new Error('setElementsPerPage() only accepts number type.');
this.elementsPerPage = number;
diff --git a/src/struct/base/PaginationEmbed.js b/src/struct/base/PaginationEmbed.js
index 11a5a9f..9f9ec45 100644
--- a/src/struct/base/PaginationEmbed.js
+++ b/src/struct/base/PaginationEmbed.js
@@ -24,7 +24,7 @@ class PaginationEmbed extends MessageEmbed {
/**
* Options for the constructor.
* @typedef {Object} PaginationEmbedOptions
- * @property {User} [authorisedUser=null] - The authorised user to navigate the pages.
+ * @property {User} [authorizedUser=null] - The authorized user to navigate the pages.
* @property {TextChannel} channel - The channel where to send the embed.
* @property {ClientMessageOptions} [clientMessage=null] - Settings for the message sent by the client.
* @property {Array.<*>} array - An array of elements to paginate.
@@ -43,10 +43,10 @@ class PaginationEmbed extends MessageEmbed {
super(options);
/**
- * The authorised user to navigate the pages.
+ * The authorized user to navigate the pages.
* @type {User}
*/
- this.authorisedUser = options.authorisedUser || null;
+ this.authorizedUser = options.authorizedUser || null;
/**
* The channel where to send the embed.
@@ -110,7 +110,7 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the array of elements to paginate.
* @param {Array} array - An array of elements to paginate.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -123,12 +123,12 @@ class PaginationEmbed extends MessageEmbed {
}
/**
- * Set the authorised person to navigate the pages.
- * @param {User} [user=null] - The user object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * Set the authorized person to navigate the pages.
+ * @param {User} user - The user object.
+ * @returns {PaginationEmbed}
*/
- setAuthorisedUser(user = null) {
- this.authorisedUser = user;
+ setAuthorizedUser(user) {
+ this.authorizedUser = user;
return this;
}
@@ -136,7 +136,7 @@ class PaginationEmbed extends MessageEmbed {
/**
* The channel where to send the embed.
* @param {TextChannel} channel - The channel object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setChannel(channel) {
this.channel = channel;
@@ -146,11 +146,11 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the settings for the message sent by the client.
- * @param {Message} [message=null] - The message object sent by the client, if there is any.
+ * @param {Message} message - The message object sent by the client.
* @param {string} [content='Preparing...'] - The custom message content while preparing the embed.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
- setClientMessage(message = null, content = null) {
+ setClientMessage(message, content = null) {
if (!content) content = 'Preparing...';
Object.assign(this.clientMessage, { message, content });
@@ -160,8 +160,8 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the emojis used for navigation buttons.
- * @param {NavigationButtons} [emojis={}] - An object containing customised emojis to use as navigation buttons.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {NavigationButtons} emojis - An object containing customised emojis to use as navigation buttons.
+ * @returns {PaginationEmbed}
*/
setEmojis(emojis) {
Object.assign(this.emojis, emojis);
@@ -171,10 +171,10 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets to jump to a certain page upon calling PaginationEmbed.build().
- * @param {number|string} [param=1] - The page number to jump to. As String: 'back', 'forward'
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number|string} param - The page number to jump to. As String: 'back', 'forward'
+ * @returns {PaginationEmbed}
*/
- setPage(param = 1) {
+ setPage(param) {
const isString = typeof param === 'string';
if (!(!isNaN(param) || isString)) throw new Error('setPage() only accepts number/string type.');
@@ -190,10 +190,10 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the time for awaiting a user action before timeout in ms.
- * @param {number} [timeout=30000] Timeout value in ms.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number} timeout Timeout value in ms.
+ * @returns {PaginationEmbed}
*/
- setTimeout(timeout = 30000) {
+ setTimeout(timeout) {
if (typeof timeout !== 'number') throw new Error('setTimeout() only accepts number type.');
this.timeout = timeout;
@@ -203,10 +203,10 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets whether page number indicator on client's message is shown or not.
- * @param {boolean} [boolean=true] - Show page indicator?
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {boolean} boolean - Show page indicator?
+ * @returns {PaginationEmbed}
*/
- showPageIndicator(boolean = true) {
+ showPageIndicator(boolean) {
if (typeof boolean !== 'boolean') throw new Error('showPageIndicator() only accepts boolean type.');
this.pageIndicator = boolean;
@@ -222,7 +222,7 @@ class PaginationEmbed extends MessageEmbed {
async _verify(pages) {
this
.setChannel(this.channel)
- .setAuthorisedUser(this.authorisedUser)
+ .setAuthorizedUser(this.authorizedUser)
.setClientMessage(this.clientMessage.message, this.clientMessage.content)
.setArray(this.array)
.showPageIndicator(this.pageIndicator)
@@ -298,8 +298,8 @@ class PaginationEmbed extends MessageEmbed {
async _awaitResponse() {
const emojis = Object.values(this.emojis);
const filter = (r, u) => {
- if (this.authorisedUser)
- return u.id === this.authorisedUser.id && emojis.includes(r.emoji.name);
+ if (this.authorizedUser)
+ return u.id === this.authorizedUser.id && emojis.includes(r.emoji.name);
return !u.bot && emojis.includes(r.emoji.name);
};
imageSource:
@@ -1276,7 +1286,7 @@ Type:
-thumbnail
+thumbnail :string
@@ -1287,7 +1297,7 @@ thumbnailSource:
@@ -1332,6 +1342,16 @@ thumbnailType:
+
+ -
+
+string
+
+
+
+
+
@@ -1645,7 +1665,7 @@ Methods
- addBlankField(inlineopt) → {Embeds}
+ addBlankField(inlineopt) → {PaginationEmbed}
@@ -1657,7 +1677,7 @@ addBlank
Source:
@@ -1794,10 +1814,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -1806,7 +1822,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -1820,7 +1836,7 @@ Returns:
- addField(name, value, inlineopt) → {Embeds}
+ addField(name, value, inlineopt) → {PaginationEmbed}
@@ -1832,7 +1848,7 @@ addFieldSource:
@@ -2039,10 +2055,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -2051,7 +2063,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -2077,7 +2089,7 @@ (async) buildSource:
@@ -2130,9 +2142,9 @@ (async) buildExamples
- // Object as constructor.
const Embeds = require('discord-paginationembed').Embeds;
const { MessageEmbed } = require('discord.js');
// Under message event.
new Embeds({
authorisedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
new MessageEmbed({ title: 'John Doe' }),
new MessageEmbed({ title: 'Jane Doe' })
],
pageIndicator: false,
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
},
description: 'This is one of my embeds with this message!',
color: 0xFF00AE,
timestamp: true
}).build();
+ // Object as constructor.
const { Embeds } = require('discord-paginationembed');
const { MessageEmbed } = require('discord.js');
// Under message event.
new Embeds({
authorizedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
new MessageEmbed({ title: 'John Doe' }),
new MessageEmbed({ title: 'Jane Doe' })
],
pageIndicator: false,
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
},
description: 'This is one of my embeds with this message!',
color: 0xFF00AE,
timestamp: true
}).build();
- // Methods as constructor.
const Embeds = require('discord-paginationembed').Embeds;
const { MessageEmbed } = require('discord.js');
// Under message event.
new Embeds()
.setAuthorisedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
new MessageEmbed({ title: 'John Doe' }),
new MessageEmbed({ title: 'Jane Doe' })
])
.setPageIndicator(false)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.setDescription('This is one of my embeds with this message!')
.setColor(0xFF00AE)
.setTimestamp()
.build();
+ // Methods as constructor.
const { Embeds } = require('discord-paginationembed');
const { MessageEmbed } = require('discord.js');
// Under message event.
new Embeds()
.setAuthorizedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
new MessageEmbed({ title: 'John Doe' }),
new MessageEmbed({ title: 'Jane Doe' })
])
.setPageIndicator(false)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.setDescription('This is one of my embeds with this message!')
.setColor(0xFF00AE)
.setTimestamp()
.build();
@@ -2156,7 +2168,7 @@ Examples
- setArray(array) → {Embeds}
+ setArray(array) → {PaginationEmbed}
@@ -2168,7 +2180,7 @@ setArraySource:
@@ -2290,10 +2302,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -2302,7 +2310,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -2316,7 +2324,7 @@ Returns:
- setAuthor(name, iconURLopt, urlopt) → {Embeds}
+ setAuthor(name, iconURLopt, urlopt) → {PaginationEmbed}
@@ -2328,7 +2336,7 @@ setAuthorSource:
@@ -2539,10 +2547,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -2551,7 +2555,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -2565,7 +2569,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -2588,7 +2592,7 @@ setA
- Inherited From:
@@ -2622,7 +2626,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -2648,12 +2652,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2677,23 +2677,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -2719,10 +2703,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2879,10 +2859,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2905,7 +2881,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -3019,8 +2995,6 @@ Parameters:
- <optional>
-
@@ -3031,12 +3005,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -3098,10 +3070,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -3124,7 +3092,7 @@ Returns:
- setColor(color) → {Embeds}
+ setColor(color) → {PaginationEmbed}
@@ -3136,7 +3104,7 @@ setColorSource:
@@ -3253,10 +3221,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3265,7 +3229,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3279,7 +3243,7 @@ Returns:
- setDescription(description) → {Embeds}
+ setDescription(description) → {PaginationEmbed}
@@ -3291,7 +3255,7 @@ setDesc
- Source:
@@ -3408,10 +3372,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3420,7 +3380,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3434,7 +3394,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -3517,12 +3477,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -3546,23 +3502,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -3588,10 +3528,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -3614,7 +3550,7 @@ Returns:
- setFooter(text, iconURLopt) → {Embeds}
+ setFooter(text, iconURLopt) → {PaginationEmbed}
@@ -3626,7 +3562,7 @@ setFooterSource:
@@ -3798,10 +3734,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3810,7 +3742,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3824,7 +3756,7 @@ Returns:
- setImage(image) → {Embeds}
+ setImage(image) → {PaginationEmbed}
@@ -3836,7 +3768,7 @@ setImageSource:
@@ -3953,10 +3885,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3965,7 +3893,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3979,7 +3907,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -4062,12 +3990,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -4094,23 +4018,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -4136,10 +4044,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -4162,7 +4066,7 @@ Returns:
- setThumbnail(thumbnail) → {Embeds}
+ setThumbnail(thumbnail) → {PaginationEmbed}
@@ -4174,7 +4078,7 @@ setThumbn
- Source:
@@ -4291,10 +4195,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4303,7 +4203,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4317,7 +4217,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -4400,12 +4300,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -4429,23 +4325,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -4471,10 +4351,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -4497,7 +4373,7 @@ Returns:
- setTimestamp() → {Embeds}
+ setTimestamp() → {PaginationEmbed}
@@ -4509,7 +4385,7 @@ setTimest
- Source:
@@ -4577,10 +4453,6 @@ setTimest
Returns:
-
- - Instance of Embeds
-
-
@@ -4589,7 +4461,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4603,7 +4475,7 @@ Returns:
- setTitle(title) → {Embeds}
+ setTitle(title) → {PaginationEmbed}
@@ -4615,7 +4487,7 @@ setTitleSource:
@@ -4732,10 +4604,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4744,7 +4612,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4758,7 +4626,7 @@ Returns:
- setURL(url) → {Embeds}
+ setURL(url) → {PaginationEmbed}
@@ -4770,7 +4638,7 @@ setURLSource:
@@ -4887,10 +4755,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4899,7 +4763,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4913,7 +4777,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -4996,12 +4860,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -5025,23 +4885,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- true
-
-
Show page indicator?
@@ -5067,10 +4911,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -5106,7 +4946,7 @@ Returns:
diff --git a/docs/Embeds.js.html b/docs/Embeds.js.html
index 637f285..ba6e1c4 100644
--- a/docs/Embeds.js.html
+++ b/docs/Embeds.js.html
@@ -22,7 +22,7 @@
@@ -111,6 +111,7 @@ Embeds.js
/**
* The thumbnail of all embeds.
+ * @type {string}
*/
this.thumbnail = options.thumbnail || null;
@@ -135,7 +136,7 @@ Embeds.js
/**
* Embed in the current page.
- * @returns {MessageEmbed} - An instance of MessageEmbed.
+ * @type {MessageEmbed}
*/
get currentEmbed() {
return this.array[this.page - 1];
@@ -144,7 +145,7 @@ Embeds.js
/**
* Adds a blank field to the fields of all embeds.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addBlankField(inline = false) {
const arr = this.array;
@@ -160,7 +161,7 @@ Embeds.js
* @param {string} name - The name of the field.
* @param {string} value - The value of the field.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addField(name, value, inline = false) {
if (!name && !value) return this;
@@ -179,12 +180,12 @@ Embeds.js
* @example
*
* // Object as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -208,12 +209,12 @@ Embeds.js
* @example
*
* // Methods as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -269,7 +270,7 @@ Embeds.js
/**
* Sets the array of embeds to paginate.
* @param {Array} array - An array of embeds to paginate.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -290,7 +291,7 @@ Embeds.js
* @param {StringResolvable} name - The name of the author.
* @param {string} [iconURL=null] - The icon URL of the author.
* @param {string} [url=null] - The URL of the author.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setAuthor(name, iconURL = null, url = null) {
if (!name) return this;
@@ -306,7 +307,7 @@ Embeds.js
/**
* Sets the color of all embeds.
* @param {ColorResolvable} color - The color of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setColor(color) {
if (!color) return this;
@@ -322,7 +323,7 @@ Embeds.js
/**
* Sets the description of all embeds.
* @param {string} description - The description of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setDescription(description) {
if (!description) return this;
@@ -339,7 +340,7 @@ Embeds.js
* Sets the footer of all embeds.
* @param {string} text - The footer text.
* @param {string} [iconURL=null] - URL for the footer's icon.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setFooter(text, iconURL = null) {
if (!text) return this;
@@ -355,7 +356,7 @@ Embeds.js
/**
* Sets the image of all embeds.
* @param {string} image - The image of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setImage(image) {
if (!image) return this;
@@ -371,7 +372,7 @@ Embeds.js
/**
* Sets the thumbnail of all embeds.
* @param {string} thumbnail - The thumbnail of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setThumbnail(thumbnail) {
if (!thumbnail) return this;
@@ -386,7 +387,7 @@ Embeds.js
/**
* Sets the timestamp of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTimestamp() {
const arr = this.array;
@@ -400,7 +401,7 @@ Embeds.js
/**
* Sets the title of all embeds.
* @param {string} title - The title of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTitle(title) {
if (!title) return this;
@@ -416,7 +417,7 @@ Embeds.js
/**
* Sets the URL of all embeds.
* @param {string} url - The URL of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setURL(url) {
if (!url) return this;
@@ -455,7 +456,7 @@ Embeds.js
diff --git a/docs/FieldsEmbed.html b/docs/FieldsEmbed.html
index 948c77a..e3a7000 100644
--- a/docs/FieldsEmbed.html
+++ b/docs/FieldsEmbed.html
@@ -22,7 +22,7 @@
@@ -304,7 +304,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -326,7 +326,7 @@ authori
- Inherited From:
@@ -360,7 +360,7 @@ authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -538,7 +538,7 @@ Type:
-elementList
+elementList :Array.<*>
@@ -594,6 +594,16 @@ elementLis
+ Type:
+
+ -
+
+Array.<*>
+
+
+
+
+
@@ -1063,9 +1073,9 @@ (async) buildExamples
- // Object as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed({
authorisedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
+ // Object as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed({
authorizedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
- // Methods as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed()
.setAuthorisedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
+ // Methods as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed()
.setAuthorizedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
@@ -1089,7 +1099,7 @@ Examples
- formatField(name, value, inlineopt) → {FieldsEmbed}
+ formatField(name, value, inlineopt) → {PaginationEmbed}
@@ -1308,10 +1318,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -1320,7 +1326,7 @@ Returns:
-
-FieldsEmbed
+PaginationEmbed
@@ -1468,10 +1474,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1494,7 +1496,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1517,7 +1519,7 @@ setA
- Inherited From:
@@ -1551,7 +1553,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1577,12 +1579,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1606,23 +1604,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1648,10 +1630,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1808,10 +1786,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1834,7 +1808,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1948,8 +1922,6 @@ Parameters:
- <optional>
-
@@ -1960,12 +1932,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -2027,10 +1997,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2053,7 +2019,7 @@ Returns:
- setElementsPerPage(numberopt) → {FieldsEmbed}
+ setElementsPerPage(number) → {PaginationEmbed}
@@ -2131,12 +2097,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2160,24 +2122,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 10
-
-
-
Maximum number of elements to be displayed per page.
@@ -2202,10 +2148,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -2214,7 +2156,7 @@ Returns:
-
-FieldsEmbed
+PaginationEmbed
@@ -2228,7 +2170,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -2311,12 +2253,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2340,23 +2278,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -2382,10 +2304,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2408,7 +2326,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -2491,12 +2409,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2523,24 +2437,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 1
-
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -2565,10 +2463,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2591,7 +2485,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -2674,12 +2568,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2703,23 +2593,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2745,10 +2619,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2771,7 +2641,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2854,12 +2724,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2883,24 +2749,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2925,10 +2775,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2964,7 +2810,7 @@ Returns:
diff --git a/docs/FieldsEmbed.js.html b/docs/FieldsEmbed.js.html
index 5d36097..9bad270 100644
--- a/docs/FieldsEmbed.js.html
+++ b/docs/FieldsEmbed.js.html
@@ -22,7 +22,7 @@
@@ -81,7 +81,7 @@ FieldsEmbed.js
/**
* Elements in the current page.
- * @returns {Array.<*>} - An array for a page.
+ * @type {Array.<*>}
*/
get elementList() {
const begin = (this.page - 1) * this.elementsPerPage;
@@ -96,11 +96,11 @@ FieldsEmbed.js
* @example
*
* // Object as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -126,11 +126,11 @@ FieldsEmbed.js
* @example
*
* // Methods as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -185,7 +185,7 @@ FieldsEmbed.js
* @param {string} name - Name of the field.
* @param {Function} value - Value of the field. Function for Array.prototype.map().join('\n').
* @param {boolean} [inline=true] - Whether the field is inline with other field or not.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @returns {PaginationEmbed}
*/
formatField(name, value, inline = true) {
this.fields.push({ name, value, inline });
@@ -195,10 +195,10 @@ FieldsEmbed.js
/**
* Sets the maximum number of elements to be displayed per page.
- * @param {number} [number=10] - Maximum number of elements to be displayed per page.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @param {number} number - Maximum number of elements to be displayed per page.
+ * @returns {PaginationEmbed}
*/
- setElementsPerPage(number = 10) {
+ setElementsPerPage(number) {
if (typeof number !== 'number') throw new Error('setElementsPerPage() only accepts number type.');
this.elementsPerPage = number;
@@ -266,7 +266,7 @@ FieldsEmbed.js
diff --git a/docs/PaginationEmbed.html b/docs/PaginationEmbed.html
index 58d735a..994485d 100644
--- a/docs/PaginationEmbed.html
+++ b/docs/PaginationEmbed.html
@@ -22,7 +22,7 @@
@@ -299,7 +299,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -350,7 +350,7 @@ authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -951,10 +951,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -977,7 +973,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1029,7 +1025,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1055,12 +1051,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1084,23 +1076,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1126,10 +1102,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1281,10 +1253,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1307,7 +1275,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1416,8 +1384,6 @@ Parameters:
- <optional>
-
@@ -1428,12 +1394,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -1495,10 +1459,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1521,7 +1481,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -1599,12 +1559,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1628,23 +1584,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -1670,10 +1610,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1696,7 +1632,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -1774,12 +1710,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1806,23 +1738,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -1848,10 +1764,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1874,7 +1786,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -1952,12 +1864,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1981,23 +1889,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2023,10 +1915,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2049,7 +1937,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2127,12 +2015,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2156,24 +2040,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2198,10 +2066,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2237,7 +2101,7 @@ Returns:
diff --git a/docs/base_PaginationEmbed.js.html b/docs/base_PaginationEmbed.js.html
index c40af28..e74e322 100644
--- a/docs/base_PaginationEmbed.js.html
+++ b/docs/base_PaginationEmbed.js.html
@@ -22,7 +22,7 @@
@@ -63,7 +63,7 @@ base/PaginationEmbed.js
/**
* Options for the constructor.
* @typedef {Object} PaginationEmbedOptions
- * @property {User} [authorisedUser=null] - The authorised user to navigate the pages.
+ * @property {User} [authorizedUser=null] - The authorized user to navigate the pages.
* @property {TextChannel} channel - The channel where to send the embed.
* @property {ClientMessageOptions} [clientMessage=null] - Settings for the message sent by the client.
* @property {Array.<*>} array - An array of elements to paginate.
@@ -82,10 +82,10 @@ base/PaginationEmbed.js
super(options);
/**
- * The authorised user to navigate the pages.
+ * The authorized user to navigate the pages.
* @type {User}
*/
- this.authorisedUser = options.authorisedUser || null;
+ this.authorizedUser = options.authorizedUser || null;
/**
* The channel where to send the embed.
@@ -149,7 +149,7 @@ base/PaginationEmbed.js
/**
* Sets the array of elements to paginate.
* @param {Array} array - An array of elements to paginate.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -162,12 +162,12 @@ base/PaginationEmbed.js
}
/**
- * Set the authorised person to navigate the pages.
- * @param {User} [user=null] - The user object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * Set the authorized person to navigate the pages.
+ * @param {User} user - The user object.
+ * @returns {PaginationEmbed}
*/
- setAuthorisedUser(user = null) {
- this.authorisedUser = user;
+ setAuthorizedUser(user) {
+ this.authorizedUser = user;
return this;
}
@@ -175,7 +175,7 @@ base/PaginationEmbed.js
/**
* The channel where to send the embed.
* @param {TextChannel} channel - The channel object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setChannel(channel) {
this.channel = channel;
@@ -185,11 +185,11 @@ base/PaginationEmbed.js
/**
* Sets the settings for the message sent by the client.
- * @param {Message} [message=null] - The message object sent by the client, if there is any.
+ * @param {Message} message - The message object sent by the client.
* @param {string} [content='Preparing...'] - The custom message content while preparing the embed.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
- setClientMessage(message = null, content = null) {
+ setClientMessage(message, content = null) {
if (!content) content = 'Preparing...';
Object.assign(this.clientMessage, { message, content });
@@ -199,8 +199,8 @@ base/PaginationEmbed.js
/**
* Sets the emojis used for navigation buttons.
- * @param {NavigationButtons} [emojis={}] - An object containing customised emojis to use as navigation buttons.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {NavigationButtons} emojis - An object containing customised emojis to use as navigation buttons.
+ * @returns {PaginationEmbed}
*/
setEmojis(emojis) {
Object.assign(this.emojis, emojis);
@@ -210,10 +210,10 @@ base/PaginationEmbed.js
/**
* Sets to jump to a certain page upon calling PaginationEmbed.build().
- * @param {number|string} [param=1] - The page number to jump to. As String: 'back', 'forward'
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number|string} param - The page number to jump to. As String: 'back', 'forward'
+ * @returns {PaginationEmbed}
*/
- setPage(param = 1) {
+ setPage(param) {
const isString = typeof param === 'string';
if (!(!isNaN(param) || isString)) throw new Error('setPage() only accepts number/string type.');
@@ -229,10 +229,10 @@ base/PaginationEmbed.js
/**
* Sets the time for awaiting a user action before timeout in ms.
- * @param {number} [timeout=30000] Timeout value in ms.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number} timeout Timeout value in ms.
+ * @returns {PaginationEmbed}
*/
- setTimeout(timeout = 30000) {
+ setTimeout(timeout) {
if (typeof timeout !== 'number') throw new Error('setTimeout() only accepts number type.');
this.timeout = timeout;
@@ -242,10 +242,10 @@ base/PaginationEmbed.js
/**
* Sets whether page number indicator on client's message is shown or not.
- * @param {boolean} [boolean=true] - Show page indicator?
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {boolean} boolean - Show page indicator?
+ * @returns {PaginationEmbed}
*/
- showPageIndicator(boolean = true) {
+ showPageIndicator(boolean) {
if (typeof boolean !== 'boolean') throw new Error('showPageIndicator() only accepts boolean type.');
this.pageIndicator = boolean;
@@ -261,7 +261,7 @@ base/PaginationEmbed.js
async _verify(pages) {
this
.setChannel(this.channel)
- .setAuthorisedUser(this.authorisedUser)
+ .setAuthorizedUser(this.authorizedUser)
.setClientMessage(this.clientMessage.message, this.clientMessage.content)
.setArray(this.array)
.showPageIndicator(this.pageIndicator)
@@ -337,8 +337,8 @@ base/PaginationEmbed.js
async _awaitResponse() {
const emojis = Object.values(this.emojis);
const filter = (r, u) => {
- if (this.authorisedUser)
- return u.id === this.authorisedUser.id && emojis.includes(r.emoji.name);
+ if (this.authorizedUser)
+ return u.id === this.authorizedUser.id && emojis.includes(r.emoji.name);
return !u.bot && emojis.includes(r.emoji.name);
};
@@ -432,7 +432,7 @@ base/PaginationEmbed.js
diff --git a/docs/global.html b/docs/global.html
index 23000ba..3f7e34b 100644
--- a/docs/global.html
+++ b/docs/global.html
@@ -22,7 +22,7 @@
@@ -1487,7 +1487,7 @@ Properties:
- authorisedUser
+ authorizedUser
@@ -1517,7 +1517,7 @@ Properties:
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -1820,7 +1820,7 @@ Type:
diff --git a/docs/index.html b/docs/index.html
index 80eb8c4..c53f893 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -22,7 +22,7 @@
@@ -51,20 +51,21 @@ Home
Classes
const FieldsEmbedMode = require('discord-paginationembed').FieldsEmbed;
+const { FieldsEmbed: FieldsEmbedMode } = require('discord-paginationembed');
new FieldsEmbedMode()
.setArray([ { name: "John Doe" }, { name: "Jane Doe" } ])
- .setAuthorisedUser(message.author)
+ .setAuthorizedUser(message.author)
.setChannel(message.channel)
.setElementsPerPage(1)
.setPage(2)
.showPageIndicator(false)
- .build();
const EmbedsMode = require('discord-paginationembed').Embeds;
+ .build();
const { Embeds: EmbedsMode } = require('discord-paginationembed');
const { MessageEmbed } = require("discord.js");
const embeds = [];
@@ -76,7 +77,7 @@ Under message
event
new EmbedsMode()
.setArray(embeds)
- .setAuthorisedUser(message.author)
+ .setAuthorizedUser(message.author)
.setChannel(message.channel)
.showPageIndicator(true)
.setPage(3)
@@ -99,7 +100,7 @@ Contributing
- Fork this repository.
- Execute
npm install
- Code and code and code and code and... code!
-npm test
to verify your additions/adjustments are following ESLint's rules and verify docs are valid.
+npm test
to verify if your additions/adjustments are following ESLint's rules and to verify if the docs are valid.
- File a Pull Request!
License
MIT
@@ -115,7 +116,7 @@ License
MIT
diff --git a/package.json b/package.json
index f30a2be..44c632d 100644
--- a/package.json
+++ b/package.json
@@ -1,11 +1,11 @@
{
"name": "discord-paginationembed",
- "version": "0.1.0",
+ "version": "0.2.0",
"description": "Pagination Embed for Discord.JS",
"main": "./src/index.js",
"scripts": {
- "test": "eslint --ignore-path .eslintignore . && npm run generate-docs",
- "generate-docs": "jsdoc -c jsdoc.json"
+ "test": "eslint ./src && npm run docs",
+ "docs": "node_modules/.bin/jsdoc -c .jsdoc.json"
},
"repository": {
"type": "git",
@@ -27,7 +27,7 @@
"url": "https://github.com/gazmull/discord-paginationembed/issues"
},
"homepage": "https://github.com/gazmull/discord-paginationembed#readme",
- "dependencies": {
+ "peerDependencies": {
"discord.js": "discordjs/discord.js"
},
"devDependencies": {
diff --git a/src/struct/Embeds.js b/src/struct/Embeds.js
index e8ed7be..ac4fb33 100644
--- a/src/struct/Embeds.js
+++ b/src/struct/Embeds.js
@@ -72,6 +72,7 @@ class Embeds extends PaginationEmbed {
/**
* The thumbnail of all embeds.
+ * @type {string}
*/
this.thumbnail = options.thumbnail || null;
@@ -96,7 +97,7 @@ class Embeds extends PaginationEmbed {
/**
* Embed in the current page.
- * @returns {MessageEmbed} - An instance of MessageEmbed.
+ * @type {MessageEmbed}
*/
get currentEmbed() {
return this.array[this.page - 1];
@@ -105,7 +106,7 @@ class Embeds extends PaginationEmbed {
/**
* Adds a blank field to the fields of all embeds.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addBlankField(inline = false) {
const arr = this.array;
@@ -121,7 +122,7 @@ class Embeds extends PaginationEmbed {
* @param {string} name - The name of the field.
* @param {string} value - The value of the field.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addField(name, value, inline = false) {
if (!name && !value) return this;
@@ -140,12 +141,12 @@ class Embeds extends PaginationEmbed {
* @example
*
* // Object as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -169,12 +170,12 @@ class Embeds extends PaginationEmbed {
* @example
*
* // Methods as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -230,7 +231,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the array of embeds to paginate.
* @param {Array} array - An array of embeds to paginate.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -251,7 +252,7 @@ class Embeds extends PaginationEmbed {
* @param {StringResolvable} name - The name of the author.
* @param {string} [iconURL=null] - The icon URL of the author.
* @param {string} [url=null] - The URL of the author.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setAuthor(name, iconURL = null, url = null) {
if (!name) return this;
@@ -267,7 +268,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the color of all embeds.
* @param {ColorResolvable} color - The color of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setColor(color) {
if (!color) return this;
@@ -283,7 +284,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the description of all embeds.
* @param {string} description - The description of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setDescription(description) {
if (!description) return this;
@@ -300,7 +301,7 @@ class Embeds extends PaginationEmbed {
* Sets the footer of all embeds.
* @param {string} text - The footer text.
* @param {string} [iconURL=null] - URL for the footer's icon.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setFooter(text, iconURL = null) {
if (!text) return this;
@@ -316,7 +317,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the image of all embeds.
* @param {string} image - The image of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setImage(image) {
if (!image) return this;
@@ -332,7 +333,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the thumbnail of all embeds.
* @param {string} thumbnail - The thumbnail of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setThumbnail(thumbnail) {
if (!thumbnail) return this;
@@ -347,7 +348,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the timestamp of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTimestamp() {
const arr = this.array;
@@ -361,7 +362,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the title of all embeds.
* @param {string} title - The title of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTitle(title) {
if (!title) return this;
@@ -377,7 +378,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the URL of all embeds.
* @param {string} url - The URL of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setURL(url) {
if (!url) return this;
diff --git a/src/struct/FieldsEmbed.js b/src/struct/FieldsEmbed.js
index 71b2281..d631b76 100644
--- a/src/struct/FieldsEmbed.js
+++ b/src/struct/FieldsEmbed.js
@@ -42,7 +42,7 @@ class FieldsEmbed extends PaginationEmbed {
/**
* Elements in the current page.
- * @returns {Array.<*>} - An array for a page.
+ * @type {Array.<*>}
*/
get elementList() {
const begin = (this.page - 1) * this.elementsPerPage;
@@ -57,11 +57,11 @@ class FieldsEmbed extends PaginationEmbed {
* @example
*
* // Object as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -87,11 +87,11 @@ class FieldsEmbed extends PaginationEmbed {
* @example
*
* // Methods as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -146,7 +146,7 @@ class FieldsEmbed extends PaginationEmbed {
* @param {string} name - Name of the field.
* @param {Function} value - Value of the field. Function for Array.prototype.map().join('\n').
* @param {boolean} [inline=true] - Whether the field is inline with other field or not.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @returns {PaginationEmbed}
*/
formatField(name, value, inline = true) {
this.fields.push({ name, value, inline });
@@ -156,10 +156,10 @@ class FieldsEmbed extends PaginationEmbed {
/**
* Sets the maximum number of elements to be displayed per page.
- * @param {number} [number=10] - Maximum number of elements to be displayed per page.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @param {number} number - Maximum number of elements to be displayed per page.
+ * @returns {PaginationEmbed}
*/
- setElementsPerPage(number = 10) {
+ setElementsPerPage(number) {
if (typeof number !== 'number') throw new Error('setElementsPerPage() only accepts number type.');
this.elementsPerPage = number;
diff --git a/src/struct/base/PaginationEmbed.js b/src/struct/base/PaginationEmbed.js
index 11a5a9f..9f9ec45 100644
--- a/src/struct/base/PaginationEmbed.js
+++ b/src/struct/base/PaginationEmbed.js
@@ -24,7 +24,7 @@ class PaginationEmbed extends MessageEmbed {
/**
* Options for the constructor.
* @typedef {Object} PaginationEmbedOptions
- * @property {User} [authorisedUser=null] - The authorised user to navigate the pages.
+ * @property {User} [authorizedUser=null] - The authorized user to navigate the pages.
* @property {TextChannel} channel - The channel where to send the embed.
* @property {ClientMessageOptions} [clientMessage=null] - Settings for the message sent by the client.
* @property {Array.<*>} array - An array of elements to paginate.
@@ -43,10 +43,10 @@ class PaginationEmbed extends MessageEmbed {
super(options);
/**
- * The authorised user to navigate the pages.
+ * The authorized user to navigate the pages.
* @type {User}
*/
- this.authorisedUser = options.authorisedUser || null;
+ this.authorizedUser = options.authorizedUser || null;
/**
* The channel where to send the embed.
@@ -110,7 +110,7 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the array of elements to paginate.
* @param {Array} array - An array of elements to paginate.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -123,12 +123,12 @@ class PaginationEmbed extends MessageEmbed {
}
/**
- * Set the authorised person to navigate the pages.
- * @param {User} [user=null] - The user object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * Set the authorized person to navigate the pages.
+ * @param {User} user - The user object.
+ * @returns {PaginationEmbed}
*/
- setAuthorisedUser(user = null) {
- this.authorisedUser = user;
+ setAuthorizedUser(user) {
+ this.authorizedUser = user;
return this;
}
@@ -136,7 +136,7 @@ class PaginationEmbed extends MessageEmbed {
/**
* The channel where to send the embed.
* @param {TextChannel} channel - The channel object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setChannel(channel) {
this.channel = channel;
@@ -146,11 +146,11 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the settings for the message sent by the client.
- * @param {Message} [message=null] - The message object sent by the client, if there is any.
+ * @param {Message} message - The message object sent by the client.
* @param {string} [content='Preparing...'] - The custom message content while preparing the embed.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
- setClientMessage(message = null, content = null) {
+ setClientMessage(message, content = null) {
if (!content) content = 'Preparing...';
Object.assign(this.clientMessage, { message, content });
@@ -160,8 +160,8 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the emojis used for navigation buttons.
- * @param {NavigationButtons} [emojis={}] - An object containing customised emojis to use as navigation buttons.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {NavigationButtons} emojis - An object containing customised emojis to use as navigation buttons.
+ * @returns {PaginationEmbed}
*/
setEmojis(emojis) {
Object.assign(this.emojis, emojis);
@@ -171,10 +171,10 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets to jump to a certain page upon calling PaginationEmbed.build().
- * @param {number|string} [param=1] - The page number to jump to. As String: 'back', 'forward'
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number|string} param - The page number to jump to. As String: 'back', 'forward'
+ * @returns {PaginationEmbed}
*/
- setPage(param = 1) {
+ setPage(param) {
const isString = typeof param === 'string';
if (!(!isNaN(param) || isString)) throw new Error('setPage() only accepts number/string type.');
@@ -190,10 +190,10 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the time for awaiting a user action before timeout in ms.
- * @param {number} [timeout=30000] Timeout value in ms.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number} timeout Timeout value in ms.
+ * @returns {PaginationEmbed}
*/
- setTimeout(timeout = 30000) {
+ setTimeout(timeout) {
if (typeof timeout !== 'number') throw new Error('setTimeout() only accepts number type.');
this.timeout = timeout;
@@ -203,10 +203,10 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets whether page number indicator on client's message is shown or not.
- * @param {boolean} [boolean=true] - Show page indicator?
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {boolean} boolean - Show page indicator?
+ * @returns {PaginationEmbed}
*/
- showPageIndicator(boolean = true) {
+ showPageIndicator(boolean) {
if (typeof boolean !== 'boolean') throw new Error('showPageIndicator() only accepts boolean type.');
this.pageIndicator = boolean;
@@ -222,7 +222,7 @@ class PaginationEmbed extends MessageEmbed {
async _verify(pages) {
this
.setChannel(this.channel)
- .setAuthorisedUser(this.authorisedUser)
+ .setAuthorizedUser(this.authorizedUser)
.setClientMessage(this.clientMessage.message, this.clientMessage.content)
.setArray(this.array)
.showPageIndicator(this.pageIndicator)
@@ -298,8 +298,8 @@ class PaginationEmbed extends MessageEmbed {
async _awaitResponse() {
const emojis = Object.values(this.emojis);
const filter = (r, u) => {
- if (this.authorisedUser)
- return u.id === this.authorisedUser.id && emojis.includes(r.emoji.name);
+ if (this.authorizedUser)
+ return u.id === this.authorizedUser.id && emojis.includes(r.emoji.name);
return !u.bot && emojis.includes(r.emoji.name);
};
thumbnailType:
+
+ -
+
+string
+
+
+
+
+
@@ -1645,7 +1665,7 @@ Methods
- addBlankField(inlineopt) → {Embeds}
+ addBlankField(inlineopt) → {PaginationEmbed}
@@ -1657,7 +1677,7 @@ addBlank
Source:
@@ -1794,10 +1814,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -1806,7 +1822,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -1820,7 +1836,7 @@ Returns:
- addField(name, value, inlineopt) → {Embeds}
+ addField(name, value, inlineopt) → {PaginationEmbed}
@@ -1832,7 +1848,7 @@ addFieldSource:
@@ -2039,10 +2055,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -2051,7 +2063,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -2077,7 +2089,7 @@ (async) buildSource:
@@ -2130,9 +2142,9 @@ (async) buildExamples
- // Object as constructor.
const Embeds = require('discord-paginationembed').Embeds;
const { MessageEmbed } = require('discord.js');
// Under message event.
new Embeds({
authorisedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
new MessageEmbed({ title: 'John Doe' }),
new MessageEmbed({ title: 'Jane Doe' })
],
pageIndicator: false,
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
},
description: 'This is one of my embeds with this message!',
color: 0xFF00AE,
timestamp: true
}).build();
+ // Object as constructor.
const { Embeds } = require('discord-paginationembed');
const { MessageEmbed } = require('discord.js');
// Under message event.
new Embeds({
authorizedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
new MessageEmbed({ title: 'John Doe' }),
new MessageEmbed({ title: 'Jane Doe' })
],
pageIndicator: false,
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
},
description: 'This is one of my embeds with this message!',
color: 0xFF00AE,
timestamp: true
}).build();
- // Methods as constructor.
const Embeds = require('discord-paginationembed').Embeds;
const { MessageEmbed } = require('discord.js');
// Under message event.
new Embeds()
.setAuthorisedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
new MessageEmbed({ title: 'John Doe' }),
new MessageEmbed({ title: 'Jane Doe' })
])
.setPageIndicator(false)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.setDescription('This is one of my embeds with this message!')
.setColor(0xFF00AE)
.setTimestamp()
.build();
+ // Methods as constructor.
const { Embeds } = require('discord-paginationembed');
const { MessageEmbed } = require('discord.js');
// Under message event.
new Embeds()
.setAuthorizedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
new MessageEmbed({ title: 'John Doe' }),
new MessageEmbed({ title: 'Jane Doe' })
])
.setPageIndicator(false)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.setDescription('This is one of my embeds with this message!')
.setColor(0xFF00AE)
.setTimestamp()
.build();
@@ -2156,7 +2168,7 @@ Examples
- setArray(array) → {Embeds}
+ setArray(array) → {PaginationEmbed}
@@ -2168,7 +2180,7 @@ setArraySource:
@@ -2290,10 +2302,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -2302,7 +2310,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -2316,7 +2324,7 @@ Returns:
- setAuthor(name, iconURLopt, urlopt) → {Embeds}
+ setAuthor(name, iconURLopt, urlopt) → {PaginationEmbed}
@@ -2328,7 +2336,7 @@ setAuthorSource:
@@ -2539,10 +2547,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -2551,7 +2555,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -2565,7 +2569,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -2588,7 +2592,7 @@ setA
- Inherited From:
@@ -2622,7 +2626,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -2648,12 +2652,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2677,23 +2677,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -2719,10 +2703,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2879,10 +2859,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2905,7 +2881,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -3019,8 +2995,6 @@ Parameters:
- <optional>
-
@@ -3031,12 +3005,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -3098,10 +3070,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -3124,7 +3092,7 @@ Returns:
- setColor(color) → {Embeds}
+ setColor(color) → {PaginationEmbed}
@@ -3136,7 +3104,7 @@ setColorSource:
@@ -3253,10 +3221,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3265,7 +3229,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3279,7 +3243,7 @@ Returns:
- setDescription(description) → {Embeds}
+ setDescription(description) → {PaginationEmbed}
@@ -3291,7 +3255,7 @@ setDesc
- Source:
@@ -3408,10 +3372,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3420,7 +3380,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3434,7 +3394,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -3517,12 +3477,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -3546,23 +3502,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -3588,10 +3528,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -3614,7 +3550,7 @@ Returns:
- setFooter(text, iconURLopt) → {Embeds}
+ setFooter(text, iconURLopt) → {PaginationEmbed}
@@ -3626,7 +3562,7 @@ setFooterSource:
@@ -3798,10 +3734,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3810,7 +3742,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3824,7 +3756,7 @@ Returns:
- setImage(image) → {Embeds}
+ setImage(image) → {PaginationEmbed}
@@ -3836,7 +3768,7 @@ setImageSource:
@@ -3953,10 +3885,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3965,7 +3893,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3979,7 +3907,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -4062,12 +3990,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -4094,23 +4018,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -4136,10 +4044,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -4162,7 +4066,7 @@ Returns:
- setThumbnail(thumbnail) → {Embeds}
+ setThumbnail(thumbnail) → {PaginationEmbed}
@@ -4174,7 +4078,7 @@ setThumbn
- Source:
@@ -4291,10 +4195,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4303,7 +4203,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4317,7 +4217,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -4400,12 +4300,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -4429,23 +4325,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -4471,10 +4351,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -4497,7 +4373,7 @@ Returns:
- setTimestamp() → {Embeds}
+ setTimestamp() → {PaginationEmbed}
@@ -4509,7 +4385,7 @@ setTimest
- Source:
@@ -4577,10 +4453,6 @@ setTimest
Returns:
-
- - Instance of Embeds
-
-
@@ -4589,7 +4461,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4603,7 +4475,7 @@ Returns:
- setTitle(title) → {Embeds}
+ setTitle(title) → {PaginationEmbed}
@@ -4615,7 +4487,7 @@ setTitleSource:
@@ -4732,10 +4604,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4744,7 +4612,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4758,7 +4626,7 @@ Returns:
- setURL(url) → {Embeds}
+ setURL(url) → {PaginationEmbed}
@@ -4770,7 +4638,7 @@ setURLSource:
@@ -4887,10 +4755,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4899,7 +4763,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4913,7 +4777,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -4996,12 +4860,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -5025,23 +4885,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- true
-
-
Show page indicator?
@@ -5067,10 +4911,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -5106,7 +4946,7 @@ Returns:
diff --git a/docs/Embeds.js.html b/docs/Embeds.js.html
index 637f285..ba6e1c4 100644
--- a/docs/Embeds.js.html
+++ b/docs/Embeds.js.html
@@ -22,7 +22,7 @@
@@ -111,6 +111,7 @@ Embeds.js
/**
* The thumbnail of all embeds.
+ * @type {string}
*/
this.thumbnail = options.thumbnail || null;
@@ -135,7 +136,7 @@ Embeds.js
/**
* Embed in the current page.
- * @returns {MessageEmbed} - An instance of MessageEmbed.
+ * @type {MessageEmbed}
*/
get currentEmbed() {
return this.array[this.page - 1];
@@ -144,7 +145,7 @@ Embeds.js
/**
* Adds a blank field to the fields of all embeds.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addBlankField(inline = false) {
const arr = this.array;
@@ -160,7 +161,7 @@ Embeds.js
* @param {string} name - The name of the field.
* @param {string} value - The value of the field.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addField(name, value, inline = false) {
if (!name && !value) return this;
@@ -179,12 +180,12 @@ Embeds.js
* @example
*
* // Object as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -208,12 +209,12 @@ Embeds.js
* @example
*
* // Methods as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -269,7 +270,7 @@ Embeds.js
/**
* Sets the array of embeds to paginate.
* @param {Array} array - An array of embeds to paginate.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -290,7 +291,7 @@ Embeds.js
* @param {StringResolvable} name - The name of the author.
* @param {string} [iconURL=null] - The icon URL of the author.
* @param {string} [url=null] - The URL of the author.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setAuthor(name, iconURL = null, url = null) {
if (!name) return this;
@@ -306,7 +307,7 @@ Embeds.js
/**
* Sets the color of all embeds.
* @param {ColorResolvable} color - The color of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setColor(color) {
if (!color) return this;
@@ -322,7 +323,7 @@ Embeds.js
/**
* Sets the description of all embeds.
* @param {string} description - The description of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setDescription(description) {
if (!description) return this;
@@ -339,7 +340,7 @@ Embeds.js
* Sets the footer of all embeds.
* @param {string} text - The footer text.
* @param {string} [iconURL=null] - URL for the footer's icon.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setFooter(text, iconURL = null) {
if (!text) return this;
@@ -355,7 +356,7 @@ Embeds.js
/**
* Sets the image of all embeds.
* @param {string} image - The image of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setImage(image) {
if (!image) return this;
@@ -371,7 +372,7 @@ Embeds.js
/**
* Sets the thumbnail of all embeds.
* @param {string} thumbnail - The thumbnail of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setThumbnail(thumbnail) {
if (!thumbnail) return this;
@@ -386,7 +387,7 @@ Embeds.js
/**
* Sets the timestamp of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTimestamp() {
const arr = this.array;
@@ -400,7 +401,7 @@ Embeds.js
/**
* Sets the title of all embeds.
* @param {string} title - The title of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTitle(title) {
if (!title) return this;
@@ -416,7 +417,7 @@ Embeds.js
/**
* Sets the URL of all embeds.
* @param {string} url - The URL of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setURL(url) {
if (!url) return this;
@@ -455,7 +456,7 @@ Embeds.js
diff --git a/docs/FieldsEmbed.html b/docs/FieldsEmbed.html
index 948c77a..e3a7000 100644
--- a/docs/FieldsEmbed.html
+++ b/docs/FieldsEmbed.html
@@ -22,7 +22,7 @@
@@ -304,7 +304,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -326,7 +326,7 @@ authori
- Inherited From:
@@ -360,7 +360,7 @@ authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -538,7 +538,7 @@ Type:
-elementList
+elementList :Array.<*>
@@ -594,6 +594,16 @@ elementLis
+ Type:
+
+ -
+
+Array.<*>
+
+
+
+
+
@@ -1063,9 +1073,9 @@ (async) buildExamples
- // Object as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed({
authorisedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
+ // Object as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed({
authorizedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
- // Methods as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed()
.setAuthorisedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
+ // Methods as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed()
.setAuthorizedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
@@ -1089,7 +1099,7 @@ Examples
- formatField(name, value, inlineopt) → {FieldsEmbed}
+ formatField(name, value, inlineopt) → {PaginationEmbed}
@@ -1308,10 +1318,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -1320,7 +1326,7 @@ Returns:
-
-FieldsEmbed
+PaginationEmbed
@@ -1468,10 +1474,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1494,7 +1496,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1517,7 +1519,7 @@ setA
- Inherited From:
@@ -1551,7 +1553,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1577,12 +1579,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1606,23 +1604,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1648,10 +1630,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1808,10 +1786,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1834,7 +1808,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1948,8 +1922,6 @@ Parameters:
- <optional>
-
@@ -1960,12 +1932,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -2027,10 +1997,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2053,7 +2019,7 @@ Returns:
- setElementsPerPage(numberopt) → {FieldsEmbed}
+ setElementsPerPage(number) → {PaginationEmbed}
@@ -2131,12 +2097,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2160,24 +2122,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 10
-
-
-
Maximum number of elements to be displayed per page.
@@ -2202,10 +2148,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -2214,7 +2156,7 @@ Returns:
-
-FieldsEmbed
+PaginationEmbed
@@ -2228,7 +2170,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -2311,12 +2253,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2340,23 +2278,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -2382,10 +2304,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2408,7 +2326,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -2491,12 +2409,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2523,24 +2437,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 1
-
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -2565,10 +2463,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2591,7 +2485,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -2674,12 +2568,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2703,23 +2593,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2745,10 +2619,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2771,7 +2641,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2854,12 +2724,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2883,24 +2749,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2925,10 +2775,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2964,7 +2810,7 @@ Returns:
diff --git a/docs/FieldsEmbed.js.html b/docs/FieldsEmbed.js.html
index 5d36097..9bad270 100644
--- a/docs/FieldsEmbed.js.html
+++ b/docs/FieldsEmbed.js.html
@@ -22,7 +22,7 @@
@@ -81,7 +81,7 @@ FieldsEmbed.js
/**
* Elements in the current page.
- * @returns {Array.<*>} - An array for a page.
+ * @type {Array.<*>}
*/
get elementList() {
const begin = (this.page - 1) * this.elementsPerPage;
@@ -96,11 +96,11 @@ FieldsEmbed.js
* @example
*
* // Object as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -126,11 +126,11 @@ FieldsEmbed.js
* @example
*
* // Methods as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -185,7 +185,7 @@ FieldsEmbed.js
* @param {string} name - Name of the field.
* @param {Function} value - Value of the field. Function for Array.prototype.map().join('\n').
* @param {boolean} [inline=true] - Whether the field is inline with other field or not.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @returns {PaginationEmbed}
*/
formatField(name, value, inline = true) {
this.fields.push({ name, value, inline });
@@ -195,10 +195,10 @@ FieldsEmbed.js
/**
* Sets the maximum number of elements to be displayed per page.
- * @param {number} [number=10] - Maximum number of elements to be displayed per page.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @param {number} number - Maximum number of elements to be displayed per page.
+ * @returns {PaginationEmbed}
*/
- setElementsPerPage(number = 10) {
+ setElementsPerPage(number) {
if (typeof number !== 'number') throw new Error('setElementsPerPage() only accepts number type.');
this.elementsPerPage = number;
@@ -266,7 +266,7 @@ FieldsEmbed.js
diff --git a/docs/PaginationEmbed.html b/docs/PaginationEmbed.html
index 58d735a..994485d 100644
--- a/docs/PaginationEmbed.html
+++ b/docs/PaginationEmbed.html
@@ -22,7 +22,7 @@
@@ -299,7 +299,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -350,7 +350,7 @@ authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -951,10 +951,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -977,7 +973,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1029,7 +1025,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1055,12 +1051,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1084,23 +1076,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1126,10 +1102,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1281,10 +1253,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1307,7 +1275,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1416,8 +1384,6 @@ Parameters:
- <optional>
-
@@ -1428,12 +1394,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -1495,10 +1459,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1521,7 +1481,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -1599,12 +1559,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1628,23 +1584,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -1670,10 +1610,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1696,7 +1632,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -1774,12 +1710,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1806,23 +1738,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -1848,10 +1764,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1874,7 +1786,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -1952,12 +1864,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1981,23 +1889,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2023,10 +1915,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2049,7 +1937,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2127,12 +2015,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2156,24 +2040,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2198,10 +2066,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2237,7 +2101,7 @@ Returns:
diff --git a/docs/base_PaginationEmbed.js.html b/docs/base_PaginationEmbed.js.html
index c40af28..e74e322 100644
--- a/docs/base_PaginationEmbed.js.html
+++ b/docs/base_PaginationEmbed.js.html
@@ -22,7 +22,7 @@
@@ -63,7 +63,7 @@ base/PaginationEmbed.js
/**
* Options for the constructor.
* @typedef {Object} PaginationEmbedOptions
- * @property {User} [authorisedUser=null] - The authorised user to navigate the pages.
+ * @property {User} [authorizedUser=null] - The authorized user to navigate the pages.
* @property {TextChannel} channel - The channel where to send the embed.
* @property {ClientMessageOptions} [clientMessage=null] - Settings for the message sent by the client.
* @property {Array.<*>} array - An array of elements to paginate.
@@ -82,10 +82,10 @@ base/PaginationEmbed.js
super(options);
/**
- * The authorised user to navigate the pages.
+ * The authorized user to navigate the pages.
* @type {User}
*/
- this.authorisedUser = options.authorisedUser || null;
+ this.authorizedUser = options.authorizedUser || null;
/**
* The channel where to send the embed.
@@ -149,7 +149,7 @@ base/PaginationEmbed.js
/**
* Sets the array of elements to paginate.
* @param {Array} array - An array of elements to paginate.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -162,12 +162,12 @@ base/PaginationEmbed.js
}
/**
- * Set the authorised person to navigate the pages.
- * @param {User} [user=null] - The user object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * Set the authorized person to navigate the pages.
+ * @param {User} user - The user object.
+ * @returns {PaginationEmbed}
*/
- setAuthorisedUser(user = null) {
- this.authorisedUser = user;
+ setAuthorizedUser(user) {
+ this.authorizedUser = user;
return this;
}
@@ -175,7 +175,7 @@ base/PaginationEmbed.js
/**
* The channel where to send the embed.
* @param {TextChannel} channel - The channel object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setChannel(channel) {
this.channel = channel;
@@ -185,11 +185,11 @@ base/PaginationEmbed.js
/**
* Sets the settings for the message sent by the client.
- * @param {Message} [message=null] - The message object sent by the client, if there is any.
+ * @param {Message} message - The message object sent by the client.
* @param {string} [content='Preparing...'] - The custom message content while preparing the embed.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
- setClientMessage(message = null, content = null) {
+ setClientMessage(message, content = null) {
if (!content) content = 'Preparing...';
Object.assign(this.clientMessage, { message, content });
@@ -199,8 +199,8 @@ base/PaginationEmbed.js
/**
* Sets the emojis used for navigation buttons.
- * @param {NavigationButtons} [emojis={}] - An object containing customised emojis to use as navigation buttons.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {NavigationButtons} emojis - An object containing customised emojis to use as navigation buttons.
+ * @returns {PaginationEmbed}
*/
setEmojis(emojis) {
Object.assign(this.emojis, emojis);
@@ -210,10 +210,10 @@ base/PaginationEmbed.js
/**
* Sets to jump to a certain page upon calling PaginationEmbed.build().
- * @param {number|string} [param=1] - The page number to jump to. As String: 'back', 'forward'
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number|string} param - The page number to jump to. As String: 'back', 'forward'
+ * @returns {PaginationEmbed}
*/
- setPage(param = 1) {
+ setPage(param) {
const isString = typeof param === 'string';
if (!(!isNaN(param) || isString)) throw new Error('setPage() only accepts number/string type.');
@@ -229,10 +229,10 @@ base/PaginationEmbed.js
/**
* Sets the time for awaiting a user action before timeout in ms.
- * @param {number} [timeout=30000] Timeout value in ms.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number} timeout Timeout value in ms.
+ * @returns {PaginationEmbed}
*/
- setTimeout(timeout = 30000) {
+ setTimeout(timeout) {
if (typeof timeout !== 'number') throw new Error('setTimeout() only accepts number type.');
this.timeout = timeout;
@@ -242,10 +242,10 @@ base/PaginationEmbed.js
/**
* Sets whether page number indicator on client's message is shown or not.
- * @param {boolean} [boolean=true] - Show page indicator?
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {boolean} boolean - Show page indicator?
+ * @returns {PaginationEmbed}
*/
- showPageIndicator(boolean = true) {
+ showPageIndicator(boolean) {
if (typeof boolean !== 'boolean') throw new Error('showPageIndicator() only accepts boolean type.');
this.pageIndicator = boolean;
@@ -261,7 +261,7 @@ base/PaginationEmbed.js
async _verify(pages) {
this
.setChannel(this.channel)
- .setAuthorisedUser(this.authorisedUser)
+ .setAuthorizedUser(this.authorizedUser)
.setClientMessage(this.clientMessage.message, this.clientMessage.content)
.setArray(this.array)
.showPageIndicator(this.pageIndicator)
@@ -337,8 +337,8 @@ base/PaginationEmbed.js
async _awaitResponse() {
const emojis = Object.values(this.emojis);
const filter = (r, u) => {
- if (this.authorisedUser)
- return u.id === this.authorisedUser.id && emojis.includes(r.emoji.name);
+ if (this.authorizedUser)
+ return u.id === this.authorizedUser.id && emojis.includes(r.emoji.name);
return !u.bot && emojis.includes(r.emoji.name);
};
@@ -432,7 +432,7 @@ base/PaginationEmbed.js
diff --git a/docs/global.html b/docs/global.html
index 23000ba..3f7e34b 100644
--- a/docs/global.html
+++ b/docs/global.html
@@ -22,7 +22,7 @@
@@ -1487,7 +1487,7 @@ Properties:
- authorisedUser
+ authorizedUser
@@ -1517,7 +1517,7 @@ Properties:
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -1820,7 +1820,7 @@ Type:
diff --git a/docs/index.html b/docs/index.html
index 80eb8c4..c53f893 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -22,7 +22,7 @@
@@ -51,20 +51,21 @@ Home
Classes
const FieldsEmbedMode = require('discord-paginationembed').FieldsEmbed;
+const { FieldsEmbed: FieldsEmbedMode } = require('discord-paginationembed');
new FieldsEmbedMode()
.setArray([ { name: "John Doe" }, { name: "Jane Doe" } ])
- .setAuthorisedUser(message.author)
+ .setAuthorizedUser(message.author)
.setChannel(message.channel)
.setElementsPerPage(1)
.setPage(2)
.showPageIndicator(false)
- .build();
const EmbedsMode = require('discord-paginationembed').Embeds;
+ .build();
const { Embeds: EmbedsMode } = require('discord-paginationembed');
const { MessageEmbed } = require("discord.js");
const embeds = [];
@@ -76,7 +77,7 @@ Under message
event
new EmbedsMode()
.setArray(embeds)
- .setAuthorisedUser(message.author)
+ .setAuthorizedUser(message.author)
.setChannel(message.channel)
.showPageIndicator(true)
.setPage(3)
@@ -99,7 +100,7 @@ Contributing
- Fork this repository.
- Execute
npm install
- Code and code and code and code and... code!
-npm test
to verify your additions/adjustments are following ESLint's rules and verify docs are valid.
+npm test
to verify if your additions/adjustments are following ESLint's rules and to verify if the docs are valid.
- File a Pull Request!
License
MIT
@@ -115,7 +116,7 @@ License
MIT
diff --git a/package.json b/package.json
index f30a2be..44c632d 100644
--- a/package.json
+++ b/package.json
@@ -1,11 +1,11 @@
{
"name": "discord-paginationembed",
- "version": "0.1.0",
+ "version": "0.2.0",
"description": "Pagination Embed for Discord.JS",
"main": "./src/index.js",
"scripts": {
- "test": "eslint --ignore-path .eslintignore . && npm run generate-docs",
- "generate-docs": "jsdoc -c jsdoc.json"
+ "test": "eslint ./src && npm run docs",
+ "docs": "node_modules/.bin/jsdoc -c .jsdoc.json"
},
"repository": {
"type": "git",
@@ -27,7 +27,7 @@
"url": "https://github.com/gazmull/discord-paginationembed/issues"
},
"homepage": "https://github.com/gazmull/discord-paginationembed#readme",
- "dependencies": {
+ "peerDependencies": {
"discord.js": "discordjs/discord.js"
},
"devDependencies": {
diff --git a/src/struct/Embeds.js b/src/struct/Embeds.js
index e8ed7be..ac4fb33 100644
--- a/src/struct/Embeds.js
+++ b/src/struct/Embeds.js
@@ -72,6 +72,7 @@ class Embeds extends PaginationEmbed {
/**
* The thumbnail of all embeds.
+ * @type {string}
*/
this.thumbnail = options.thumbnail || null;
@@ -96,7 +97,7 @@ class Embeds extends PaginationEmbed {
/**
* Embed in the current page.
- * @returns {MessageEmbed} - An instance of MessageEmbed.
+ * @type {MessageEmbed}
*/
get currentEmbed() {
return this.array[this.page - 1];
@@ -105,7 +106,7 @@ class Embeds extends PaginationEmbed {
/**
* Adds a blank field to the fields of all embeds.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addBlankField(inline = false) {
const arr = this.array;
@@ -121,7 +122,7 @@ class Embeds extends PaginationEmbed {
* @param {string} name - The name of the field.
* @param {string} value - The value of the field.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addField(name, value, inline = false) {
if (!name && !value) return this;
@@ -140,12 +141,12 @@ class Embeds extends PaginationEmbed {
* @example
*
* // Object as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -169,12 +170,12 @@ class Embeds extends PaginationEmbed {
* @example
*
* // Methods as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -230,7 +231,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the array of embeds to paginate.
* @param {Array} array - An array of embeds to paginate.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -251,7 +252,7 @@ class Embeds extends PaginationEmbed {
* @param {StringResolvable} name - The name of the author.
* @param {string} [iconURL=null] - The icon URL of the author.
* @param {string} [url=null] - The URL of the author.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setAuthor(name, iconURL = null, url = null) {
if (!name) return this;
@@ -267,7 +268,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the color of all embeds.
* @param {ColorResolvable} color - The color of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setColor(color) {
if (!color) return this;
@@ -283,7 +284,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the description of all embeds.
* @param {string} description - The description of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setDescription(description) {
if (!description) return this;
@@ -300,7 +301,7 @@ class Embeds extends PaginationEmbed {
* Sets the footer of all embeds.
* @param {string} text - The footer text.
* @param {string} [iconURL=null] - URL for the footer's icon.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setFooter(text, iconURL = null) {
if (!text) return this;
@@ -316,7 +317,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the image of all embeds.
* @param {string} image - The image of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setImage(image) {
if (!image) return this;
@@ -332,7 +333,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the thumbnail of all embeds.
* @param {string} thumbnail - The thumbnail of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setThumbnail(thumbnail) {
if (!thumbnail) return this;
@@ -347,7 +348,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the timestamp of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTimestamp() {
const arr = this.array;
@@ -361,7 +362,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the title of all embeds.
* @param {string} title - The title of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTitle(title) {
if (!title) return this;
@@ -377,7 +378,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the URL of all embeds.
* @param {string} url - The URL of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setURL(url) {
if (!url) return this;
diff --git a/src/struct/FieldsEmbed.js b/src/struct/FieldsEmbed.js
index 71b2281..d631b76 100644
--- a/src/struct/FieldsEmbed.js
+++ b/src/struct/FieldsEmbed.js
@@ -42,7 +42,7 @@ class FieldsEmbed extends PaginationEmbed {
/**
* Elements in the current page.
- * @returns {Array.<*>} - An array for a page.
+ * @type {Array.<*>}
*/
get elementList() {
const begin = (this.page - 1) * this.elementsPerPage;
@@ -57,11 +57,11 @@ class FieldsEmbed extends PaginationEmbed {
* @example
*
* // Object as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -87,11 +87,11 @@ class FieldsEmbed extends PaginationEmbed {
* @example
*
* // Methods as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -146,7 +146,7 @@ class FieldsEmbed extends PaginationEmbed {
* @param {string} name - Name of the field.
* @param {Function} value - Value of the field. Function for Array.prototype.map().join('\n').
* @param {boolean} [inline=true] - Whether the field is inline with other field or not.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @returns {PaginationEmbed}
*/
formatField(name, value, inline = true) {
this.fields.push({ name, value, inline });
@@ -156,10 +156,10 @@ class FieldsEmbed extends PaginationEmbed {
/**
* Sets the maximum number of elements to be displayed per page.
- * @param {number} [number=10] - Maximum number of elements to be displayed per page.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @param {number} number - Maximum number of elements to be displayed per page.
+ * @returns {PaginationEmbed}
*/
- setElementsPerPage(number = 10) {
+ setElementsPerPage(number) {
if (typeof number !== 'number') throw new Error('setElementsPerPage() only accepts number type.');
this.elementsPerPage = number;
diff --git a/src/struct/base/PaginationEmbed.js b/src/struct/base/PaginationEmbed.js
index 11a5a9f..9f9ec45 100644
--- a/src/struct/base/PaginationEmbed.js
+++ b/src/struct/base/PaginationEmbed.js
@@ -24,7 +24,7 @@ class PaginationEmbed extends MessageEmbed {
/**
* Options for the constructor.
* @typedef {Object} PaginationEmbedOptions
- * @property {User} [authorisedUser=null] - The authorised user to navigate the pages.
+ * @property {User} [authorizedUser=null] - The authorized user to navigate the pages.
* @property {TextChannel} channel - The channel where to send the embed.
* @property {ClientMessageOptions} [clientMessage=null] - Settings for the message sent by the client.
* @property {Array.<*>} array - An array of elements to paginate.
@@ -43,10 +43,10 @@ class PaginationEmbed extends MessageEmbed {
super(options);
/**
- * The authorised user to navigate the pages.
+ * The authorized user to navigate the pages.
* @type {User}
*/
- this.authorisedUser = options.authorisedUser || null;
+ this.authorizedUser = options.authorizedUser || null;
/**
* The channel where to send the embed.
@@ -110,7 +110,7 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the array of elements to paginate.
* @param {Array} array - An array of elements to paginate.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -123,12 +123,12 @@ class PaginationEmbed extends MessageEmbed {
}
/**
- * Set the authorised person to navigate the pages.
- * @param {User} [user=null] - The user object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * Set the authorized person to navigate the pages.
+ * @param {User} user - The user object.
+ * @returns {PaginationEmbed}
*/
- setAuthorisedUser(user = null) {
- this.authorisedUser = user;
+ setAuthorizedUser(user) {
+ this.authorizedUser = user;
return this;
}
@@ -136,7 +136,7 @@ class PaginationEmbed extends MessageEmbed {
/**
* The channel where to send the embed.
* @param {TextChannel} channel - The channel object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setChannel(channel) {
this.channel = channel;
@@ -146,11 +146,11 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the settings for the message sent by the client.
- * @param {Message} [message=null] - The message object sent by the client, if there is any.
+ * @param {Message} message - The message object sent by the client.
* @param {string} [content='Preparing...'] - The custom message content while preparing the embed.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
- setClientMessage(message = null, content = null) {
+ setClientMessage(message, content = null) {
if (!content) content = 'Preparing...';
Object.assign(this.clientMessage, { message, content });
@@ -160,8 +160,8 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the emojis used for navigation buttons.
- * @param {NavigationButtons} [emojis={}] - An object containing customised emojis to use as navigation buttons.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {NavigationButtons} emojis - An object containing customised emojis to use as navigation buttons.
+ * @returns {PaginationEmbed}
*/
setEmojis(emojis) {
Object.assign(this.emojis, emojis);
@@ -171,10 +171,10 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets to jump to a certain page upon calling PaginationEmbed.build().
- * @param {number|string} [param=1] - The page number to jump to. As String: 'back', 'forward'
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number|string} param - The page number to jump to. As String: 'back', 'forward'
+ * @returns {PaginationEmbed}
*/
- setPage(param = 1) {
+ setPage(param) {
const isString = typeof param === 'string';
if (!(!isNaN(param) || isString)) throw new Error('setPage() only accepts number/string type.');
@@ -190,10 +190,10 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the time for awaiting a user action before timeout in ms.
- * @param {number} [timeout=30000] Timeout value in ms.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number} timeout Timeout value in ms.
+ * @returns {PaginationEmbed}
*/
- setTimeout(timeout = 30000) {
+ setTimeout(timeout) {
if (typeof timeout !== 'number') throw new Error('setTimeout() only accepts number type.');
this.timeout = timeout;
@@ -203,10 +203,10 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets whether page number indicator on client's message is shown or not.
- * @param {boolean} [boolean=true] - Show page indicator?
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {boolean} boolean - Show page indicator?
+ * @returns {PaginationEmbed}
*/
- showPageIndicator(boolean = true) {
+ showPageIndicator(boolean) {
if (typeof boolean !== 'boolean') throw new Error('showPageIndicator() only accepts boolean type.');
this.pageIndicator = boolean;
@@ -222,7 +222,7 @@ class PaginationEmbed extends MessageEmbed {
async _verify(pages) {
this
.setChannel(this.channel)
- .setAuthorisedUser(this.authorisedUser)
+ .setAuthorizedUser(this.authorizedUser)
.setClientMessage(this.clientMessage.message, this.clientMessage.content)
.setArray(this.array)
.showPageIndicator(this.pageIndicator)
@@ -298,8 +298,8 @@ class PaginationEmbed extends MessageEmbed {
async _awaitResponse() {
const emojis = Object.values(this.emojis);
const filter = (r, u) => {
- if (this.authorisedUser)
- return u.id === this.authorisedUser.id && emojis.includes(r.emoji.name);
+ if (this.authorizedUser)
+ return u.id === this.authorizedUser.id && emojis.includes(r.emoji.name);
return !u.bot && emojis.includes(r.emoji.name);
};
-
+
- + +string + + + +
Methods
-addBlankField(inlineopt) → {Embeds}
+addBlankField(inlineopt) → {PaginationEmbed}
@@ -1657,7 +1677,7 @@addBlank
Source:
@@ -1794,10 +1814,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -1806,7 +1822,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -1820,7 +1836,7 @@ Returns:
- addField(name, value, inlineopt) → {Embeds}
+ addField(name, value, inlineopt) → {PaginationEmbed}
@@ -1832,7 +1848,7 @@ addFieldSource:
@@ -2039,10 +2055,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -2051,7 +2063,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -2077,7 +2089,7 @@ (async) buildSource:
@@ -2130,9 +2142,9 @@ (async) buildExamples
- // Object as constructor.
const Embeds = require('discord-paginationembed').Embeds;
const { MessageEmbed } = require('discord.js');
// Under message event.
new Embeds({
authorisedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
new MessageEmbed({ title: 'John Doe' }),
new MessageEmbed({ title: 'Jane Doe' })
],
pageIndicator: false,
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
},
description: 'This is one of my embeds with this message!',
color: 0xFF00AE,
timestamp: true
}).build();
+ // Object as constructor.
const { Embeds } = require('discord-paginationembed');
const { MessageEmbed } = require('discord.js');
// Under message event.
new Embeds({
authorizedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
new MessageEmbed({ title: 'John Doe' }),
new MessageEmbed({ title: 'Jane Doe' })
],
pageIndicator: false,
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
},
description: 'This is one of my embeds with this message!',
color: 0xFF00AE,
timestamp: true
}).build();
- // Methods as constructor.
const Embeds = require('discord-paginationembed').Embeds;
const { MessageEmbed } = require('discord.js');
// Under message event.
new Embeds()
.setAuthorisedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
new MessageEmbed({ title: 'John Doe' }),
new MessageEmbed({ title: 'Jane Doe' })
])
.setPageIndicator(false)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.setDescription('This is one of my embeds with this message!')
.setColor(0xFF00AE)
.setTimestamp()
.build();
+ // Methods as constructor.
const { Embeds } = require('discord-paginationembed');
const { MessageEmbed } = require('discord.js');
// Under message event.
new Embeds()
.setAuthorizedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
new MessageEmbed({ title: 'John Doe' }),
new MessageEmbed({ title: 'Jane Doe' })
])
.setPageIndicator(false)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.setDescription('This is one of my embeds with this message!')
.setColor(0xFF00AE)
.setTimestamp()
.build();
@@ -2156,7 +2168,7 @@ Examples
- setArray(array) → {Embeds}
+ setArray(array) → {PaginationEmbed}
@@ -2168,7 +2180,7 @@ setArraySource:
@@ -2290,10 +2302,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -2302,7 +2310,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -2316,7 +2324,7 @@ Returns:
- setAuthor(name, iconURLopt, urlopt) → {Embeds}
+ setAuthor(name, iconURLopt, urlopt) → {PaginationEmbed}
@@ -2328,7 +2336,7 @@ setAuthorSource:
@@ -2539,10 +2547,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -2551,7 +2555,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -2565,7 +2569,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -2588,7 +2592,7 @@ setA
- Inherited From:
@@ -2622,7 +2626,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -2648,12 +2652,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2677,23 +2677,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -2719,10 +2703,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2879,10 +2859,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2905,7 +2881,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -3019,8 +2995,6 @@ Parameters:
- <optional>
-
@@ -3031,12 +3005,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -3098,10 +3070,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -3124,7 +3092,7 @@ Returns:
- setColor(color) → {Embeds}
+ setColor(color) → {PaginationEmbed}
@@ -3136,7 +3104,7 @@ setColorSource:
@@ -3253,10 +3221,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3265,7 +3229,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3279,7 +3243,7 @@ Returns:
- setDescription(description) → {Embeds}
+ setDescription(description) → {PaginationEmbed}
@@ -3291,7 +3255,7 @@ setDesc
- Source:
@@ -3408,10 +3372,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3420,7 +3380,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3434,7 +3394,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -3517,12 +3477,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -3546,23 +3502,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -3588,10 +3528,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -3614,7 +3550,7 @@ Returns:
- setFooter(text, iconURLopt) → {Embeds}
+ setFooter(text, iconURLopt) → {PaginationEmbed}
@@ -3626,7 +3562,7 @@ setFooterSource:
@@ -3798,10 +3734,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3810,7 +3742,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3824,7 +3756,7 @@ Returns:
- setImage(image) → {Embeds}
+ setImage(image) → {PaginationEmbed}
@@ -3836,7 +3768,7 @@ setImageSource:
@@ -3953,10 +3885,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3965,7 +3893,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3979,7 +3907,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -4062,12 +3990,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -4094,23 +4018,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -4136,10 +4044,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -4162,7 +4066,7 @@ Returns:
- setThumbnail(thumbnail) → {Embeds}
+ setThumbnail(thumbnail) → {PaginationEmbed}
@@ -4174,7 +4078,7 @@ setThumbn
- Source:
@@ -4291,10 +4195,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4303,7 +4203,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4317,7 +4217,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -4400,12 +4300,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -4429,23 +4325,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -4471,10 +4351,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -4497,7 +4373,7 @@ Returns:
- setTimestamp() → {Embeds}
+ setTimestamp() → {PaginationEmbed}
@@ -4509,7 +4385,7 @@ setTimest
- Source:
@@ -4577,10 +4453,6 @@ setTimest
Returns:
-
- - Instance of Embeds
-
-
@@ -4589,7 +4461,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4603,7 +4475,7 @@ Returns:
- setTitle(title) → {Embeds}
+ setTitle(title) → {PaginationEmbed}
@@ -4615,7 +4487,7 @@ setTitleSource:
@@ -4732,10 +4604,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4744,7 +4612,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4758,7 +4626,7 @@ Returns:
- setURL(url) → {Embeds}
+ setURL(url) → {PaginationEmbed}
@@ -4770,7 +4638,7 @@ setURLSource:
@@ -4887,10 +4755,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4899,7 +4763,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4913,7 +4777,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -4996,12 +4860,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -5025,23 +4885,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- true
-
-
Show page indicator?
@@ -5067,10 +4911,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -5106,7 +4946,7 @@ Returns:
diff --git a/docs/Embeds.js.html b/docs/Embeds.js.html
index 637f285..ba6e1c4 100644
--- a/docs/Embeds.js.html
+++ b/docs/Embeds.js.html
@@ -22,7 +22,7 @@
@@ -111,6 +111,7 @@ Embeds.js
/**
* The thumbnail of all embeds.
+ * @type {string}
*/
this.thumbnail = options.thumbnail || null;
@@ -135,7 +136,7 @@ Embeds.js
/**
* Embed in the current page.
- * @returns {MessageEmbed} - An instance of MessageEmbed.
+ * @type {MessageEmbed}
*/
get currentEmbed() {
return this.array[this.page - 1];
@@ -144,7 +145,7 @@ Embeds.js
/**
* Adds a blank field to the fields of all embeds.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addBlankField(inline = false) {
const arr = this.array;
@@ -160,7 +161,7 @@ Embeds.js
* @param {string} name - The name of the field.
* @param {string} value - The value of the field.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addField(name, value, inline = false) {
if (!name && !value) return this;
@@ -179,12 +180,12 @@ Embeds.js
* @example
*
* // Object as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -208,12 +209,12 @@ Embeds.js
* @example
*
* // Methods as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -269,7 +270,7 @@ Embeds.js
/**
* Sets the array of embeds to paginate.
* @param {Array} array - An array of embeds to paginate.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -290,7 +291,7 @@ Embeds.js
* @param {StringResolvable} name - The name of the author.
* @param {string} [iconURL=null] - The icon URL of the author.
* @param {string} [url=null] - The URL of the author.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setAuthor(name, iconURL = null, url = null) {
if (!name) return this;
@@ -306,7 +307,7 @@ Embeds.js
/**
* Sets the color of all embeds.
* @param {ColorResolvable} color - The color of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setColor(color) {
if (!color) return this;
@@ -322,7 +323,7 @@ Embeds.js
/**
* Sets the description of all embeds.
* @param {string} description - The description of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setDescription(description) {
if (!description) return this;
@@ -339,7 +340,7 @@ Embeds.js
* Sets the footer of all embeds.
* @param {string} text - The footer text.
* @param {string} [iconURL=null] - URL for the footer's icon.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setFooter(text, iconURL = null) {
if (!text) return this;
@@ -355,7 +356,7 @@ Embeds.js
/**
* Sets the image of all embeds.
* @param {string} image - The image of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setImage(image) {
if (!image) return this;
@@ -371,7 +372,7 @@ Embeds.js
/**
* Sets the thumbnail of all embeds.
* @param {string} thumbnail - The thumbnail of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setThumbnail(thumbnail) {
if (!thumbnail) return this;
@@ -386,7 +387,7 @@ Embeds.js
/**
* Sets the timestamp of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTimestamp() {
const arr = this.array;
@@ -400,7 +401,7 @@ Embeds.js
/**
* Sets the title of all embeds.
* @param {string} title - The title of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTitle(title) {
if (!title) return this;
@@ -416,7 +417,7 @@ Embeds.js
/**
* Sets the URL of all embeds.
* @param {string} url - The URL of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setURL(url) {
if (!url) return this;
@@ -455,7 +456,7 @@ Embeds.js
diff --git a/docs/FieldsEmbed.html b/docs/FieldsEmbed.html
index 948c77a..e3a7000 100644
--- a/docs/FieldsEmbed.html
+++ b/docs/FieldsEmbed.html
@@ -22,7 +22,7 @@
@@ -304,7 +304,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -326,7 +326,7 @@ authori
- Inherited From:
@@ -360,7 +360,7 @@ authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -538,7 +538,7 @@ Type:
-elementList
+elementList :Array.<*>
@@ -594,6 +594,16 @@ elementLis
+ Type:
+
+ -
+
+Array.<*>
+
+
+
+
+
@@ -1063,9 +1073,9 @@ (async) buildExamples
- // Object as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed({
authorisedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
+ // Object as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed({
authorizedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
- // Methods as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed()
.setAuthorisedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
+ // Methods as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed()
.setAuthorizedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
@@ -1089,7 +1099,7 @@ Examples
- formatField(name, value, inlineopt) → {FieldsEmbed}
+ formatField(name, value, inlineopt) → {PaginationEmbed}
@@ -1308,10 +1318,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -1320,7 +1326,7 @@ Returns:
-
-FieldsEmbed
+PaginationEmbed
@@ -1468,10 +1474,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1494,7 +1496,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1517,7 +1519,7 @@ setA
- Inherited From:
@@ -1551,7 +1553,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1577,12 +1579,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1606,23 +1604,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1648,10 +1630,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1808,10 +1786,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1834,7 +1808,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1948,8 +1922,6 @@ Parameters:
- <optional>
-
@@ -1960,12 +1932,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -2027,10 +1997,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2053,7 +2019,7 @@ Returns:
- setElementsPerPage(numberopt) → {FieldsEmbed}
+ setElementsPerPage(number) → {PaginationEmbed}
@@ -2131,12 +2097,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2160,24 +2122,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 10
-
-
-
Maximum number of elements to be displayed per page.
@@ -2202,10 +2148,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -2214,7 +2156,7 @@ Returns:
-
-FieldsEmbed
+PaginationEmbed
@@ -2228,7 +2170,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -2311,12 +2253,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2340,23 +2278,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -2382,10 +2304,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2408,7 +2326,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -2491,12 +2409,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2523,24 +2437,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 1
-
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -2565,10 +2463,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2591,7 +2485,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -2674,12 +2568,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2703,23 +2593,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2745,10 +2619,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2771,7 +2641,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2854,12 +2724,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2883,24 +2749,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2925,10 +2775,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2964,7 +2810,7 @@ Returns:
diff --git a/docs/FieldsEmbed.js.html b/docs/FieldsEmbed.js.html
index 5d36097..9bad270 100644
--- a/docs/FieldsEmbed.js.html
+++ b/docs/FieldsEmbed.js.html
@@ -22,7 +22,7 @@
@@ -81,7 +81,7 @@ FieldsEmbed.js
/**
* Elements in the current page.
- * @returns {Array.<*>} - An array for a page.
+ * @type {Array.<*>}
*/
get elementList() {
const begin = (this.page - 1) * this.elementsPerPage;
@@ -96,11 +96,11 @@ FieldsEmbed.js
* @example
*
* // Object as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -126,11 +126,11 @@ FieldsEmbed.js
* @example
*
* // Methods as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -185,7 +185,7 @@ FieldsEmbed.js
* @param {string} name - Name of the field.
* @param {Function} value - Value of the field. Function for Array.prototype.map().join('\n').
* @param {boolean} [inline=true] - Whether the field is inline with other field or not.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @returns {PaginationEmbed}
*/
formatField(name, value, inline = true) {
this.fields.push({ name, value, inline });
@@ -195,10 +195,10 @@ FieldsEmbed.js
/**
* Sets the maximum number of elements to be displayed per page.
- * @param {number} [number=10] - Maximum number of elements to be displayed per page.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @param {number} number - Maximum number of elements to be displayed per page.
+ * @returns {PaginationEmbed}
*/
- setElementsPerPage(number = 10) {
+ setElementsPerPage(number) {
if (typeof number !== 'number') throw new Error('setElementsPerPage() only accepts number type.');
this.elementsPerPage = number;
@@ -266,7 +266,7 @@ FieldsEmbed.js
diff --git a/docs/PaginationEmbed.html b/docs/PaginationEmbed.html
index 58d735a..994485d 100644
--- a/docs/PaginationEmbed.html
+++ b/docs/PaginationEmbed.html
@@ -22,7 +22,7 @@
@@ -299,7 +299,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -350,7 +350,7 @@ authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -951,10 +951,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -977,7 +973,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1029,7 +1025,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1055,12 +1051,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1084,23 +1076,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1126,10 +1102,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1281,10 +1253,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1307,7 +1275,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1416,8 +1384,6 @@ Parameters:
- <optional>
-
@@ -1428,12 +1394,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -1495,10 +1459,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1521,7 +1481,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -1599,12 +1559,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1628,23 +1584,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -1670,10 +1610,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1696,7 +1632,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -1774,12 +1710,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1806,23 +1738,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -1848,10 +1764,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1874,7 +1786,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -1952,12 +1864,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1981,23 +1889,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2023,10 +1915,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2049,7 +1937,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2127,12 +2015,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2156,24 +2040,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2198,10 +2066,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2237,7 +2101,7 @@ Returns:
diff --git a/docs/base_PaginationEmbed.js.html b/docs/base_PaginationEmbed.js.html
index c40af28..e74e322 100644
--- a/docs/base_PaginationEmbed.js.html
+++ b/docs/base_PaginationEmbed.js.html
@@ -22,7 +22,7 @@
@@ -63,7 +63,7 @@ base/PaginationEmbed.js
/**
* Options for the constructor.
* @typedef {Object} PaginationEmbedOptions
- * @property {User} [authorisedUser=null] - The authorised user to navigate the pages.
+ * @property {User} [authorizedUser=null] - The authorized user to navigate the pages.
* @property {TextChannel} channel - The channel where to send the embed.
* @property {ClientMessageOptions} [clientMessage=null] - Settings for the message sent by the client.
* @property {Array.<*>} array - An array of elements to paginate.
@@ -82,10 +82,10 @@ base/PaginationEmbed.js
super(options);
/**
- * The authorised user to navigate the pages.
+ * The authorized user to navigate the pages.
* @type {User}
*/
- this.authorisedUser = options.authorisedUser || null;
+ this.authorizedUser = options.authorizedUser || null;
/**
* The channel where to send the embed.
@@ -149,7 +149,7 @@ base/PaginationEmbed.js
/**
* Sets the array of elements to paginate.
* @param {Array} array - An array of elements to paginate.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -162,12 +162,12 @@ base/PaginationEmbed.js
}
/**
- * Set the authorised person to navigate the pages.
- * @param {User} [user=null] - The user object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * Set the authorized person to navigate the pages.
+ * @param {User} user - The user object.
+ * @returns {PaginationEmbed}
*/
- setAuthorisedUser(user = null) {
- this.authorisedUser = user;
+ setAuthorizedUser(user) {
+ this.authorizedUser = user;
return this;
}
@@ -175,7 +175,7 @@ base/PaginationEmbed.js
/**
* The channel where to send the embed.
* @param {TextChannel} channel - The channel object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setChannel(channel) {
this.channel = channel;
@@ -185,11 +185,11 @@ base/PaginationEmbed.js
/**
* Sets the settings for the message sent by the client.
- * @param {Message} [message=null] - The message object sent by the client, if there is any.
+ * @param {Message} message - The message object sent by the client.
* @param {string} [content='Preparing...'] - The custom message content while preparing the embed.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
- setClientMessage(message = null, content = null) {
+ setClientMessage(message, content = null) {
if (!content) content = 'Preparing...';
Object.assign(this.clientMessage, { message, content });
@@ -199,8 +199,8 @@ base/PaginationEmbed.js
/**
* Sets the emojis used for navigation buttons.
- * @param {NavigationButtons} [emojis={}] - An object containing customised emojis to use as navigation buttons.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {NavigationButtons} emojis - An object containing customised emojis to use as navigation buttons.
+ * @returns {PaginationEmbed}
*/
setEmojis(emojis) {
Object.assign(this.emojis, emojis);
@@ -210,10 +210,10 @@ base/PaginationEmbed.js
/**
* Sets to jump to a certain page upon calling PaginationEmbed.build().
- * @param {number|string} [param=1] - The page number to jump to. As String: 'back', 'forward'
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number|string} param - The page number to jump to. As String: 'back', 'forward'
+ * @returns {PaginationEmbed}
*/
- setPage(param = 1) {
+ setPage(param) {
const isString = typeof param === 'string';
if (!(!isNaN(param) || isString)) throw new Error('setPage() only accepts number/string type.');
@@ -229,10 +229,10 @@ base/PaginationEmbed.js
/**
* Sets the time for awaiting a user action before timeout in ms.
- * @param {number} [timeout=30000] Timeout value in ms.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number} timeout Timeout value in ms.
+ * @returns {PaginationEmbed}
*/
- setTimeout(timeout = 30000) {
+ setTimeout(timeout) {
if (typeof timeout !== 'number') throw new Error('setTimeout() only accepts number type.');
this.timeout = timeout;
@@ -242,10 +242,10 @@ base/PaginationEmbed.js
/**
* Sets whether page number indicator on client's message is shown or not.
- * @param {boolean} [boolean=true] - Show page indicator?
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {boolean} boolean - Show page indicator?
+ * @returns {PaginationEmbed}
*/
- showPageIndicator(boolean = true) {
+ showPageIndicator(boolean) {
if (typeof boolean !== 'boolean') throw new Error('showPageIndicator() only accepts boolean type.');
this.pageIndicator = boolean;
@@ -261,7 +261,7 @@ base/PaginationEmbed.js
async _verify(pages) {
this
.setChannel(this.channel)
- .setAuthorisedUser(this.authorisedUser)
+ .setAuthorizedUser(this.authorizedUser)
.setClientMessage(this.clientMessage.message, this.clientMessage.content)
.setArray(this.array)
.showPageIndicator(this.pageIndicator)
@@ -337,8 +337,8 @@ base/PaginationEmbed.js
async _awaitResponse() {
const emojis = Object.values(this.emojis);
const filter = (r, u) => {
- if (this.authorisedUser)
- return u.id === this.authorisedUser.id && emojis.includes(r.emoji.name);
+ if (this.authorizedUser)
+ return u.id === this.authorizedUser.id && emojis.includes(r.emoji.name);
return !u.bot && emojis.includes(r.emoji.name);
};
@@ -432,7 +432,7 @@ base/PaginationEmbed.js
diff --git a/docs/global.html b/docs/global.html
index 23000ba..3f7e34b 100644
--- a/docs/global.html
+++ b/docs/global.html
@@ -22,7 +22,7 @@
@@ -1487,7 +1487,7 @@ Properties:
- authorisedUser
+ authorizedUser
@@ -1517,7 +1517,7 @@ Properties:
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -1820,7 +1820,7 @@ Type:
diff --git a/docs/index.html b/docs/index.html
index 80eb8c4..c53f893 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -22,7 +22,7 @@
@@ -51,20 +51,21 @@ Home
Classes
const FieldsEmbedMode = require('discord-paginationembed').FieldsEmbed;
+const { FieldsEmbed: FieldsEmbedMode } = require('discord-paginationembed');
new FieldsEmbedMode()
.setArray([ { name: "John Doe" }, { name: "Jane Doe" } ])
- .setAuthorisedUser(message.author)
+ .setAuthorizedUser(message.author)
.setChannel(message.channel)
.setElementsPerPage(1)
.setPage(2)
.showPageIndicator(false)
- .build();
const EmbedsMode = require('discord-paginationembed').Embeds;
+ .build();
const { Embeds: EmbedsMode } = require('discord-paginationembed');
const { MessageEmbed } = require("discord.js");
const embeds = [];
@@ -76,7 +77,7 @@ Under message
event
new EmbedsMode()
.setArray(embeds)
- .setAuthorisedUser(message.author)
+ .setAuthorizedUser(message.author)
.setChannel(message.channel)
.showPageIndicator(true)
.setPage(3)
@@ -99,7 +100,7 @@ Contributing
- Fork this repository.
- Execute
npm install
- Code and code and code and code and... code!
-npm test
to verify your additions/adjustments are following ESLint's rules and verify docs are valid.
+npm test
to verify if your additions/adjustments are following ESLint's rules and to verify if the docs are valid.
- File a Pull Request!
License
MIT
@@ -115,7 +116,7 @@ License
MIT
diff --git a/package.json b/package.json
index f30a2be..44c632d 100644
--- a/package.json
+++ b/package.json
@@ -1,11 +1,11 @@
{
"name": "discord-paginationembed",
- "version": "0.1.0",
+ "version": "0.2.0",
"description": "Pagination Embed for Discord.JS",
"main": "./src/index.js",
"scripts": {
- "test": "eslint --ignore-path .eslintignore . && npm run generate-docs",
- "generate-docs": "jsdoc -c jsdoc.json"
+ "test": "eslint ./src && npm run docs",
+ "docs": "node_modules/.bin/jsdoc -c .jsdoc.json"
},
"repository": {
"type": "git",
@@ -27,7 +27,7 @@
"url": "https://github.com/gazmull/discord-paginationembed/issues"
},
"homepage": "https://github.com/gazmull/discord-paginationembed#readme",
- "dependencies": {
+ "peerDependencies": {
"discord.js": "discordjs/discord.js"
},
"devDependencies": {
diff --git a/src/struct/Embeds.js b/src/struct/Embeds.js
index e8ed7be..ac4fb33 100644
--- a/src/struct/Embeds.js
+++ b/src/struct/Embeds.js
@@ -72,6 +72,7 @@ class Embeds extends PaginationEmbed {
/**
* The thumbnail of all embeds.
+ * @type {string}
*/
this.thumbnail = options.thumbnail || null;
@@ -96,7 +97,7 @@ class Embeds extends PaginationEmbed {
/**
* Embed in the current page.
- * @returns {MessageEmbed} - An instance of MessageEmbed.
+ * @type {MessageEmbed}
*/
get currentEmbed() {
return this.array[this.page - 1];
@@ -105,7 +106,7 @@ class Embeds extends PaginationEmbed {
/**
* Adds a blank field to the fields of all embeds.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addBlankField(inline = false) {
const arr = this.array;
@@ -121,7 +122,7 @@ class Embeds extends PaginationEmbed {
* @param {string} name - The name of the field.
* @param {string} value - The value of the field.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addField(name, value, inline = false) {
if (!name && !value) return this;
@@ -140,12 +141,12 @@ class Embeds extends PaginationEmbed {
* @example
*
* // Object as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -169,12 +170,12 @@ class Embeds extends PaginationEmbed {
* @example
*
* // Methods as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -230,7 +231,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the array of embeds to paginate.
* @param {Array} array - An array of embeds to paginate.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -251,7 +252,7 @@ class Embeds extends PaginationEmbed {
* @param {StringResolvable} name - The name of the author.
* @param {string} [iconURL=null] - The icon URL of the author.
* @param {string} [url=null] - The URL of the author.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setAuthor(name, iconURL = null, url = null) {
if (!name) return this;
@@ -267,7 +268,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the color of all embeds.
* @param {ColorResolvable} color - The color of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setColor(color) {
if (!color) return this;
@@ -283,7 +284,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the description of all embeds.
* @param {string} description - The description of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setDescription(description) {
if (!description) return this;
@@ -300,7 +301,7 @@ class Embeds extends PaginationEmbed {
* Sets the footer of all embeds.
* @param {string} text - The footer text.
* @param {string} [iconURL=null] - URL for the footer's icon.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setFooter(text, iconURL = null) {
if (!text) return this;
@@ -316,7 +317,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the image of all embeds.
* @param {string} image - The image of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setImage(image) {
if (!image) return this;
@@ -332,7 +333,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the thumbnail of all embeds.
* @param {string} thumbnail - The thumbnail of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setThumbnail(thumbnail) {
if (!thumbnail) return this;
@@ -347,7 +348,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the timestamp of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTimestamp() {
const arr = this.array;
@@ -361,7 +362,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the title of all embeds.
* @param {string} title - The title of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTitle(title) {
if (!title) return this;
@@ -377,7 +378,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the URL of all embeds.
* @param {string} url - The URL of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setURL(url) {
if (!url) return this;
diff --git a/src/struct/FieldsEmbed.js b/src/struct/FieldsEmbed.js
index 71b2281..d631b76 100644
--- a/src/struct/FieldsEmbed.js
+++ b/src/struct/FieldsEmbed.js
@@ -42,7 +42,7 @@ class FieldsEmbed extends PaginationEmbed {
/**
* Elements in the current page.
- * @returns {Array.<*>} - An array for a page.
+ * @type {Array.<*>}
*/
get elementList() {
const begin = (this.page - 1) * this.elementsPerPage;
@@ -57,11 +57,11 @@ class FieldsEmbed extends PaginationEmbed {
* @example
*
* // Object as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -87,11 +87,11 @@ class FieldsEmbed extends PaginationEmbed {
* @example
*
* // Methods as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -146,7 +146,7 @@ class FieldsEmbed extends PaginationEmbed {
* @param {string} name - Name of the field.
* @param {Function} value - Value of the field. Function for Array.prototype.map().join('\n').
* @param {boolean} [inline=true] - Whether the field is inline with other field or not.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @returns {PaginationEmbed}
*/
formatField(name, value, inline = true) {
this.fields.push({ name, value, inline });
@@ -156,10 +156,10 @@ class FieldsEmbed extends PaginationEmbed {
/**
* Sets the maximum number of elements to be displayed per page.
- * @param {number} [number=10] - Maximum number of elements to be displayed per page.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @param {number} number - Maximum number of elements to be displayed per page.
+ * @returns {PaginationEmbed}
*/
- setElementsPerPage(number = 10) {
+ setElementsPerPage(number) {
if (typeof number !== 'number') throw new Error('setElementsPerPage() only accepts number type.');
this.elementsPerPage = number;
diff --git a/src/struct/base/PaginationEmbed.js b/src/struct/base/PaginationEmbed.js
index 11a5a9f..9f9ec45 100644
--- a/src/struct/base/PaginationEmbed.js
+++ b/src/struct/base/PaginationEmbed.js
@@ -24,7 +24,7 @@ class PaginationEmbed extends MessageEmbed {
/**
* Options for the constructor.
* @typedef {Object} PaginationEmbedOptions
- * @property {User} [authorisedUser=null] - The authorised user to navigate the pages.
+ * @property {User} [authorizedUser=null] - The authorized user to navigate the pages.
* @property {TextChannel} channel - The channel where to send the embed.
* @property {ClientMessageOptions} [clientMessage=null] - Settings for the message sent by the client.
* @property {Array.<*>} array - An array of elements to paginate.
@@ -43,10 +43,10 @@ class PaginationEmbed extends MessageEmbed {
super(options);
/**
- * The authorised user to navigate the pages.
+ * The authorized user to navigate the pages.
* @type {User}
*/
- this.authorisedUser = options.authorisedUser || null;
+ this.authorizedUser = options.authorizedUser || null;
/**
* The channel where to send the embed.
@@ -110,7 +110,7 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the array of elements to paginate.
* @param {Array} array - An array of elements to paginate.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -123,12 +123,12 @@ class PaginationEmbed extends MessageEmbed {
}
/**
- * Set the authorised person to navigate the pages.
- * @param {User} [user=null] - The user object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * Set the authorized person to navigate the pages.
+ * @param {User} user - The user object.
+ * @returns {PaginationEmbed}
*/
- setAuthorisedUser(user = null) {
- this.authorisedUser = user;
+ setAuthorizedUser(user) {
+ this.authorizedUser = user;
return this;
}
@@ -136,7 +136,7 @@ class PaginationEmbed extends MessageEmbed {
/**
* The channel where to send the embed.
* @param {TextChannel} channel - The channel object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setChannel(channel) {
this.channel = channel;
@@ -146,11 +146,11 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the settings for the message sent by the client.
- * @param {Message} [message=null] - The message object sent by the client, if there is any.
+ * @param {Message} message - The message object sent by the client.
* @param {string} [content='Preparing...'] - The custom message content while preparing the embed.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
- setClientMessage(message = null, content = null) {
+ setClientMessage(message, content = null) {
if (!content) content = 'Preparing...';
Object.assign(this.clientMessage, { message, content });
@@ -160,8 +160,8 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the emojis used for navigation buttons.
- * @param {NavigationButtons} [emojis={}] - An object containing customised emojis to use as navigation buttons.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {NavigationButtons} emojis - An object containing customised emojis to use as navigation buttons.
+ * @returns {PaginationEmbed}
*/
setEmojis(emojis) {
Object.assign(this.emojis, emojis);
@@ -171,10 +171,10 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets to jump to a certain page upon calling PaginationEmbed.build().
- * @param {number|string} [param=1] - The page number to jump to. As String: 'back', 'forward'
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number|string} param - The page number to jump to. As String: 'back', 'forward'
+ * @returns {PaginationEmbed}
*/
- setPage(param = 1) {
+ setPage(param) {
const isString = typeof param === 'string';
if (!(!isNaN(param) || isString)) throw new Error('setPage() only accepts number/string type.');
@@ -190,10 +190,10 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the time for awaiting a user action before timeout in ms.
- * @param {number} [timeout=30000] Timeout value in ms.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number} timeout Timeout value in ms.
+ * @returns {PaginationEmbed}
*/
- setTimeout(timeout = 30000) {
+ setTimeout(timeout) {
if (typeof timeout !== 'number') throw new Error('setTimeout() only accepts number type.');
this.timeout = timeout;
@@ -203,10 +203,10 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets whether page number indicator on client's message is shown or not.
- * @param {boolean} [boolean=true] - Show page indicator?
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {boolean} boolean - Show page indicator?
+ * @returns {PaginationEmbed}
*/
- showPageIndicator(boolean = true) {
+ showPageIndicator(boolean) {
if (typeof boolean !== 'boolean') throw new Error('showPageIndicator() only accepts boolean type.');
this.pageIndicator = boolean;
@@ -222,7 +222,7 @@ class PaginationEmbed extends MessageEmbed {
async _verify(pages) {
this
.setChannel(this.channel)
- .setAuthorisedUser(this.authorisedUser)
+ .setAuthorizedUser(this.authorizedUser)
.setClientMessage(this.clientMessage.message, this.clientMessage.content)
.setArray(this.array)
.showPageIndicator(this.pageIndicator)
@@ -298,8 +298,8 @@ class PaginationEmbed extends MessageEmbed {
async _awaitResponse() {
const emojis = Object.values(this.emojis);
const filter = (r, u) => {
- if (this.authorisedUser)
- return u.id === this.authorisedUser.id && emojis.includes(r.emoji.name);
+ if (this.authorizedUser)
+ return u.id === this.authorizedUser.id && emojis.includes(r.emoji.name);
return !u.bot && emojis.includes(r.emoji.name);
};
Returns:
Returns:
-addField(name, value, inlineopt) → {Embeds}
+addField(name, value, inlineopt) → {PaginationEmbed}
@@ -1832,7 +1848,7 @@addFieldSource:
@@ -2039,10 +2055,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -2051,7 +2063,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -2077,7 +2089,7 @@ (async) buildSource:
@@ -2130,9 +2142,9 @@ (async) buildExamples
- // Object as constructor.
const Embeds = require('discord-paginationembed').Embeds;
const { MessageEmbed } = require('discord.js');
// Under message event.
new Embeds({
authorisedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
new MessageEmbed({ title: 'John Doe' }),
new MessageEmbed({ title: 'Jane Doe' })
],
pageIndicator: false,
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
},
description: 'This is one of my embeds with this message!',
color: 0xFF00AE,
timestamp: true
}).build();
+ // Object as constructor.
const { Embeds } = require('discord-paginationembed');
const { MessageEmbed } = require('discord.js');
// Under message event.
new Embeds({
authorizedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
new MessageEmbed({ title: 'John Doe' }),
new MessageEmbed({ title: 'Jane Doe' })
],
pageIndicator: false,
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
},
description: 'This is one of my embeds with this message!',
color: 0xFF00AE,
timestamp: true
}).build();
- // Methods as constructor.
const Embeds = require('discord-paginationembed').Embeds;
const { MessageEmbed } = require('discord.js');
// Under message event.
new Embeds()
.setAuthorisedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
new MessageEmbed({ title: 'John Doe' }),
new MessageEmbed({ title: 'Jane Doe' })
])
.setPageIndicator(false)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.setDescription('This is one of my embeds with this message!')
.setColor(0xFF00AE)
.setTimestamp()
.build();
+ // Methods as constructor.
const { Embeds } = require('discord-paginationembed');
const { MessageEmbed } = require('discord.js');
// Under message event.
new Embeds()
.setAuthorizedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
new MessageEmbed({ title: 'John Doe' }),
new MessageEmbed({ title: 'Jane Doe' })
])
.setPageIndicator(false)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.setDescription('This is one of my embeds with this message!')
.setColor(0xFF00AE)
.setTimestamp()
.build();
@@ -2156,7 +2168,7 @@ Examples
- setArray(array) → {Embeds}
+ setArray(array) → {PaginationEmbed}
@@ -2168,7 +2180,7 @@ setArraySource:
@@ -2290,10 +2302,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -2302,7 +2310,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -2316,7 +2324,7 @@ Returns:
- setAuthor(name, iconURLopt, urlopt) → {Embeds}
+ setAuthor(name, iconURLopt, urlopt) → {PaginationEmbed}
@@ -2328,7 +2336,7 @@ setAuthorSource:
@@ -2539,10 +2547,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -2551,7 +2555,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -2565,7 +2569,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -2588,7 +2592,7 @@ setA
- Inherited From:
@@ -2622,7 +2626,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -2648,12 +2652,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2677,23 +2677,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -2719,10 +2703,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2879,10 +2859,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2905,7 +2881,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -3019,8 +2995,6 @@ Parameters:
- <optional>
-
@@ -3031,12 +3005,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -3098,10 +3070,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -3124,7 +3092,7 @@ Returns:
- setColor(color) → {Embeds}
+ setColor(color) → {PaginationEmbed}
@@ -3136,7 +3104,7 @@ setColorSource:
@@ -3253,10 +3221,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3265,7 +3229,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3279,7 +3243,7 @@ Returns:
- setDescription(description) → {Embeds}
+ setDescription(description) → {PaginationEmbed}
@@ -3291,7 +3255,7 @@ setDesc
- Source:
@@ -3408,10 +3372,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3420,7 +3380,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3434,7 +3394,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -3517,12 +3477,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -3546,23 +3502,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -3588,10 +3528,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -3614,7 +3550,7 @@ Returns:
- setFooter(text, iconURLopt) → {Embeds}
+ setFooter(text, iconURLopt) → {PaginationEmbed}
@@ -3626,7 +3562,7 @@ setFooterSource:
@@ -3798,10 +3734,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3810,7 +3742,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3824,7 +3756,7 @@ Returns:
- setImage(image) → {Embeds}
+ setImage(image) → {PaginationEmbed}
@@ -3836,7 +3768,7 @@ setImageSource:
@@ -3953,10 +3885,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3965,7 +3893,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3979,7 +3907,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -4062,12 +3990,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -4094,23 +4018,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -4136,10 +4044,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -4162,7 +4066,7 @@ Returns:
- setThumbnail(thumbnail) → {Embeds}
+ setThumbnail(thumbnail) → {PaginationEmbed}
@@ -4174,7 +4078,7 @@ setThumbn
- Source:
@@ -4291,10 +4195,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4303,7 +4203,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4317,7 +4217,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -4400,12 +4300,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -4429,23 +4325,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -4471,10 +4351,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -4497,7 +4373,7 @@ Returns:
- setTimestamp() → {Embeds}
+ setTimestamp() → {PaginationEmbed}
@@ -4509,7 +4385,7 @@ setTimest
- Source:
@@ -4577,10 +4453,6 @@ setTimest
Returns:
-
- - Instance of Embeds
-
-
@@ -4589,7 +4461,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4603,7 +4475,7 @@ Returns:
- setTitle(title) → {Embeds}
+ setTitle(title) → {PaginationEmbed}
@@ -4615,7 +4487,7 @@ setTitleSource:
@@ -4732,10 +4604,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4744,7 +4612,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4758,7 +4626,7 @@ Returns:
- setURL(url) → {Embeds}
+ setURL(url) → {PaginationEmbed}
@@ -4770,7 +4638,7 @@ setURLSource:
@@ -4887,10 +4755,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4899,7 +4763,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4913,7 +4777,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -4996,12 +4860,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -5025,23 +4885,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- true
-
-
Show page indicator?
@@ -5067,10 +4911,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -5106,7 +4946,7 @@ Returns:
diff --git a/docs/Embeds.js.html b/docs/Embeds.js.html
index 637f285..ba6e1c4 100644
--- a/docs/Embeds.js.html
+++ b/docs/Embeds.js.html
@@ -22,7 +22,7 @@
@@ -111,6 +111,7 @@ Embeds.js
/**
* The thumbnail of all embeds.
+ * @type {string}
*/
this.thumbnail = options.thumbnail || null;
@@ -135,7 +136,7 @@ Embeds.js
/**
* Embed in the current page.
- * @returns {MessageEmbed} - An instance of MessageEmbed.
+ * @type {MessageEmbed}
*/
get currentEmbed() {
return this.array[this.page - 1];
@@ -144,7 +145,7 @@ Embeds.js
/**
* Adds a blank field to the fields of all embeds.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addBlankField(inline = false) {
const arr = this.array;
@@ -160,7 +161,7 @@ Embeds.js
* @param {string} name - The name of the field.
* @param {string} value - The value of the field.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addField(name, value, inline = false) {
if (!name && !value) return this;
@@ -179,12 +180,12 @@ Embeds.js
* @example
*
* // Object as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -208,12 +209,12 @@ Embeds.js
* @example
*
* // Methods as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -269,7 +270,7 @@ Embeds.js
/**
* Sets the array of embeds to paginate.
* @param {Array} array - An array of embeds to paginate.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -290,7 +291,7 @@ Embeds.js
* @param {StringResolvable} name - The name of the author.
* @param {string} [iconURL=null] - The icon URL of the author.
* @param {string} [url=null] - The URL of the author.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setAuthor(name, iconURL = null, url = null) {
if (!name) return this;
@@ -306,7 +307,7 @@ Embeds.js
/**
* Sets the color of all embeds.
* @param {ColorResolvable} color - The color of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setColor(color) {
if (!color) return this;
@@ -322,7 +323,7 @@ Embeds.js
/**
* Sets the description of all embeds.
* @param {string} description - The description of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setDescription(description) {
if (!description) return this;
@@ -339,7 +340,7 @@ Embeds.js
* Sets the footer of all embeds.
* @param {string} text - The footer text.
* @param {string} [iconURL=null] - URL for the footer's icon.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setFooter(text, iconURL = null) {
if (!text) return this;
@@ -355,7 +356,7 @@ Embeds.js
/**
* Sets the image of all embeds.
* @param {string} image - The image of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setImage(image) {
if (!image) return this;
@@ -371,7 +372,7 @@ Embeds.js
/**
* Sets the thumbnail of all embeds.
* @param {string} thumbnail - The thumbnail of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setThumbnail(thumbnail) {
if (!thumbnail) return this;
@@ -386,7 +387,7 @@ Embeds.js
/**
* Sets the timestamp of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTimestamp() {
const arr = this.array;
@@ -400,7 +401,7 @@ Embeds.js
/**
* Sets the title of all embeds.
* @param {string} title - The title of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTitle(title) {
if (!title) return this;
@@ -416,7 +417,7 @@ Embeds.js
/**
* Sets the URL of all embeds.
* @param {string} url - The URL of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setURL(url) {
if (!url) return this;
@@ -455,7 +456,7 @@ Embeds.js
diff --git a/docs/FieldsEmbed.html b/docs/FieldsEmbed.html
index 948c77a..e3a7000 100644
--- a/docs/FieldsEmbed.html
+++ b/docs/FieldsEmbed.html
@@ -22,7 +22,7 @@
@@ -304,7 +304,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -326,7 +326,7 @@ authori
- Inherited From:
@@ -360,7 +360,7 @@ authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -538,7 +538,7 @@ Type:
-elementList
+elementList :Array.<*>
@@ -594,6 +594,16 @@ elementLis
+ Type:
+
+ -
+
+Array.<*>
+
+
+
+
+
@@ -1063,9 +1073,9 @@ (async) buildExamples
- // Object as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed({
authorisedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
+ // Object as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed({
authorizedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
- // Methods as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed()
.setAuthorisedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
+ // Methods as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed()
.setAuthorizedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
@@ -1089,7 +1099,7 @@ Examples
- formatField(name, value, inlineopt) → {FieldsEmbed}
+ formatField(name, value, inlineopt) → {PaginationEmbed}
@@ -1308,10 +1318,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -1320,7 +1326,7 @@ Returns:
-
-FieldsEmbed
+PaginationEmbed
@@ -1468,10 +1474,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1494,7 +1496,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1517,7 +1519,7 @@ setA
- Inherited From:
@@ -1551,7 +1553,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1577,12 +1579,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1606,23 +1604,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1648,10 +1630,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1808,10 +1786,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1834,7 +1808,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1948,8 +1922,6 @@ Parameters:
- <optional>
-
@@ -1960,12 +1932,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -2027,10 +1997,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2053,7 +2019,7 @@ Returns:
- setElementsPerPage(numberopt) → {FieldsEmbed}
+ setElementsPerPage(number) → {PaginationEmbed}
@@ -2131,12 +2097,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2160,24 +2122,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 10
-
-
-
Maximum number of elements to be displayed per page.
@@ -2202,10 +2148,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -2214,7 +2156,7 @@ Returns:
-
-FieldsEmbed
+PaginationEmbed
@@ -2228,7 +2170,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -2311,12 +2253,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2340,23 +2278,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -2382,10 +2304,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2408,7 +2326,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -2491,12 +2409,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2523,24 +2437,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 1
-
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -2565,10 +2463,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2591,7 +2485,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -2674,12 +2568,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2703,23 +2593,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2745,10 +2619,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2771,7 +2641,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2854,12 +2724,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2883,24 +2749,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2925,10 +2775,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2964,7 +2810,7 @@ Returns:
diff --git a/docs/FieldsEmbed.js.html b/docs/FieldsEmbed.js.html
index 5d36097..9bad270 100644
--- a/docs/FieldsEmbed.js.html
+++ b/docs/FieldsEmbed.js.html
@@ -22,7 +22,7 @@
@@ -81,7 +81,7 @@ FieldsEmbed.js
/**
* Elements in the current page.
- * @returns {Array.<*>} - An array for a page.
+ * @type {Array.<*>}
*/
get elementList() {
const begin = (this.page - 1) * this.elementsPerPage;
@@ -96,11 +96,11 @@ FieldsEmbed.js
* @example
*
* // Object as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -126,11 +126,11 @@ FieldsEmbed.js
* @example
*
* // Methods as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -185,7 +185,7 @@ FieldsEmbed.js
* @param {string} name - Name of the field.
* @param {Function} value - Value of the field. Function for Array.prototype.map().join('\n').
* @param {boolean} [inline=true] - Whether the field is inline with other field or not.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @returns {PaginationEmbed}
*/
formatField(name, value, inline = true) {
this.fields.push({ name, value, inline });
@@ -195,10 +195,10 @@ FieldsEmbed.js
/**
* Sets the maximum number of elements to be displayed per page.
- * @param {number} [number=10] - Maximum number of elements to be displayed per page.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @param {number} number - Maximum number of elements to be displayed per page.
+ * @returns {PaginationEmbed}
*/
- setElementsPerPage(number = 10) {
+ setElementsPerPage(number) {
if (typeof number !== 'number') throw new Error('setElementsPerPage() only accepts number type.');
this.elementsPerPage = number;
@@ -266,7 +266,7 @@ FieldsEmbed.js
diff --git a/docs/PaginationEmbed.html b/docs/PaginationEmbed.html
index 58d735a..994485d 100644
--- a/docs/PaginationEmbed.html
+++ b/docs/PaginationEmbed.html
@@ -22,7 +22,7 @@
@@ -299,7 +299,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -350,7 +350,7 @@ authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -951,10 +951,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -977,7 +973,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1029,7 +1025,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1055,12 +1051,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1084,23 +1076,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1126,10 +1102,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1281,10 +1253,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1307,7 +1275,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1416,8 +1384,6 @@ Parameters:
- <optional>
-
@@ -1428,12 +1394,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -1495,10 +1459,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1521,7 +1481,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -1599,12 +1559,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1628,23 +1584,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -1670,10 +1610,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1696,7 +1632,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -1774,12 +1710,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1806,23 +1738,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -1848,10 +1764,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1874,7 +1786,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -1952,12 +1864,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1981,23 +1889,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2023,10 +1915,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2049,7 +1937,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2127,12 +2015,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2156,24 +2040,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2198,10 +2066,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2237,7 +2101,7 @@ Returns:
diff --git a/docs/base_PaginationEmbed.js.html b/docs/base_PaginationEmbed.js.html
index c40af28..e74e322 100644
--- a/docs/base_PaginationEmbed.js.html
+++ b/docs/base_PaginationEmbed.js.html
@@ -22,7 +22,7 @@
@@ -63,7 +63,7 @@ base/PaginationEmbed.js
/**
* Options for the constructor.
* @typedef {Object} PaginationEmbedOptions
- * @property {User} [authorisedUser=null] - The authorised user to navigate the pages.
+ * @property {User} [authorizedUser=null] - The authorized user to navigate the pages.
* @property {TextChannel} channel - The channel where to send the embed.
* @property {ClientMessageOptions} [clientMessage=null] - Settings for the message sent by the client.
* @property {Array.<*>} array - An array of elements to paginate.
@@ -82,10 +82,10 @@ base/PaginationEmbed.js
super(options);
/**
- * The authorised user to navigate the pages.
+ * The authorized user to navigate the pages.
* @type {User}
*/
- this.authorisedUser = options.authorisedUser || null;
+ this.authorizedUser = options.authorizedUser || null;
/**
* The channel where to send the embed.
@@ -149,7 +149,7 @@ base/PaginationEmbed.js
/**
* Sets the array of elements to paginate.
* @param {Array} array - An array of elements to paginate.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -162,12 +162,12 @@ base/PaginationEmbed.js
}
/**
- * Set the authorised person to navigate the pages.
- * @param {User} [user=null] - The user object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * Set the authorized person to navigate the pages.
+ * @param {User} user - The user object.
+ * @returns {PaginationEmbed}
*/
- setAuthorisedUser(user = null) {
- this.authorisedUser = user;
+ setAuthorizedUser(user) {
+ this.authorizedUser = user;
return this;
}
@@ -175,7 +175,7 @@ base/PaginationEmbed.js
/**
* The channel where to send the embed.
* @param {TextChannel} channel - The channel object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setChannel(channel) {
this.channel = channel;
@@ -185,11 +185,11 @@ base/PaginationEmbed.js
/**
* Sets the settings for the message sent by the client.
- * @param {Message} [message=null] - The message object sent by the client, if there is any.
+ * @param {Message} message - The message object sent by the client.
* @param {string} [content='Preparing...'] - The custom message content while preparing the embed.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
- setClientMessage(message = null, content = null) {
+ setClientMessage(message, content = null) {
if (!content) content = 'Preparing...';
Object.assign(this.clientMessage, { message, content });
@@ -199,8 +199,8 @@ base/PaginationEmbed.js
/**
* Sets the emojis used for navigation buttons.
- * @param {NavigationButtons} [emojis={}] - An object containing customised emojis to use as navigation buttons.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {NavigationButtons} emojis - An object containing customised emojis to use as navigation buttons.
+ * @returns {PaginationEmbed}
*/
setEmojis(emojis) {
Object.assign(this.emojis, emojis);
@@ -210,10 +210,10 @@ base/PaginationEmbed.js
/**
* Sets to jump to a certain page upon calling PaginationEmbed.build().
- * @param {number|string} [param=1] - The page number to jump to. As String: 'back', 'forward'
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number|string} param - The page number to jump to. As String: 'back', 'forward'
+ * @returns {PaginationEmbed}
*/
- setPage(param = 1) {
+ setPage(param) {
const isString = typeof param === 'string';
if (!(!isNaN(param) || isString)) throw new Error('setPage() only accepts number/string type.');
@@ -229,10 +229,10 @@ base/PaginationEmbed.js
/**
* Sets the time for awaiting a user action before timeout in ms.
- * @param {number} [timeout=30000] Timeout value in ms.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number} timeout Timeout value in ms.
+ * @returns {PaginationEmbed}
*/
- setTimeout(timeout = 30000) {
+ setTimeout(timeout) {
if (typeof timeout !== 'number') throw new Error('setTimeout() only accepts number type.');
this.timeout = timeout;
@@ -242,10 +242,10 @@ base/PaginationEmbed.js
/**
* Sets whether page number indicator on client's message is shown or not.
- * @param {boolean} [boolean=true] - Show page indicator?
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {boolean} boolean - Show page indicator?
+ * @returns {PaginationEmbed}
*/
- showPageIndicator(boolean = true) {
+ showPageIndicator(boolean) {
if (typeof boolean !== 'boolean') throw new Error('showPageIndicator() only accepts boolean type.');
this.pageIndicator = boolean;
@@ -261,7 +261,7 @@ base/PaginationEmbed.js
async _verify(pages) {
this
.setChannel(this.channel)
- .setAuthorisedUser(this.authorisedUser)
+ .setAuthorizedUser(this.authorizedUser)
.setClientMessage(this.clientMessage.message, this.clientMessage.content)
.setArray(this.array)
.showPageIndicator(this.pageIndicator)
@@ -337,8 +337,8 @@ base/PaginationEmbed.js
async _awaitResponse() {
const emojis = Object.values(this.emojis);
const filter = (r, u) => {
- if (this.authorisedUser)
- return u.id === this.authorisedUser.id && emojis.includes(r.emoji.name);
+ if (this.authorizedUser)
+ return u.id === this.authorizedUser.id && emojis.includes(r.emoji.name);
return !u.bot && emojis.includes(r.emoji.name);
};
@@ -432,7 +432,7 @@ base/PaginationEmbed.js
diff --git a/docs/global.html b/docs/global.html
index 23000ba..3f7e34b 100644
--- a/docs/global.html
+++ b/docs/global.html
@@ -22,7 +22,7 @@
@@ -1487,7 +1487,7 @@ Properties:
- authorisedUser
+ authorizedUser
@@ -1517,7 +1517,7 @@ Properties:
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -1820,7 +1820,7 @@ Type:
diff --git a/docs/index.html b/docs/index.html
index 80eb8c4..c53f893 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -22,7 +22,7 @@
@@ -51,20 +51,21 @@ Home
Classes
const FieldsEmbedMode = require('discord-paginationembed').FieldsEmbed;
+const { FieldsEmbed: FieldsEmbedMode } = require('discord-paginationembed');
new FieldsEmbedMode()
.setArray([ { name: "John Doe" }, { name: "Jane Doe" } ])
- .setAuthorisedUser(message.author)
+ .setAuthorizedUser(message.author)
.setChannel(message.channel)
.setElementsPerPage(1)
.setPage(2)
.showPageIndicator(false)
- .build();
const EmbedsMode = require('discord-paginationembed').Embeds;
+ .build();
const { Embeds: EmbedsMode } = require('discord-paginationembed');
const { MessageEmbed } = require("discord.js");
const embeds = [];
@@ -76,7 +77,7 @@ Under message
event
new EmbedsMode()
.setArray(embeds)
- .setAuthorisedUser(message.author)
+ .setAuthorizedUser(message.author)
.setChannel(message.channel)
.showPageIndicator(true)
.setPage(3)
@@ -99,7 +100,7 @@ Contributing
- Fork this repository.
- Execute
npm install
- Code and code and code and code and... code!
-npm test
to verify your additions/adjustments are following ESLint's rules and verify docs are valid.
+npm test
to verify if your additions/adjustments are following ESLint's rules and to verify if the docs are valid.
- File a Pull Request!
License
MIT
@@ -115,7 +116,7 @@ License
MIT
diff --git a/package.json b/package.json
index f30a2be..44c632d 100644
--- a/package.json
+++ b/package.json
@@ -1,11 +1,11 @@
{
"name": "discord-paginationembed",
- "version": "0.1.0",
+ "version": "0.2.0",
"description": "Pagination Embed for Discord.JS",
"main": "./src/index.js",
"scripts": {
- "test": "eslint --ignore-path .eslintignore . && npm run generate-docs",
- "generate-docs": "jsdoc -c jsdoc.json"
+ "test": "eslint ./src && npm run docs",
+ "docs": "node_modules/.bin/jsdoc -c .jsdoc.json"
},
"repository": {
"type": "git",
@@ -27,7 +27,7 @@
"url": "https://github.com/gazmull/discord-paginationembed/issues"
},
"homepage": "https://github.com/gazmull/discord-paginationembed#readme",
- "dependencies": {
+ "peerDependencies": {
"discord.js": "discordjs/discord.js"
},
"devDependencies": {
diff --git a/src/struct/Embeds.js b/src/struct/Embeds.js
index e8ed7be..ac4fb33 100644
--- a/src/struct/Embeds.js
+++ b/src/struct/Embeds.js
@@ -72,6 +72,7 @@ class Embeds extends PaginationEmbed {
/**
* The thumbnail of all embeds.
+ * @type {string}
*/
this.thumbnail = options.thumbnail || null;
@@ -96,7 +97,7 @@ class Embeds extends PaginationEmbed {
/**
* Embed in the current page.
- * @returns {MessageEmbed} - An instance of MessageEmbed.
+ * @type {MessageEmbed}
*/
get currentEmbed() {
return this.array[this.page - 1];
@@ -105,7 +106,7 @@ class Embeds extends PaginationEmbed {
/**
* Adds a blank field to the fields of all embeds.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addBlankField(inline = false) {
const arr = this.array;
@@ -121,7 +122,7 @@ class Embeds extends PaginationEmbed {
* @param {string} name - The name of the field.
* @param {string} value - The value of the field.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addField(name, value, inline = false) {
if (!name && !value) return this;
@@ -140,12 +141,12 @@ class Embeds extends PaginationEmbed {
* @example
*
* // Object as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -169,12 +170,12 @@ class Embeds extends PaginationEmbed {
* @example
*
* // Methods as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -230,7 +231,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the array of embeds to paginate.
* @param {Array} array - An array of embeds to paginate.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -251,7 +252,7 @@ class Embeds extends PaginationEmbed {
* @param {StringResolvable} name - The name of the author.
* @param {string} [iconURL=null] - The icon URL of the author.
* @param {string} [url=null] - The URL of the author.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setAuthor(name, iconURL = null, url = null) {
if (!name) return this;
@@ -267,7 +268,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the color of all embeds.
* @param {ColorResolvable} color - The color of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setColor(color) {
if (!color) return this;
@@ -283,7 +284,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the description of all embeds.
* @param {string} description - The description of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setDescription(description) {
if (!description) return this;
@@ -300,7 +301,7 @@ class Embeds extends PaginationEmbed {
* Sets the footer of all embeds.
* @param {string} text - The footer text.
* @param {string} [iconURL=null] - URL for the footer's icon.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setFooter(text, iconURL = null) {
if (!text) return this;
@@ -316,7 +317,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the image of all embeds.
* @param {string} image - The image of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setImage(image) {
if (!image) return this;
@@ -332,7 +333,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the thumbnail of all embeds.
* @param {string} thumbnail - The thumbnail of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setThumbnail(thumbnail) {
if (!thumbnail) return this;
@@ -347,7 +348,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the timestamp of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTimestamp() {
const arr = this.array;
@@ -361,7 +362,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the title of all embeds.
* @param {string} title - The title of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTitle(title) {
if (!title) return this;
@@ -377,7 +378,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the URL of all embeds.
* @param {string} url - The URL of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setURL(url) {
if (!url) return this;
diff --git a/src/struct/FieldsEmbed.js b/src/struct/FieldsEmbed.js
index 71b2281..d631b76 100644
--- a/src/struct/FieldsEmbed.js
+++ b/src/struct/FieldsEmbed.js
@@ -42,7 +42,7 @@ class FieldsEmbed extends PaginationEmbed {
/**
* Elements in the current page.
- * @returns {Array.<*>} - An array for a page.
+ * @type {Array.<*>}
*/
get elementList() {
const begin = (this.page - 1) * this.elementsPerPage;
@@ -57,11 +57,11 @@ class FieldsEmbed extends PaginationEmbed {
* @example
*
* // Object as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -87,11 +87,11 @@ class FieldsEmbed extends PaginationEmbed {
* @example
*
* // Methods as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -146,7 +146,7 @@ class FieldsEmbed extends PaginationEmbed {
* @param {string} name - Name of the field.
* @param {Function} value - Value of the field. Function for Array.prototype.map().join('\n').
* @param {boolean} [inline=true] - Whether the field is inline with other field or not.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @returns {PaginationEmbed}
*/
formatField(name, value, inline = true) {
this.fields.push({ name, value, inline });
@@ -156,10 +156,10 @@ class FieldsEmbed extends PaginationEmbed {
/**
* Sets the maximum number of elements to be displayed per page.
- * @param {number} [number=10] - Maximum number of elements to be displayed per page.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @param {number} number - Maximum number of elements to be displayed per page.
+ * @returns {PaginationEmbed}
*/
- setElementsPerPage(number = 10) {
+ setElementsPerPage(number) {
if (typeof number !== 'number') throw new Error('setElementsPerPage() only accepts number type.');
this.elementsPerPage = number;
diff --git a/src/struct/base/PaginationEmbed.js b/src/struct/base/PaginationEmbed.js
index 11a5a9f..9f9ec45 100644
--- a/src/struct/base/PaginationEmbed.js
+++ b/src/struct/base/PaginationEmbed.js
@@ -24,7 +24,7 @@ class PaginationEmbed extends MessageEmbed {
/**
* Options for the constructor.
* @typedef {Object} PaginationEmbedOptions
- * @property {User} [authorisedUser=null] - The authorised user to navigate the pages.
+ * @property {User} [authorizedUser=null] - The authorized user to navigate the pages.
* @property {TextChannel} channel - The channel where to send the embed.
* @property {ClientMessageOptions} [clientMessage=null] - Settings for the message sent by the client.
* @property {Array.<*>} array - An array of elements to paginate.
@@ -43,10 +43,10 @@ class PaginationEmbed extends MessageEmbed {
super(options);
/**
- * The authorised user to navigate the pages.
+ * The authorized user to navigate the pages.
* @type {User}
*/
- this.authorisedUser = options.authorisedUser || null;
+ this.authorizedUser = options.authorizedUser || null;
/**
* The channel where to send the embed.
@@ -110,7 +110,7 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the array of elements to paginate.
* @param {Array} array - An array of elements to paginate.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -123,12 +123,12 @@ class PaginationEmbed extends MessageEmbed {
}
/**
- * Set the authorised person to navigate the pages.
- * @param {User} [user=null] - The user object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * Set the authorized person to navigate the pages.
+ * @param {User} user - The user object.
+ * @returns {PaginationEmbed}
*/
- setAuthorisedUser(user = null) {
- this.authorisedUser = user;
+ setAuthorizedUser(user) {
+ this.authorizedUser = user;
return this;
}
@@ -136,7 +136,7 @@ class PaginationEmbed extends MessageEmbed {
/**
* The channel where to send the embed.
* @param {TextChannel} channel - The channel object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setChannel(channel) {
this.channel = channel;
@@ -146,11 +146,11 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the settings for the message sent by the client.
- * @param {Message} [message=null] - The message object sent by the client, if there is any.
+ * @param {Message} message - The message object sent by the client.
* @param {string} [content='Preparing...'] - The custom message content while preparing the embed.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
- setClientMessage(message = null, content = null) {
+ setClientMessage(message, content = null) {
if (!content) content = 'Preparing...';
Object.assign(this.clientMessage, { message, content });
@@ -160,8 +160,8 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the emojis used for navigation buttons.
- * @param {NavigationButtons} [emojis={}] - An object containing customised emojis to use as navigation buttons.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {NavigationButtons} emojis - An object containing customised emojis to use as navigation buttons.
+ * @returns {PaginationEmbed}
*/
setEmojis(emojis) {
Object.assign(this.emojis, emojis);
@@ -171,10 +171,10 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets to jump to a certain page upon calling PaginationEmbed.build().
- * @param {number|string} [param=1] - The page number to jump to. As String: 'back', 'forward'
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number|string} param - The page number to jump to. As String: 'back', 'forward'
+ * @returns {PaginationEmbed}
*/
- setPage(param = 1) {
+ setPage(param) {
const isString = typeof param === 'string';
if (!(!isNaN(param) || isString)) throw new Error('setPage() only accepts number/string type.');
@@ -190,10 +190,10 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the time for awaiting a user action before timeout in ms.
- * @param {number} [timeout=30000] Timeout value in ms.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number} timeout Timeout value in ms.
+ * @returns {PaginationEmbed}
*/
- setTimeout(timeout = 30000) {
+ setTimeout(timeout) {
if (typeof timeout !== 'number') throw new Error('setTimeout() only accepts number type.');
this.timeout = timeout;
@@ -203,10 +203,10 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets whether page number indicator on client's message is shown or not.
- * @param {boolean} [boolean=true] - Show page indicator?
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {boolean} boolean - Show page indicator?
+ * @returns {PaginationEmbed}
*/
- showPageIndicator(boolean = true) {
+ showPageIndicator(boolean) {
if (typeof boolean !== 'boolean') throw new Error('showPageIndicator() only accepts boolean type.');
this.pageIndicator = boolean;
@@ -222,7 +222,7 @@ class PaginationEmbed extends MessageEmbed {
async _verify(pages) {
this
.setChannel(this.channel)
- .setAuthorisedUser(this.authorisedUser)
+ .setAuthorizedUser(this.authorizedUser)
.setClientMessage(this.clientMessage.message, this.clientMessage.content)
.setArray(this.array)
.showPageIndicator(this.pageIndicator)
@@ -298,8 +298,8 @@ class PaginationEmbed extends MessageEmbed {
async _awaitResponse() {
const emojis = Object.values(this.emojis);
const filter = (r, u) => {
- if (this.authorisedUser)
- return u.id === this.authorisedUser.id && emojis.includes(r.emoji.name);
+ if (this.authorizedUser)
+ return u.id === this.authorizedUser.id && emojis.includes(r.emoji.name);
return !u.bot && emojis.includes(r.emoji.name);
};
Returns:
(async) buildSource:
@@ -2130,9 +2142,9 @@ (async) buildExamples
- // Object as constructor.
const Embeds = require('discord-paginationembed').Embeds;
const { MessageEmbed } = require('discord.js');
// Under message event.
new Embeds({
authorisedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
new MessageEmbed({ title: 'John Doe' }),
new MessageEmbed({ title: 'Jane Doe' })
],
pageIndicator: false,
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
},
description: 'This is one of my embeds with this message!',
color: 0xFF00AE,
timestamp: true
}).build();
+ // Object as constructor.
const { Embeds } = require('discord-paginationembed');
const { MessageEmbed } = require('discord.js');
// Under message event.
new Embeds({
authorizedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
new MessageEmbed({ title: 'John Doe' }),
new MessageEmbed({ title: 'Jane Doe' })
],
pageIndicator: false,
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
},
description: 'This is one of my embeds with this message!',
color: 0xFF00AE,
timestamp: true
}).build();
- // Methods as constructor.
const Embeds = require('discord-paginationembed').Embeds;
const { MessageEmbed } = require('discord.js');
// Under message event.
new Embeds()
.setAuthorisedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
new MessageEmbed({ title: 'John Doe' }),
new MessageEmbed({ title: 'Jane Doe' })
])
.setPageIndicator(false)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.setDescription('This is one of my embeds with this message!')
.setColor(0xFF00AE)
.setTimestamp()
.build();
+ // Methods as constructor.
const { Embeds } = require('discord-paginationembed');
const { MessageEmbed } = require('discord.js');
// Under message event.
new Embeds()
.setAuthorizedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
new MessageEmbed({ title: 'John Doe' }),
new MessageEmbed({ title: 'Jane Doe' })
])
.setPageIndicator(false)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.setDescription('This is one of my embeds with this message!')
.setColor(0xFF00AE)
.setTimestamp()
.build();
@@ -2156,7 +2168,7 @@ Examples
- setArray(array) → {Embeds}
+ setArray(array) → {PaginationEmbed}
@@ -2168,7 +2180,7 @@ setArraySource:
@@ -2290,10 +2302,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -2302,7 +2310,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -2316,7 +2324,7 @@ Returns:
- setAuthor(name, iconURLopt, urlopt) → {Embeds}
+ setAuthor(name, iconURLopt, urlopt) → {PaginationEmbed}
@@ -2328,7 +2336,7 @@ setAuthorSource:
@@ -2539,10 +2547,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -2551,7 +2555,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -2565,7 +2569,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -2588,7 +2592,7 @@ setA
- Inherited From:
@@ -2622,7 +2626,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -2648,12 +2652,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2677,23 +2677,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -2719,10 +2703,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2879,10 +2859,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2905,7 +2881,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -3019,8 +2995,6 @@ Parameters:
- <optional>
-
@@ -3031,12 +3005,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -3098,10 +3070,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -3124,7 +3092,7 @@ Returns:
- setColor(color) → {Embeds}
+ setColor(color) → {PaginationEmbed}
@@ -3136,7 +3104,7 @@ setColorSource:
@@ -3253,10 +3221,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3265,7 +3229,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3279,7 +3243,7 @@ Returns:
- setDescription(description) → {Embeds}
+ setDescription(description) → {PaginationEmbed}
@@ -3291,7 +3255,7 @@ setDesc
- Source:
@@ -3408,10 +3372,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3420,7 +3380,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3434,7 +3394,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -3517,12 +3477,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -3546,23 +3502,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -3588,10 +3528,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -3614,7 +3550,7 @@ Returns:
- setFooter(text, iconURLopt) → {Embeds}
+ setFooter(text, iconURLopt) → {PaginationEmbed}
@@ -3626,7 +3562,7 @@ setFooterSource:
@@ -3798,10 +3734,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3810,7 +3742,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3824,7 +3756,7 @@ Returns:
- setImage(image) → {Embeds}
+ setImage(image) → {PaginationEmbed}
@@ -3836,7 +3768,7 @@ setImageSource:
@@ -3953,10 +3885,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3965,7 +3893,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3979,7 +3907,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -4062,12 +3990,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -4094,23 +4018,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -4136,10 +4044,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -4162,7 +4066,7 @@ Returns:
- setThumbnail(thumbnail) → {Embeds}
+ setThumbnail(thumbnail) → {PaginationEmbed}
@@ -4174,7 +4078,7 @@ setThumbn
- Source:
@@ -4291,10 +4195,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4303,7 +4203,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4317,7 +4217,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -4400,12 +4300,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -4429,23 +4325,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -4471,10 +4351,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -4497,7 +4373,7 @@ Returns:
- setTimestamp() → {Embeds}
+ setTimestamp() → {PaginationEmbed}
@@ -4509,7 +4385,7 @@ setTimest
- Source:
@@ -4577,10 +4453,6 @@ setTimest
Returns:
-
- - Instance of Embeds
-
-
@@ -4589,7 +4461,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4603,7 +4475,7 @@ Returns:
- setTitle(title) → {Embeds}
+ setTitle(title) → {PaginationEmbed}
@@ -4615,7 +4487,7 @@ setTitleSource:
@@ -4732,10 +4604,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4744,7 +4612,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4758,7 +4626,7 @@ Returns:
- setURL(url) → {Embeds}
+ setURL(url) → {PaginationEmbed}
@@ -4770,7 +4638,7 @@ setURLSource:
@@ -4887,10 +4755,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4899,7 +4763,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4913,7 +4777,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -4996,12 +4860,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -5025,23 +4885,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- true
-
-
Show page indicator?
@@ -5067,10 +4911,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -5106,7 +4946,7 @@ Returns:
diff --git a/docs/Embeds.js.html b/docs/Embeds.js.html
index 637f285..ba6e1c4 100644
--- a/docs/Embeds.js.html
+++ b/docs/Embeds.js.html
@@ -22,7 +22,7 @@
@@ -111,6 +111,7 @@ Embeds.js
/**
* The thumbnail of all embeds.
+ * @type {string}
*/
this.thumbnail = options.thumbnail || null;
@@ -135,7 +136,7 @@ Embeds.js
/**
* Embed in the current page.
- * @returns {MessageEmbed} - An instance of MessageEmbed.
+ * @type {MessageEmbed}
*/
get currentEmbed() {
return this.array[this.page - 1];
@@ -144,7 +145,7 @@ Embeds.js
/**
* Adds a blank field to the fields of all embeds.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addBlankField(inline = false) {
const arr = this.array;
@@ -160,7 +161,7 @@ Embeds.js
* @param {string} name - The name of the field.
* @param {string} value - The value of the field.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addField(name, value, inline = false) {
if (!name && !value) return this;
@@ -179,12 +180,12 @@ Embeds.js
* @example
*
* // Object as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -208,12 +209,12 @@ Embeds.js
* @example
*
* // Methods as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -269,7 +270,7 @@ Embeds.js
/**
* Sets the array of embeds to paginate.
* @param {Array} array - An array of embeds to paginate.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -290,7 +291,7 @@ Embeds.js
* @param {StringResolvable} name - The name of the author.
* @param {string} [iconURL=null] - The icon URL of the author.
* @param {string} [url=null] - The URL of the author.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setAuthor(name, iconURL = null, url = null) {
if (!name) return this;
@@ -306,7 +307,7 @@ Embeds.js
/**
* Sets the color of all embeds.
* @param {ColorResolvable} color - The color of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setColor(color) {
if (!color) return this;
@@ -322,7 +323,7 @@ Embeds.js
/**
* Sets the description of all embeds.
* @param {string} description - The description of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setDescription(description) {
if (!description) return this;
@@ -339,7 +340,7 @@ Embeds.js
* Sets the footer of all embeds.
* @param {string} text - The footer text.
* @param {string} [iconURL=null] - URL for the footer's icon.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setFooter(text, iconURL = null) {
if (!text) return this;
@@ -355,7 +356,7 @@ Embeds.js
/**
* Sets the image of all embeds.
* @param {string} image - The image of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setImage(image) {
if (!image) return this;
@@ -371,7 +372,7 @@ Embeds.js
/**
* Sets the thumbnail of all embeds.
* @param {string} thumbnail - The thumbnail of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setThumbnail(thumbnail) {
if (!thumbnail) return this;
@@ -386,7 +387,7 @@ Embeds.js
/**
* Sets the timestamp of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTimestamp() {
const arr = this.array;
@@ -400,7 +401,7 @@ Embeds.js
/**
* Sets the title of all embeds.
* @param {string} title - The title of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTitle(title) {
if (!title) return this;
@@ -416,7 +417,7 @@ Embeds.js
/**
* Sets the URL of all embeds.
* @param {string} url - The URL of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setURL(url) {
if (!url) return this;
@@ -455,7 +456,7 @@ Embeds.js
diff --git a/docs/FieldsEmbed.html b/docs/FieldsEmbed.html
index 948c77a..e3a7000 100644
--- a/docs/FieldsEmbed.html
+++ b/docs/FieldsEmbed.html
@@ -22,7 +22,7 @@
@@ -304,7 +304,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -326,7 +326,7 @@ authori
- Inherited From:
@@ -360,7 +360,7 @@ authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -538,7 +538,7 @@ Type:
-elementList
+elementList :Array.<*>
@@ -594,6 +594,16 @@ elementLis
+ Type:
+
+ -
+
+Array.<*>
+
+
+
+
+
@@ -1063,9 +1073,9 @@ (async) buildExamples
- // Object as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed({
authorisedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
+ // Object as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed({
authorizedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
- // Methods as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed()
.setAuthorisedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
+ // Methods as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed()
.setAuthorizedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
@@ -1089,7 +1099,7 @@ Examples
- formatField(name, value, inlineopt) → {FieldsEmbed}
+ formatField(name, value, inlineopt) → {PaginationEmbed}
@@ -1308,10 +1318,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -1320,7 +1326,7 @@ Returns:
-
-FieldsEmbed
+PaginationEmbed
@@ -1468,10 +1474,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1494,7 +1496,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1517,7 +1519,7 @@ setA
- Inherited From:
@@ -1551,7 +1553,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1577,12 +1579,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1606,23 +1604,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1648,10 +1630,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1808,10 +1786,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1834,7 +1808,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1948,8 +1922,6 @@ Parameters:
- <optional>
-
@@ -1960,12 +1932,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -2027,10 +1997,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2053,7 +2019,7 @@ Returns:
- setElementsPerPage(numberopt) → {FieldsEmbed}
+ setElementsPerPage(number) → {PaginationEmbed}
@@ -2131,12 +2097,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2160,24 +2122,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 10
-
-
-
Maximum number of elements to be displayed per page.
@@ -2202,10 +2148,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -2214,7 +2156,7 @@ Returns:
-
-FieldsEmbed
+PaginationEmbed
@@ -2228,7 +2170,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -2311,12 +2253,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2340,23 +2278,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -2382,10 +2304,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2408,7 +2326,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -2491,12 +2409,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2523,24 +2437,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 1
-
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -2565,10 +2463,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2591,7 +2485,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -2674,12 +2568,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2703,23 +2593,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2745,10 +2619,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2771,7 +2641,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2854,12 +2724,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2883,24 +2749,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2925,10 +2775,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2964,7 +2810,7 @@ Returns:
diff --git a/docs/FieldsEmbed.js.html b/docs/FieldsEmbed.js.html
index 5d36097..9bad270 100644
--- a/docs/FieldsEmbed.js.html
+++ b/docs/FieldsEmbed.js.html
@@ -22,7 +22,7 @@
@@ -81,7 +81,7 @@ FieldsEmbed.js
/**
* Elements in the current page.
- * @returns {Array.<*>} - An array for a page.
+ * @type {Array.<*>}
*/
get elementList() {
const begin = (this.page - 1) * this.elementsPerPage;
@@ -96,11 +96,11 @@ FieldsEmbed.js
* @example
*
* // Object as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -126,11 +126,11 @@ FieldsEmbed.js
* @example
*
* // Methods as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -185,7 +185,7 @@ FieldsEmbed.js
* @param {string} name - Name of the field.
* @param {Function} value - Value of the field. Function for Array.prototype.map().join('\n').
* @param {boolean} [inline=true] - Whether the field is inline with other field or not.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @returns {PaginationEmbed}
*/
formatField(name, value, inline = true) {
this.fields.push({ name, value, inline });
@@ -195,10 +195,10 @@ FieldsEmbed.js
/**
* Sets the maximum number of elements to be displayed per page.
- * @param {number} [number=10] - Maximum number of elements to be displayed per page.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @param {number} number - Maximum number of elements to be displayed per page.
+ * @returns {PaginationEmbed}
*/
- setElementsPerPage(number = 10) {
+ setElementsPerPage(number) {
if (typeof number !== 'number') throw new Error('setElementsPerPage() only accepts number type.');
this.elementsPerPage = number;
@@ -266,7 +266,7 @@ FieldsEmbed.js
diff --git a/docs/PaginationEmbed.html b/docs/PaginationEmbed.html
index 58d735a..994485d 100644
--- a/docs/PaginationEmbed.html
+++ b/docs/PaginationEmbed.html
@@ -22,7 +22,7 @@
@@ -299,7 +299,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -350,7 +350,7 @@ authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -951,10 +951,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -977,7 +973,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1029,7 +1025,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1055,12 +1051,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1084,23 +1076,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1126,10 +1102,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1281,10 +1253,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1307,7 +1275,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1416,8 +1384,6 @@ Parameters:
- <optional>
-
@@ -1428,12 +1394,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -1495,10 +1459,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1521,7 +1481,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -1599,12 +1559,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1628,23 +1584,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -1670,10 +1610,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1696,7 +1632,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -1774,12 +1710,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1806,23 +1738,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -1848,10 +1764,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1874,7 +1786,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -1952,12 +1864,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1981,23 +1889,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2023,10 +1915,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2049,7 +1937,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2127,12 +2015,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2156,24 +2040,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2198,10 +2066,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2237,7 +2101,7 @@ Returns:
diff --git a/docs/base_PaginationEmbed.js.html b/docs/base_PaginationEmbed.js.html
index c40af28..e74e322 100644
--- a/docs/base_PaginationEmbed.js.html
+++ b/docs/base_PaginationEmbed.js.html
@@ -22,7 +22,7 @@
@@ -63,7 +63,7 @@ base/PaginationEmbed.js
/**
* Options for the constructor.
* @typedef {Object} PaginationEmbedOptions
- * @property {User} [authorisedUser=null] - The authorised user to navigate the pages.
+ * @property {User} [authorizedUser=null] - The authorized user to navigate the pages.
* @property {TextChannel} channel - The channel where to send the embed.
* @property {ClientMessageOptions} [clientMessage=null] - Settings for the message sent by the client.
* @property {Array.<*>} array - An array of elements to paginate.
@@ -82,10 +82,10 @@ base/PaginationEmbed.js
super(options);
/**
- * The authorised user to navigate the pages.
+ * The authorized user to navigate the pages.
* @type {User}
*/
- this.authorisedUser = options.authorisedUser || null;
+ this.authorizedUser = options.authorizedUser || null;
/**
* The channel where to send the embed.
@@ -149,7 +149,7 @@ base/PaginationEmbed.js
/**
* Sets the array of elements to paginate.
* @param {Array} array - An array of elements to paginate.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -162,12 +162,12 @@ base/PaginationEmbed.js
}
/**
- * Set the authorised person to navigate the pages.
- * @param {User} [user=null] - The user object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * Set the authorized person to navigate the pages.
+ * @param {User} user - The user object.
+ * @returns {PaginationEmbed}
*/
- setAuthorisedUser(user = null) {
- this.authorisedUser = user;
+ setAuthorizedUser(user) {
+ this.authorizedUser = user;
return this;
}
@@ -175,7 +175,7 @@ base/PaginationEmbed.js
/**
* The channel where to send the embed.
* @param {TextChannel} channel - The channel object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setChannel(channel) {
this.channel = channel;
@@ -185,11 +185,11 @@ base/PaginationEmbed.js
/**
* Sets the settings for the message sent by the client.
- * @param {Message} [message=null] - The message object sent by the client, if there is any.
+ * @param {Message} message - The message object sent by the client.
* @param {string} [content='Preparing...'] - The custom message content while preparing the embed.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
- setClientMessage(message = null, content = null) {
+ setClientMessage(message, content = null) {
if (!content) content = 'Preparing...';
Object.assign(this.clientMessage, { message, content });
@@ -199,8 +199,8 @@ base/PaginationEmbed.js
/**
* Sets the emojis used for navigation buttons.
- * @param {NavigationButtons} [emojis={}] - An object containing customised emojis to use as navigation buttons.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {NavigationButtons} emojis - An object containing customised emojis to use as navigation buttons.
+ * @returns {PaginationEmbed}
*/
setEmojis(emojis) {
Object.assign(this.emojis, emojis);
@@ -210,10 +210,10 @@ base/PaginationEmbed.js
/**
* Sets to jump to a certain page upon calling PaginationEmbed.build().
- * @param {number|string} [param=1] - The page number to jump to. As String: 'back', 'forward'
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number|string} param - The page number to jump to. As String: 'back', 'forward'
+ * @returns {PaginationEmbed}
*/
- setPage(param = 1) {
+ setPage(param) {
const isString = typeof param === 'string';
if (!(!isNaN(param) || isString)) throw new Error('setPage() only accepts number/string type.');
@@ -229,10 +229,10 @@ base/PaginationEmbed.js
/**
* Sets the time for awaiting a user action before timeout in ms.
- * @param {number} [timeout=30000] Timeout value in ms.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number} timeout Timeout value in ms.
+ * @returns {PaginationEmbed}
*/
- setTimeout(timeout = 30000) {
+ setTimeout(timeout) {
if (typeof timeout !== 'number') throw new Error('setTimeout() only accepts number type.');
this.timeout = timeout;
@@ -242,10 +242,10 @@ base/PaginationEmbed.js
/**
* Sets whether page number indicator on client's message is shown or not.
- * @param {boolean} [boolean=true] - Show page indicator?
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {boolean} boolean - Show page indicator?
+ * @returns {PaginationEmbed}
*/
- showPageIndicator(boolean = true) {
+ showPageIndicator(boolean) {
if (typeof boolean !== 'boolean') throw new Error('showPageIndicator() only accepts boolean type.');
this.pageIndicator = boolean;
@@ -261,7 +261,7 @@ base/PaginationEmbed.js
async _verify(pages) {
this
.setChannel(this.channel)
- .setAuthorisedUser(this.authorisedUser)
+ .setAuthorizedUser(this.authorizedUser)
.setClientMessage(this.clientMessage.message, this.clientMessage.content)
.setArray(this.array)
.showPageIndicator(this.pageIndicator)
@@ -337,8 +337,8 @@ base/PaginationEmbed.js
async _awaitResponse() {
const emojis = Object.values(this.emojis);
const filter = (r, u) => {
- if (this.authorisedUser)
- return u.id === this.authorisedUser.id && emojis.includes(r.emoji.name);
+ if (this.authorizedUser)
+ return u.id === this.authorizedUser.id && emojis.includes(r.emoji.name);
return !u.bot && emojis.includes(r.emoji.name);
};
@@ -432,7 +432,7 @@ base/PaginationEmbed.js
diff --git a/docs/global.html b/docs/global.html
index 23000ba..3f7e34b 100644
--- a/docs/global.html
+++ b/docs/global.html
@@ -22,7 +22,7 @@
@@ -1487,7 +1487,7 @@ Properties:
- authorisedUser
+ authorizedUser
@@ -1517,7 +1517,7 @@ Properties:
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -1820,7 +1820,7 @@ Type:
diff --git a/docs/index.html b/docs/index.html
index 80eb8c4..c53f893 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -22,7 +22,7 @@
@@ -51,20 +51,21 @@ Home
Classes
const FieldsEmbedMode = require('discord-paginationembed').FieldsEmbed;
+const { FieldsEmbed: FieldsEmbedMode } = require('discord-paginationembed');
new FieldsEmbedMode()
.setArray([ { name: "John Doe" }, { name: "Jane Doe" } ])
- .setAuthorisedUser(message.author)
+ .setAuthorizedUser(message.author)
.setChannel(message.channel)
.setElementsPerPage(1)
.setPage(2)
.showPageIndicator(false)
- .build();
const EmbedsMode = require('discord-paginationembed').Embeds;
+ .build();
const { Embeds: EmbedsMode } = require('discord-paginationembed');
const { MessageEmbed } = require("discord.js");
const embeds = [];
@@ -76,7 +77,7 @@ Under message
event
new EmbedsMode()
.setArray(embeds)
- .setAuthorisedUser(message.author)
+ .setAuthorizedUser(message.author)
.setChannel(message.channel)
.showPageIndicator(true)
.setPage(3)
@@ -99,7 +100,7 @@ Contributing
- Fork this repository.
- Execute
npm install
- Code and code and code and code and... code!
-npm test
to verify your additions/adjustments are following ESLint's rules and verify docs are valid.
+npm test
to verify if your additions/adjustments are following ESLint's rules and to verify if the docs are valid.
- File a Pull Request!
License
MIT
@@ -115,7 +116,7 @@ License
MIT
diff --git a/package.json b/package.json
index f30a2be..44c632d 100644
--- a/package.json
+++ b/package.json
@@ -1,11 +1,11 @@
{
"name": "discord-paginationembed",
- "version": "0.1.0",
+ "version": "0.2.0",
"description": "Pagination Embed for Discord.JS",
"main": "./src/index.js",
"scripts": {
- "test": "eslint --ignore-path .eslintignore . && npm run generate-docs",
- "generate-docs": "jsdoc -c jsdoc.json"
+ "test": "eslint ./src && npm run docs",
+ "docs": "node_modules/.bin/jsdoc -c .jsdoc.json"
},
"repository": {
"type": "git",
@@ -27,7 +27,7 @@
"url": "https://github.com/gazmull/discord-paginationembed/issues"
},
"homepage": "https://github.com/gazmull/discord-paginationembed#readme",
- "dependencies": {
+ "peerDependencies": {
"discord.js": "discordjs/discord.js"
},
"devDependencies": {
diff --git a/src/struct/Embeds.js b/src/struct/Embeds.js
index e8ed7be..ac4fb33 100644
--- a/src/struct/Embeds.js
+++ b/src/struct/Embeds.js
@@ -72,6 +72,7 @@ class Embeds extends PaginationEmbed {
/**
* The thumbnail of all embeds.
+ * @type {string}
*/
this.thumbnail = options.thumbnail || null;
@@ -96,7 +97,7 @@ class Embeds extends PaginationEmbed {
/**
* Embed in the current page.
- * @returns {MessageEmbed} - An instance of MessageEmbed.
+ * @type {MessageEmbed}
*/
get currentEmbed() {
return this.array[this.page - 1];
@@ -105,7 +106,7 @@ class Embeds extends PaginationEmbed {
/**
* Adds a blank field to the fields of all embeds.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addBlankField(inline = false) {
const arr = this.array;
@@ -121,7 +122,7 @@ class Embeds extends PaginationEmbed {
* @param {string} name - The name of the field.
* @param {string} value - The value of the field.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addField(name, value, inline = false) {
if (!name && !value) return this;
@@ -140,12 +141,12 @@ class Embeds extends PaginationEmbed {
* @example
*
* // Object as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -169,12 +170,12 @@ class Embeds extends PaginationEmbed {
* @example
*
* // Methods as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -230,7 +231,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the array of embeds to paginate.
* @param {Array} array - An array of embeds to paginate.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -251,7 +252,7 @@ class Embeds extends PaginationEmbed {
* @param {StringResolvable} name - The name of the author.
* @param {string} [iconURL=null] - The icon URL of the author.
* @param {string} [url=null] - The URL of the author.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setAuthor(name, iconURL = null, url = null) {
if (!name) return this;
@@ -267,7 +268,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the color of all embeds.
* @param {ColorResolvable} color - The color of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setColor(color) {
if (!color) return this;
@@ -283,7 +284,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the description of all embeds.
* @param {string} description - The description of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setDescription(description) {
if (!description) return this;
@@ -300,7 +301,7 @@ class Embeds extends PaginationEmbed {
* Sets the footer of all embeds.
* @param {string} text - The footer text.
* @param {string} [iconURL=null] - URL for the footer's icon.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setFooter(text, iconURL = null) {
if (!text) return this;
@@ -316,7 +317,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the image of all embeds.
* @param {string} image - The image of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setImage(image) {
if (!image) return this;
@@ -332,7 +333,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the thumbnail of all embeds.
* @param {string} thumbnail - The thumbnail of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setThumbnail(thumbnail) {
if (!thumbnail) return this;
@@ -347,7 +348,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the timestamp of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTimestamp() {
const arr = this.array;
@@ -361,7 +362,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the title of all embeds.
* @param {string} title - The title of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTitle(title) {
if (!title) return this;
@@ -377,7 +378,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the URL of all embeds.
* @param {string} url - The URL of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setURL(url) {
if (!url) return this;
diff --git a/src/struct/FieldsEmbed.js b/src/struct/FieldsEmbed.js
index 71b2281..d631b76 100644
--- a/src/struct/FieldsEmbed.js
+++ b/src/struct/FieldsEmbed.js
@@ -42,7 +42,7 @@ class FieldsEmbed extends PaginationEmbed {
/**
* Elements in the current page.
- * @returns {Array.<*>} - An array for a page.
+ * @type {Array.<*>}
*/
get elementList() {
const begin = (this.page - 1) * this.elementsPerPage;
@@ -57,11 +57,11 @@ class FieldsEmbed extends PaginationEmbed {
* @example
*
* // Object as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -87,11 +87,11 @@ class FieldsEmbed extends PaginationEmbed {
* @example
*
* // Methods as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -146,7 +146,7 @@ class FieldsEmbed extends PaginationEmbed {
* @param {string} name - Name of the field.
* @param {Function} value - Value of the field. Function for Array.prototype.map().join('\n').
* @param {boolean} [inline=true] - Whether the field is inline with other field or not.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @returns {PaginationEmbed}
*/
formatField(name, value, inline = true) {
this.fields.push({ name, value, inline });
@@ -156,10 +156,10 @@ class FieldsEmbed extends PaginationEmbed {
/**
* Sets the maximum number of elements to be displayed per page.
- * @param {number} [number=10] - Maximum number of elements to be displayed per page.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @param {number} number - Maximum number of elements to be displayed per page.
+ * @returns {PaginationEmbed}
*/
- setElementsPerPage(number = 10) {
+ setElementsPerPage(number) {
if (typeof number !== 'number') throw new Error('setElementsPerPage() only accepts number type.');
this.elementsPerPage = number;
diff --git a/src/struct/base/PaginationEmbed.js b/src/struct/base/PaginationEmbed.js
index 11a5a9f..9f9ec45 100644
--- a/src/struct/base/PaginationEmbed.js
+++ b/src/struct/base/PaginationEmbed.js
@@ -24,7 +24,7 @@ class PaginationEmbed extends MessageEmbed {
/**
* Options for the constructor.
* @typedef {Object} PaginationEmbedOptions
- * @property {User} [authorisedUser=null] - The authorised user to navigate the pages.
+ * @property {User} [authorizedUser=null] - The authorized user to navigate the pages.
* @property {TextChannel} channel - The channel where to send the embed.
* @property {ClientMessageOptions} [clientMessage=null] - Settings for the message sent by the client.
* @property {Array.<*>} array - An array of elements to paginate.
@@ -43,10 +43,10 @@ class PaginationEmbed extends MessageEmbed {
super(options);
/**
- * The authorised user to navigate the pages.
+ * The authorized user to navigate the pages.
* @type {User}
*/
- this.authorisedUser = options.authorisedUser || null;
+ this.authorizedUser = options.authorizedUser || null;
/**
* The channel where to send the embed.
@@ -110,7 +110,7 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the array of elements to paginate.
* @param {Array} array - An array of elements to paginate.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -123,12 +123,12 @@ class PaginationEmbed extends MessageEmbed {
}
/**
- * Set the authorised person to navigate the pages.
- * @param {User} [user=null] - The user object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * Set the authorized person to navigate the pages.
+ * @param {User} user - The user object.
+ * @returns {PaginationEmbed}
*/
- setAuthorisedUser(user = null) {
- this.authorisedUser = user;
+ setAuthorizedUser(user) {
+ this.authorizedUser = user;
return this;
}
@@ -136,7 +136,7 @@ class PaginationEmbed extends MessageEmbed {
/**
* The channel where to send the embed.
* @param {TextChannel} channel - The channel object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setChannel(channel) {
this.channel = channel;
@@ -146,11 +146,11 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the settings for the message sent by the client.
- * @param {Message} [message=null] - The message object sent by the client, if there is any.
+ * @param {Message} message - The message object sent by the client.
* @param {string} [content='Preparing...'] - The custom message content while preparing the embed.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
- setClientMessage(message = null, content = null) {
+ setClientMessage(message, content = null) {
if (!content) content = 'Preparing...';
Object.assign(this.clientMessage, { message, content });
@@ -160,8 +160,8 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the emojis used for navigation buttons.
- * @param {NavigationButtons} [emojis={}] - An object containing customised emojis to use as navigation buttons.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {NavigationButtons} emojis - An object containing customised emojis to use as navigation buttons.
+ * @returns {PaginationEmbed}
*/
setEmojis(emojis) {
Object.assign(this.emojis, emojis);
@@ -171,10 +171,10 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets to jump to a certain page upon calling PaginationEmbed.build().
- * @param {number|string} [param=1] - The page number to jump to. As String: 'back', 'forward'
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number|string} param - The page number to jump to. As String: 'back', 'forward'
+ * @returns {PaginationEmbed}
*/
- setPage(param = 1) {
+ setPage(param) {
const isString = typeof param === 'string';
if (!(!isNaN(param) || isString)) throw new Error('setPage() only accepts number/string type.');
@@ -190,10 +190,10 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the time for awaiting a user action before timeout in ms.
- * @param {number} [timeout=30000] Timeout value in ms.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number} timeout Timeout value in ms.
+ * @returns {PaginationEmbed}
*/
- setTimeout(timeout = 30000) {
+ setTimeout(timeout) {
if (typeof timeout !== 'number') throw new Error('setTimeout() only accepts number type.');
this.timeout = timeout;
@@ -203,10 +203,10 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets whether page number indicator on client's message is shown or not.
- * @param {boolean} [boolean=true] - Show page indicator?
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {boolean} boolean - Show page indicator?
+ * @returns {PaginationEmbed}
*/
- showPageIndicator(boolean = true) {
+ showPageIndicator(boolean) {
if (typeof boolean !== 'boolean') throw new Error('showPageIndicator() only accepts boolean type.');
this.pageIndicator = boolean;
@@ -222,7 +222,7 @@ class PaginationEmbed extends MessageEmbed {
async _verify(pages) {
this
.setChannel(this.channel)
- .setAuthorisedUser(this.authorisedUser)
+ .setAuthorizedUser(this.authorizedUser)
.setClientMessage(this.clientMessage.message, this.clientMessage.content)
.setArray(this.array)
.showPageIndicator(this.pageIndicator)
@@ -298,8 +298,8 @@ class PaginationEmbed extends MessageEmbed {
async _awaitResponse() {
const emojis = Object.values(this.emojis);
const filter = (r, u) => {
- if (this.authorisedUser)
- return u.id === this.authorisedUser.id && emojis.includes(r.emoji.name);
+ if (this.authorizedUser)
+ return u.id === this.authorizedUser.id && emojis.includes(r.emoji.name);
return !u.bot && emojis.includes(r.emoji.name);
};
(async) buildExamples
- // Object as constructor.
const Embeds = require('discord-paginationembed').Embeds;
const { MessageEmbed } = require('discord.js');
// Under message event.
new Embeds({
authorisedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
new MessageEmbed({ title: 'John Doe' }),
new MessageEmbed({ title: 'Jane Doe' })
],
pageIndicator: false,
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
},
description: 'This is one of my embeds with this message!',
color: 0xFF00AE,
timestamp: true
}).build();
+ // Object as constructor.
const { Embeds } = require('discord-paginationembed');
const { MessageEmbed } = require('discord.js');
// Under message event.
new Embeds({
authorizedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
new MessageEmbed({ title: 'John Doe' }),
new MessageEmbed({ title: 'Jane Doe' })
],
pageIndicator: false,
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
},
description: 'This is one of my embeds with this message!',
color: 0xFF00AE,
timestamp: true
}).build();
- // Methods as constructor.
const Embeds = require('discord-paginationembed').Embeds;
const { MessageEmbed } = require('discord.js');
// Under message event.
new Embeds()
.setAuthorisedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
new MessageEmbed({ title: 'John Doe' }),
new MessageEmbed({ title: 'Jane Doe' })
])
.setPageIndicator(false)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.setDescription('This is one of my embeds with this message!')
.setColor(0xFF00AE)
.setTimestamp()
.build();
+ // Methods as constructor.
const { Embeds } = require('discord-paginationembed');
const { MessageEmbed } = require('discord.js');
// Under message event.
new Embeds()
.setAuthorizedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
new MessageEmbed({ title: 'John Doe' }),
new MessageEmbed({ title: 'Jane Doe' })
])
.setPageIndicator(false)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.setDescription('This is one of my embeds with this message!')
.setColor(0xFF00AE)
.setTimestamp()
.build();
@@ -2156,7 +2168,7 @@ Examples
- setArray(array) → {Embeds}
+ setArray(array) → {PaginationEmbed}
@@ -2168,7 +2180,7 @@ setArraySource:
@@ -2290,10 +2302,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -2302,7 +2310,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -2316,7 +2324,7 @@ Returns:
- setAuthor(name, iconURLopt, urlopt) → {Embeds}
+ setAuthor(name, iconURLopt, urlopt) → {PaginationEmbed}
@@ -2328,7 +2336,7 @@ setAuthorSource:
@@ -2539,10 +2547,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -2551,7 +2555,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -2565,7 +2569,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -2588,7 +2592,7 @@ setA
- Inherited From:
@@ -2622,7 +2626,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -2648,12 +2652,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2677,23 +2677,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -2719,10 +2703,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2879,10 +2859,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2905,7 +2881,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -3019,8 +2995,6 @@ Parameters:
- <optional>
-
@@ -3031,12 +3005,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -3098,10 +3070,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -3124,7 +3092,7 @@ Returns:
- setColor(color) → {Embeds}
+ setColor(color) → {PaginationEmbed}
@@ -3136,7 +3104,7 @@ setColorSource:
@@ -3253,10 +3221,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3265,7 +3229,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3279,7 +3243,7 @@ Returns:
- setDescription(description) → {Embeds}
+ setDescription(description) → {PaginationEmbed}
@@ -3291,7 +3255,7 @@ setDesc
- Source:
@@ -3408,10 +3372,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3420,7 +3380,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3434,7 +3394,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -3517,12 +3477,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -3546,23 +3502,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -3588,10 +3528,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -3614,7 +3550,7 @@ Returns:
- setFooter(text, iconURLopt) → {Embeds}
+ setFooter(text, iconURLopt) → {PaginationEmbed}
@@ -3626,7 +3562,7 @@ setFooterSource:
@@ -3798,10 +3734,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3810,7 +3742,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3824,7 +3756,7 @@ Returns:
- setImage(image) → {Embeds}
+ setImage(image) → {PaginationEmbed}
@@ -3836,7 +3768,7 @@ setImageSource:
@@ -3953,10 +3885,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3965,7 +3893,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3979,7 +3907,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -4062,12 +3990,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -4094,23 +4018,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -4136,10 +4044,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -4162,7 +4066,7 @@ Returns:
- setThumbnail(thumbnail) → {Embeds}
+ setThumbnail(thumbnail) → {PaginationEmbed}
@@ -4174,7 +4078,7 @@ setThumbn
- Source:
@@ -4291,10 +4195,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4303,7 +4203,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4317,7 +4217,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -4400,12 +4300,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -4429,23 +4325,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -4471,10 +4351,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -4497,7 +4373,7 @@ Returns:
- setTimestamp() → {Embeds}
+ setTimestamp() → {PaginationEmbed}
@@ -4509,7 +4385,7 @@ setTimest
- Source:
@@ -4577,10 +4453,6 @@ setTimest
Returns:
-
- - Instance of Embeds
-
-
@@ -4589,7 +4461,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4603,7 +4475,7 @@ Returns:
- setTitle(title) → {Embeds}
+ setTitle(title) → {PaginationEmbed}
@@ -4615,7 +4487,7 @@ setTitleSource:
@@ -4732,10 +4604,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4744,7 +4612,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4758,7 +4626,7 @@ Returns:
- setURL(url) → {Embeds}
+ setURL(url) → {PaginationEmbed}
@@ -4770,7 +4638,7 @@ setURLSource:
@@ -4887,10 +4755,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4899,7 +4763,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4913,7 +4777,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -4996,12 +4860,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -5025,23 +4885,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- true
-
-
Show page indicator?
@@ -5067,10 +4911,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -5106,7 +4946,7 @@ Returns:
diff --git a/docs/Embeds.js.html b/docs/Embeds.js.html
index 637f285..ba6e1c4 100644
--- a/docs/Embeds.js.html
+++ b/docs/Embeds.js.html
@@ -22,7 +22,7 @@
@@ -111,6 +111,7 @@ Embeds.js
/**
* The thumbnail of all embeds.
+ * @type {string}
*/
this.thumbnail = options.thumbnail || null;
@@ -135,7 +136,7 @@ Embeds.js
/**
* Embed in the current page.
- * @returns {MessageEmbed} - An instance of MessageEmbed.
+ * @type {MessageEmbed}
*/
get currentEmbed() {
return this.array[this.page - 1];
@@ -144,7 +145,7 @@ Embeds.js
/**
* Adds a blank field to the fields of all embeds.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addBlankField(inline = false) {
const arr = this.array;
@@ -160,7 +161,7 @@ Embeds.js
* @param {string} name - The name of the field.
* @param {string} value - The value of the field.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addField(name, value, inline = false) {
if (!name && !value) return this;
@@ -179,12 +180,12 @@ Embeds.js
* @example
*
* // Object as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -208,12 +209,12 @@ Embeds.js
* @example
*
* // Methods as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -269,7 +270,7 @@ Embeds.js
/**
* Sets the array of embeds to paginate.
* @param {Array} array - An array of embeds to paginate.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -290,7 +291,7 @@ Embeds.js
* @param {StringResolvable} name - The name of the author.
* @param {string} [iconURL=null] - The icon URL of the author.
* @param {string} [url=null] - The URL of the author.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setAuthor(name, iconURL = null, url = null) {
if (!name) return this;
@@ -306,7 +307,7 @@ Embeds.js
/**
* Sets the color of all embeds.
* @param {ColorResolvable} color - The color of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setColor(color) {
if (!color) return this;
@@ -322,7 +323,7 @@ Embeds.js
/**
* Sets the description of all embeds.
* @param {string} description - The description of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setDescription(description) {
if (!description) return this;
@@ -339,7 +340,7 @@ Embeds.js
* Sets the footer of all embeds.
* @param {string} text - The footer text.
* @param {string} [iconURL=null] - URL for the footer's icon.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setFooter(text, iconURL = null) {
if (!text) return this;
@@ -355,7 +356,7 @@ Embeds.js
/**
* Sets the image of all embeds.
* @param {string} image - The image of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setImage(image) {
if (!image) return this;
@@ -371,7 +372,7 @@ Embeds.js
/**
* Sets the thumbnail of all embeds.
* @param {string} thumbnail - The thumbnail of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setThumbnail(thumbnail) {
if (!thumbnail) return this;
@@ -386,7 +387,7 @@ Embeds.js
/**
* Sets the timestamp of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTimestamp() {
const arr = this.array;
@@ -400,7 +401,7 @@ Embeds.js
/**
* Sets the title of all embeds.
* @param {string} title - The title of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTitle(title) {
if (!title) return this;
@@ -416,7 +417,7 @@ Embeds.js
/**
* Sets the URL of all embeds.
* @param {string} url - The URL of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setURL(url) {
if (!url) return this;
@@ -455,7 +456,7 @@ Embeds.js
diff --git a/docs/FieldsEmbed.html b/docs/FieldsEmbed.html
index 948c77a..e3a7000 100644
--- a/docs/FieldsEmbed.html
+++ b/docs/FieldsEmbed.html
@@ -22,7 +22,7 @@
@@ -304,7 +304,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -326,7 +326,7 @@ authori
- Inherited From:
@@ -360,7 +360,7 @@ authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -538,7 +538,7 @@ Type:
-elementList
+elementList :Array.<*>
@@ -594,6 +594,16 @@ elementLis
+ Type:
+
+ -
+
+Array.<*>
+
+
+
+
+
@@ -1063,9 +1073,9 @@ (async) buildExamples
- // Object as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed({
authorisedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
+ // Object as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed({
authorizedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
- // Methods as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed()
.setAuthorisedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
+ // Methods as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed()
.setAuthorizedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
@@ -1089,7 +1099,7 @@ Examples
- formatField(name, value, inlineopt) → {FieldsEmbed}
+ formatField(name, value, inlineopt) → {PaginationEmbed}
@@ -1308,10 +1318,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -1320,7 +1326,7 @@ Returns:
-
-FieldsEmbed
+PaginationEmbed
@@ -1468,10 +1474,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1494,7 +1496,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1517,7 +1519,7 @@ setA
- Inherited From:
@@ -1551,7 +1553,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1577,12 +1579,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1606,23 +1604,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1648,10 +1630,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1808,10 +1786,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1834,7 +1808,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1948,8 +1922,6 @@ Parameters:
- <optional>
-
@@ -1960,12 +1932,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -2027,10 +1997,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2053,7 +2019,7 @@ Returns:
- setElementsPerPage(numberopt) → {FieldsEmbed}
+ setElementsPerPage(number) → {PaginationEmbed}
@@ -2131,12 +2097,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2160,24 +2122,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 10
-
-
-
Maximum number of elements to be displayed per page.
@@ -2202,10 +2148,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -2214,7 +2156,7 @@ Returns:
-
-FieldsEmbed
+PaginationEmbed
@@ -2228,7 +2170,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -2311,12 +2253,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2340,23 +2278,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -2382,10 +2304,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2408,7 +2326,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -2491,12 +2409,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2523,24 +2437,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 1
-
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -2565,10 +2463,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2591,7 +2485,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -2674,12 +2568,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2703,23 +2593,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2745,10 +2619,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2771,7 +2641,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2854,12 +2724,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2883,24 +2749,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2925,10 +2775,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2964,7 +2810,7 @@ Returns:
diff --git a/docs/FieldsEmbed.js.html b/docs/FieldsEmbed.js.html
index 5d36097..9bad270 100644
--- a/docs/FieldsEmbed.js.html
+++ b/docs/FieldsEmbed.js.html
@@ -22,7 +22,7 @@
@@ -81,7 +81,7 @@ FieldsEmbed.js
/**
* Elements in the current page.
- * @returns {Array.<*>} - An array for a page.
+ * @type {Array.<*>}
*/
get elementList() {
const begin = (this.page - 1) * this.elementsPerPage;
@@ -96,11 +96,11 @@ FieldsEmbed.js
* @example
*
* // Object as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -126,11 +126,11 @@ FieldsEmbed.js
* @example
*
* // Methods as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -185,7 +185,7 @@ FieldsEmbed.js
* @param {string} name - Name of the field.
* @param {Function} value - Value of the field. Function for Array.prototype.map().join('\n').
* @param {boolean} [inline=true] - Whether the field is inline with other field or not.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @returns {PaginationEmbed}
*/
formatField(name, value, inline = true) {
this.fields.push({ name, value, inline });
@@ -195,10 +195,10 @@ FieldsEmbed.js
/**
* Sets the maximum number of elements to be displayed per page.
- * @param {number} [number=10] - Maximum number of elements to be displayed per page.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @param {number} number - Maximum number of elements to be displayed per page.
+ * @returns {PaginationEmbed}
*/
- setElementsPerPage(number = 10) {
+ setElementsPerPage(number) {
if (typeof number !== 'number') throw new Error('setElementsPerPage() only accepts number type.');
this.elementsPerPage = number;
@@ -266,7 +266,7 @@ FieldsEmbed.js
diff --git a/docs/PaginationEmbed.html b/docs/PaginationEmbed.html
index 58d735a..994485d 100644
--- a/docs/PaginationEmbed.html
+++ b/docs/PaginationEmbed.html
@@ -22,7 +22,7 @@
@@ -299,7 +299,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -350,7 +350,7 @@ authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -951,10 +951,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -977,7 +973,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1029,7 +1025,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1055,12 +1051,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1084,23 +1076,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1126,10 +1102,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1281,10 +1253,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1307,7 +1275,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1416,8 +1384,6 @@ Parameters:
- <optional>
-
@@ -1428,12 +1394,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -1495,10 +1459,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1521,7 +1481,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -1599,12 +1559,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1628,23 +1584,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -1670,10 +1610,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1696,7 +1632,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -1774,12 +1710,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1806,23 +1738,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -1848,10 +1764,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1874,7 +1786,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -1952,12 +1864,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1981,23 +1889,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2023,10 +1915,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2049,7 +1937,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2127,12 +2015,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2156,24 +2040,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2198,10 +2066,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2237,7 +2101,7 @@ Returns:
diff --git a/docs/base_PaginationEmbed.js.html b/docs/base_PaginationEmbed.js.html
index c40af28..e74e322 100644
--- a/docs/base_PaginationEmbed.js.html
+++ b/docs/base_PaginationEmbed.js.html
@@ -22,7 +22,7 @@
@@ -63,7 +63,7 @@ base/PaginationEmbed.js
/**
* Options for the constructor.
* @typedef {Object} PaginationEmbedOptions
- * @property {User} [authorisedUser=null] - The authorised user to navigate the pages.
+ * @property {User} [authorizedUser=null] - The authorized user to navigate the pages.
* @property {TextChannel} channel - The channel where to send the embed.
* @property {ClientMessageOptions} [clientMessage=null] - Settings for the message sent by the client.
* @property {Array.<*>} array - An array of elements to paginate.
@@ -82,10 +82,10 @@ base/PaginationEmbed.js
super(options);
/**
- * The authorised user to navigate the pages.
+ * The authorized user to navigate the pages.
* @type {User}
*/
- this.authorisedUser = options.authorisedUser || null;
+ this.authorizedUser = options.authorizedUser || null;
/**
* The channel where to send the embed.
@@ -149,7 +149,7 @@ base/PaginationEmbed.js
/**
* Sets the array of elements to paginate.
* @param {Array} array - An array of elements to paginate.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -162,12 +162,12 @@ base/PaginationEmbed.js
}
/**
- * Set the authorised person to navigate the pages.
- * @param {User} [user=null] - The user object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * Set the authorized person to navigate the pages.
+ * @param {User} user - The user object.
+ * @returns {PaginationEmbed}
*/
- setAuthorisedUser(user = null) {
- this.authorisedUser = user;
+ setAuthorizedUser(user) {
+ this.authorizedUser = user;
return this;
}
@@ -175,7 +175,7 @@ base/PaginationEmbed.js
/**
* The channel where to send the embed.
* @param {TextChannel} channel - The channel object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setChannel(channel) {
this.channel = channel;
@@ -185,11 +185,11 @@ base/PaginationEmbed.js
/**
* Sets the settings for the message sent by the client.
- * @param {Message} [message=null] - The message object sent by the client, if there is any.
+ * @param {Message} message - The message object sent by the client.
* @param {string} [content='Preparing...'] - The custom message content while preparing the embed.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
- setClientMessage(message = null, content = null) {
+ setClientMessage(message, content = null) {
if (!content) content = 'Preparing...';
Object.assign(this.clientMessage, { message, content });
@@ -199,8 +199,8 @@ base/PaginationEmbed.js
/**
* Sets the emojis used for navigation buttons.
- * @param {NavigationButtons} [emojis={}] - An object containing customised emojis to use as navigation buttons.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {NavigationButtons} emojis - An object containing customised emojis to use as navigation buttons.
+ * @returns {PaginationEmbed}
*/
setEmojis(emojis) {
Object.assign(this.emojis, emojis);
@@ -210,10 +210,10 @@ base/PaginationEmbed.js
/**
* Sets to jump to a certain page upon calling PaginationEmbed.build().
- * @param {number|string} [param=1] - The page number to jump to. As String: 'back', 'forward'
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number|string} param - The page number to jump to. As String: 'back', 'forward'
+ * @returns {PaginationEmbed}
*/
- setPage(param = 1) {
+ setPage(param) {
const isString = typeof param === 'string';
if (!(!isNaN(param) || isString)) throw new Error('setPage() only accepts number/string type.');
@@ -229,10 +229,10 @@ base/PaginationEmbed.js
/**
* Sets the time for awaiting a user action before timeout in ms.
- * @param {number} [timeout=30000] Timeout value in ms.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number} timeout Timeout value in ms.
+ * @returns {PaginationEmbed}
*/
- setTimeout(timeout = 30000) {
+ setTimeout(timeout) {
if (typeof timeout !== 'number') throw new Error('setTimeout() only accepts number type.');
this.timeout = timeout;
@@ -242,10 +242,10 @@ base/PaginationEmbed.js
/**
* Sets whether page number indicator on client's message is shown or not.
- * @param {boolean} [boolean=true] - Show page indicator?
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {boolean} boolean - Show page indicator?
+ * @returns {PaginationEmbed}
*/
- showPageIndicator(boolean = true) {
+ showPageIndicator(boolean) {
if (typeof boolean !== 'boolean') throw new Error('showPageIndicator() only accepts boolean type.');
this.pageIndicator = boolean;
@@ -261,7 +261,7 @@ base/PaginationEmbed.js
async _verify(pages) {
this
.setChannel(this.channel)
- .setAuthorisedUser(this.authorisedUser)
+ .setAuthorizedUser(this.authorizedUser)
.setClientMessage(this.clientMessage.message, this.clientMessage.content)
.setArray(this.array)
.showPageIndicator(this.pageIndicator)
@@ -337,8 +337,8 @@ base/PaginationEmbed.js
async _awaitResponse() {
const emojis = Object.values(this.emojis);
const filter = (r, u) => {
- if (this.authorisedUser)
- return u.id === this.authorisedUser.id && emojis.includes(r.emoji.name);
+ if (this.authorizedUser)
+ return u.id === this.authorizedUser.id && emojis.includes(r.emoji.name);
return !u.bot && emojis.includes(r.emoji.name);
};
@@ -432,7 +432,7 @@ base/PaginationEmbed.js
diff --git a/docs/global.html b/docs/global.html
index 23000ba..3f7e34b 100644
--- a/docs/global.html
+++ b/docs/global.html
@@ -22,7 +22,7 @@
@@ -1487,7 +1487,7 @@ Properties:
- authorisedUser
+ authorizedUser
@@ -1517,7 +1517,7 @@ Properties:
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -1820,7 +1820,7 @@ Type:
diff --git a/docs/index.html b/docs/index.html
index 80eb8c4..c53f893 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -22,7 +22,7 @@
@@ -51,20 +51,21 @@ Home
Classes
const FieldsEmbedMode = require('discord-paginationembed').FieldsEmbed;
+const { FieldsEmbed: FieldsEmbedMode } = require('discord-paginationembed');
new FieldsEmbedMode()
.setArray([ { name: "John Doe" }, { name: "Jane Doe" } ])
- .setAuthorisedUser(message.author)
+ .setAuthorizedUser(message.author)
.setChannel(message.channel)
.setElementsPerPage(1)
.setPage(2)
.showPageIndicator(false)
- .build();
const EmbedsMode = require('discord-paginationembed').Embeds;
+ .build();
const { Embeds: EmbedsMode } = require('discord-paginationembed');
const { MessageEmbed } = require("discord.js");
const embeds = [];
@@ -76,7 +77,7 @@ Under message
event
new EmbedsMode()
.setArray(embeds)
- .setAuthorisedUser(message.author)
+ .setAuthorizedUser(message.author)
.setChannel(message.channel)
.showPageIndicator(true)
.setPage(3)
@@ -99,7 +100,7 @@ Contributing
- Fork this repository.
- Execute
npm install
- Code and code and code and code and... code!
-npm test
to verify your additions/adjustments are following ESLint's rules and verify docs are valid.
+npm test
to verify if your additions/adjustments are following ESLint's rules and to verify if the docs are valid.
- File a Pull Request!
License
MIT
@@ -115,7 +116,7 @@ License
MIT
diff --git a/package.json b/package.json
index f30a2be..44c632d 100644
--- a/package.json
+++ b/package.json
@@ -1,11 +1,11 @@
{
"name": "discord-paginationembed",
- "version": "0.1.0",
+ "version": "0.2.0",
"description": "Pagination Embed for Discord.JS",
"main": "./src/index.js",
"scripts": {
- "test": "eslint --ignore-path .eslintignore . && npm run generate-docs",
- "generate-docs": "jsdoc -c jsdoc.json"
+ "test": "eslint ./src && npm run docs",
+ "docs": "node_modules/.bin/jsdoc -c .jsdoc.json"
},
"repository": {
"type": "git",
@@ -27,7 +27,7 @@
"url": "https://github.com/gazmull/discord-paginationembed/issues"
},
"homepage": "https://github.com/gazmull/discord-paginationembed#readme",
- "dependencies": {
+ "peerDependencies": {
"discord.js": "discordjs/discord.js"
},
"devDependencies": {
diff --git a/src/struct/Embeds.js b/src/struct/Embeds.js
index e8ed7be..ac4fb33 100644
--- a/src/struct/Embeds.js
+++ b/src/struct/Embeds.js
@@ -72,6 +72,7 @@ class Embeds extends PaginationEmbed {
/**
* The thumbnail of all embeds.
+ * @type {string}
*/
this.thumbnail = options.thumbnail || null;
@@ -96,7 +97,7 @@ class Embeds extends PaginationEmbed {
/**
* Embed in the current page.
- * @returns {MessageEmbed} - An instance of MessageEmbed.
+ * @type {MessageEmbed}
*/
get currentEmbed() {
return this.array[this.page - 1];
@@ -105,7 +106,7 @@ class Embeds extends PaginationEmbed {
/**
* Adds a blank field to the fields of all embeds.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addBlankField(inline = false) {
const arr = this.array;
@@ -121,7 +122,7 @@ class Embeds extends PaginationEmbed {
* @param {string} name - The name of the field.
* @param {string} value - The value of the field.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addField(name, value, inline = false) {
if (!name && !value) return this;
@@ -140,12 +141,12 @@ class Embeds extends PaginationEmbed {
* @example
*
* // Object as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -169,12 +170,12 @@ class Embeds extends PaginationEmbed {
* @example
*
* // Methods as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -230,7 +231,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the array of embeds to paginate.
* @param {Array} array - An array of embeds to paginate.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -251,7 +252,7 @@ class Embeds extends PaginationEmbed {
* @param {StringResolvable} name - The name of the author.
* @param {string} [iconURL=null] - The icon URL of the author.
* @param {string} [url=null] - The URL of the author.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setAuthor(name, iconURL = null, url = null) {
if (!name) return this;
@@ -267,7 +268,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the color of all embeds.
* @param {ColorResolvable} color - The color of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setColor(color) {
if (!color) return this;
@@ -283,7 +284,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the description of all embeds.
* @param {string} description - The description of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setDescription(description) {
if (!description) return this;
@@ -300,7 +301,7 @@ class Embeds extends PaginationEmbed {
* Sets the footer of all embeds.
* @param {string} text - The footer text.
* @param {string} [iconURL=null] - URL for the footer's icon.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setFooter(text, iconURL = null) {
if (!text) return this;
@@ -316,7 +317,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the image of all embeds.
* @param {string} image - The image of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setImage(image) {
if (!image) return this;
@@ -332,7 +333,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the thumbnail of all embeds.
* @param {string} thumbnail - The thumbnail of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setThumbnail(thumbnail) {
if (!thumbnail) return this;
@@ -347,7 +348,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the timestamp of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTimestamp() {
const arr = this.array;
@@ -361,7 +362,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the title of all embeds.
* @param {string} title - The title of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTitle(title) {
if (!title) return this;
@@ -377,7 +378,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the URL of all embeds.
* @param {string} url - The URL of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setURL(url) {
if (!url) return this;
diff --git a/src/struct/FieldsEmbed.js b/src/struct/FieldsEmbed.js
index 71b2281..d631b76 100644
--- a/src/struct/FieldsEmbed.js
+++ b/src/struct/FieldsEmbed.js
@@ -42,7 +42,7 @@ class FieldsEmbed extends PaginationEmbed {
/**
* Elements in the current page.
- * @returns {Array.<*>} - An array for a page.
+ * @type {Array.<*>}
*/
get elementList() {
const begin = (this.page - 1) * this.elementsPerPage;
@@ -57,11 +57,11 @@ class FieldsEmbed extends PaginationEmbed {
* @example
*
* // Object as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -87,11 +87,11 @@ class FieldsEmbed extends PaginationEmbed {
* @example
*
* // Methods as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -146,7 +146,7 @@ class FieldsEmbed extends PaginationEmbed {
* @param {string} name - Name of the field.
* @param {Function} value - Value of the field. Function for Array.prototype.map().join('\n').
* @param {boolean} [inline=true] - Whether the field is inline with other field or not.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @returns {PaginationEmbed}
*/
formatField(name, value, inline = true) {
this.fields.push({ name, value, inline });
@@ -156,10 +156,10 @@ class FieldsEmbed extends PaginationEmbed {
/**
* Sets the maximum number of elements to be displayed per page.
- * @param {number} [number=10] - Maximum number of elements to be displayed per page.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @param {number} number - Maximum number of elements to be displayed per page.
+ * @returns {PaginationEmbed}
*/
- setElementsPerPage(number = 10) {
+ setElementsPerPage(number) {
if (typeof number !== 'number') throw new Error('setElementsPerPage() only accepts number type.');
this.elementsPerPage = number;
diff --git a/src/struct/base/PaginationEmbed.js b/src/struct/base/PaginationEmbed.js
index 11a5a9f..9f9ec45 100644
--- a/src/struct/base/PaginationEmbed.js
+++ b/src/struct/base/PaginationEmbed.js
@@ -24,7 +24,7 @@ class PaginationEmbed extends MessageEmbed {
/**
* Options for the constructor.
* @typedef {Object} PaginationEmbedOptions
- * @property {User} [authorisedUser=null] - The authorised user to navigate the pages.
+ * @property {User} [authorizedUser=null] - The authorized user to navigate the pages.
* @property {TextChannel} channel - The channel where to send the embed.
* @property {ClientMessageOptions} [clientMessage=null] - Settings for the message sent by the client.
* @property {Array.<*>} array - An array of elements to paginate.
@@ -43,10 +43,10 @@ class PaginationEmbed extends MessageEmbed {
super(options);
/**
- * The authorised user to navigate the pages.
+ * The authorized user to navigate the pages.
* @type {User}
*/
- this.authorisedUser = options.authorisedUser || null;
+ this.authorizedUser = options.authorizedUser || null;
/**
* The channel where to send the embed.
@@ -110,7 +110,7 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the array of elements to paginate.
* @param {Array} array - An array of elements to paginate.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -123,12 +123,12 @@ class PaginationEmbed extends MessageEmbed {
}
/**
- * Set the authorised person to navigate the pages.
- * @param {User} [user=null] - The user object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * Set the authorized person to navigate the pages.
+ * @param {User} user - The user object.
+ * @returns {PaginationEmbed}
*/
- setAuthorisedUser(user = null) {
- this.authorisedUser = user;
+ setAuthorizedUser(user) {
+ this.authorizedUser = user;
return this;
}
@@ -136,7 +136,7 @@ class PaginationEmbed extends MessageEmbed {
/**
* The channel where to send the embed.
* @param {TextChannel} channel - The channel object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setChannel(channel) {
this.channel = channel;
@@ -146,11 +146,11 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the settings for the message sent by the client.
- * @param {Message} [message=null] - The message object sent by the client, if there is any.
+ * @param {Message} message - The message object sent by the client.
* @param {string} [content='Preparing...'] - The custom message content while preparing the embed.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
- setClientMessage(message = null, content = null) {
+ setClientMessage(message, content = null) {
if (!content) content = 'Preparing...';
Object.assign(this.clientMessage, { message, content });
@@ -160,8 +160,8 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the emojis used for navigation buttons.
- * @param {NavigationButtons} [emojis={}] - An object containing customised emojis to use as navigation buttons.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {NavigationButtons} emojis - An object containing customised emojis to use as navigation buttons.
+ * @returns {PaginationEmbed}
*/
setEmojis(emojis) {
Object.assign(this.emojis, emojis);
@@ -171,10 +171,10 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets to jump to a certain page upon calling PaginationEmbed.build().
- * @param {number|string} [param=1] - The page number to jump to. As String: 'back', 'forward'
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number|string} param - The page number to jump to. As String: 'back', 'forward'
+ * @returns {PaginationEmbed}
*/
- setPage(param = 1) {
+ setPage(param) {
const isString = typeof param === 'string';
if (!(!isNaN(param) || isString)) throw new Error('setPage() only accepts number/string type.');
@@ -190,10 +190,10 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the time for awaiting a user action before timeout in ms.
- * @param {number} [timeout=30000] Timeout value in ms.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number} timeout Timeout value in ms.
+ * @returns {PaginationEmbed}
*/
- setTimeout(timeout = 30000) {
+ setTimeout(timeout) {
if (typeof timeout !== 'number') throw new Error('setTimeout() only accepts number type.');
this.timeout = timeout;
@@ -203,10 +203,10 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets whether page number indicator on client's message is shown or not.
- * @param {boolean} [boolean=true] - Show page indicator?
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {boolean} boolean - Show page indicator?
+ * @returns {PaginationEmbed}
*/
- showPageIndicator(boolean = true) {
+ showPageIndicator(boolean) {
if (typeof boolean !== 'boolean') throw new Error('showPageIndicator() only accepts boolean type.');
this.pageIndicator = boolean;
@@ -222,7 +222,7 @@ class PaginationEmbed extends MessageEmbed {
async _verify(pages) {
this
.setChannel(this.channel)
- .setAuthorisedUser(this.authorisedUser)
+ .setAuthorizedUser(this.authorizedUser)
.setClientMessage(this.clientMessage.message, this.clientMessage.content)
.setArray(this.array)
.showPageIndicator(this.pageIndicator)
@@ -298,8 +298,8 @@ class PaginationEmbed extends MessageEmbed {
async _awaitResponse() {
const emojis = Object.values(this.emojis);
const filter = (r, u) => {
- if (this.authorisedUser)
- return u.id === this.authorisedUser.id && emojis.includes(r.emoji.name);
+ if (this.authorizedUser)
+ return u.id === this.authorizedUser.id && emojis.includes(r.emoji.name);
return !u.bot && emojis.includes(r.emoji.name);
};
// Object as constructor.
const Embeds = require('discord-paginationembed').Embeds;
const { MessageEmbed } = require('discord.js');
// Under message event.
new Embeds({
authorisedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
new MessageEmbed({ title: 'John Doe' }),
new MessageEmbed({ title: 'Jane Doe' })
],
pageIndicator: false,
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
},
description: 'This is one of my embeds with this message!',
color: 0xFF00AE,
timestamp: true
}).build();
+ // Object as constructor.
const { Embeds } = require('discord-paginationembed');
const { MessageEmbed } = require('discord.js');
// Under message event.
new Embeds({
authorizedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
new MessageEmbed({ title: 'John Doe' }),
new MessageEmbed({ title: 'Jane Doe' })
],
pageIndicator: false,
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
},
description: 'This is one of my embeds with this message!',
color: 0xFF00AE,
timestamp: true
}).build();
- // Methods as constructor.
const Embeds = require('discord-paginationembed').Embeds;
const { MessageEmbed } = require('discord.js');
// Under message event.
new Embeds()
.setAuthorisedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
new MessageEmbed({ title: 'John Doe' }),
new MessageEmbed({ title: 'Jane Doe' })
])
.setPageIndicator(false)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.setDescription('This is one of my embeds with this message!')
.setColor(0xFF00AE)
.setTimestamp()
.build();
+ // Methods as constructor.
const { Embeds } = require('discord-paginationembed');
const { MessageEmbed } = require('discord.js');
// Under message event.
new Embeds()
.setAuthorizedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
new MessageEmbed({ title: 'John Doe' }),
new MessageEmbed({ title: 'Jane Doe' })
])
.setPageIndicator(false)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.setDescription('This is one of my embeds with this message!')
.setColor(0xFF00AE)
.setTimestamp()
.build();
@@ -2156,7 +2168,7 @@ Examples
-setArray(array) → {Embeds}
+setArray(array) → {PaginationEmbed}
@@ -2168,7 +2180,7 @@setArraySource:
@@ -2290,10 +2302,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -2302,7 +2310,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -2316,7 +2324,7 @@ Returns:
- setAuthor(name, iconURLopt, urlopt) → {Embeds}
+ setAuthor(name, iconURLopt, urlopt) → {PaginationEmbed}
@@ -2328,7 +2336,7 @@ setAuthorSource:
@@ -2539,10 +2547,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -2551,7 +2555,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -2565,7 +2569,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -2588,7 +2592,7 @@ setA
- Inherited From:
@@ -2622,7 +2626,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -2648,12 +2652,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2677,23 +2677,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -2719,10 +2703,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2879,10 +2859,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2905,7 +2881,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -3019,8 +2995,6 @@ Parameters:
- <optional>
-
@@ -3031,12 +3005,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -3098,10 +3070,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -3124,7 +3092,7 @@ Returns:
- setColor(color) → {Embeds}
+ setColor(color) → {PaginationEmbed}
@@ -3136,7 +3104,7 @@ setColorSource:
@@ -3253,10 +3221,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3265,7 +3229,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3279,7 +3243,7 @@ Returns:
- setDescription(description) → {Embeds}
+ setDescription(description) → {PaginationEmbed}
@@ -3291,7 +3255,7 @@ setDesc
- Source:
@@ -3408,10 +3372,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3420,7 +3380,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3434,7 +3394,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -3517,12 +3477,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -3546,23 +3502,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -3588,10 +3528,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -3614,7 +3550,7 @@ Returns:
- setFooter(text, iconURLopt) → {Embeds}
+ setFooter(text, iconURLopt) → {PaginationEmbed}
@@ -3626,7 +3562,7 @@ setFooterSource:
@@ -3798,10 +3734,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3810,7 +3742,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3824,7 +3756,7 @@ Returns:
- setImage(image) → {Embeds}
+ setImage(image) → {PaginationEmbed}
@@ -3836,7 +3768,7 @@ setImageSource:
@@ -3953,10 +3885,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3965,7 +3893,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3979,7 +3907,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -4062,12 +3990,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -4094,23 +4018,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -4136,10 +4044,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -4162,7 +4066,7 @@ Returns:
- setThumbnail(thumbnail) → {Embeds}
+ setThumbnail(thumbnail) → {PaginationEmbed}
@@ -4174,7 +4078,7 @@ setThumbn
- Source:
@@ -4291,10 +4195,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4303,7 +4203,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4317,7 +4217,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -4400,12 +4300,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -4429,23 +4325,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -4471,10 +4351,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -4497,7 +4373,7 @@ Returns:
- setTimestamp() → {Embeds}
+ setTimestamp() → {PaginationEmbed}
@@ -4509,7 +4385,7 @@ setTimest
- Source:
@@ -4577,10 +4453,6 @@ setTimest
Returns:
-
- - Instance of Embeds
-
-
@@ -4589,7 +4461,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4603,7 +4475,7 @@ Returns:
- setTitle(title) → {Embeds}
+ setTitle(title) → {PaginationEmbed}
@@ -4615,7 +4487,7 @@ setTitleSource:
@@ -4732,10 +4604,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4744,7 +4612,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4758,7 +4626,7 @@ Returns:
- setURL(url) → {Embeds}
+ setURL(url) → {PaginationEmbed}
@@ -4770,7 +4638,7 @@ setURLSource:
@@ -4887,10 +4755,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4899,7 +4763,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4913,7 +4777,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -4996,12 +4860,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -5025,23 +4885,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- true
-
-
Show page indicator?
@@ -5067,10 +4911,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -5106,7 +4946,7 @@ Returns:
diff --git a/docs/Embeds.js.html b/docs/Embeds.js.html
index 637f285..ba6e1c4 100644
--- a/docs/Embeds.js.html
+++ b/docs/Embeds.js.html
@@ -22,7 +22,7 @@
@@ -111,6 +111,7 @@ Embeds.js
/**
* The thumbnail of all embeds.
+ * @type {string}
*/
this.thumbnail = options.thumbnail || null;
@@ -135,7 +136,7 @@ Embeds.js
/**
* Embed in the current page.
- * @returns {MessageEmbed} - An instance of MessageEmbed.
+ * @type {MessageEmbed}
*/
get currentEmbed() {
return this.array[this.page - 1];
@@ -144,7 +145,7 @@ Embeds.js
/**
* Adds a blank field to the fields of all embeds.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addBlankField(inline = false) {
const arr = this.array;
@@ -160,7 +161,7 @@ Embeds.js
* @param {string} name - The name of the field.
* @param {string} value - The value of the field.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addField(name, value, inline = false) {
if (!name && !value) return this;
@@ -179,12 +180,12 @@ Embeds.js
* @example
*
* // Object as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -208,12 +209,12 @@ Embeds.js
* @example
*
* // Methods as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -269,7 +270,7 @@ Embeds.js
/**
* Sets the array of embeds to paginate.
* @param {Array} array - An array of embeds to paginate.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -290,7 +291,7 @@ Embeds.js
* @param {StringResolvable} name - The name of the author.
* @param {string} [iconURL=null] - The icon URL of the author.
* @param {string} [url=null] - The URL of the author.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setAuthor(name, iconURL = null, url = null) {
if (!name) return this;
@@ -306,7 +307,7 @@ Embeds.js
/**
* Sets the color of all embeds.
* @param {ColorResolvable} color - The color of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setColor(color) {
if (!color) return this;
@@ -322,7 +323,7 @@ Embeds.js
/**
* Sets the description of all embeds.
* @param {string} description - The description of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setDescription(description) {
if (!description) return this;
@@ -339,7 +340,7 @@ Embeds.js
* Sets the footer of all embeds.
* @param {string} text - The footer text.
* @param {string} [iconURL=null] - URL for the footer's icon.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setFooter(text, iconURL = null) {
if (!text) return this;
@@ -355,7 +356,7 @@ Embeds.js
/**
* Sets the image of all embeds.
* @param {string} image - The image of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setImage(image) {
if (!image) return this;
@@ -371,7 +372,7 @@ Embeds.js
/**
* Sets the thumbnail of all embeds.
* @param {string} thumbnail - The thumbnail of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setThumbnail(thumbnail) {
if (!thumbnail) return this;
@@ -386,7 +387,7 @@ Embeds.js
/**
* Sets the timestamp of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTimestamp() {
const arr = this.array;
@@ -400,7 +401,7 @@ Embeds.js
/**
* Sets the title of all embeds.
* @param {string} title - The title of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTitle(title) {
if (!title) return this;
@@ -416,7 +417,7 @@ Embeds.js
/**
* Sets the URL of all embeds.
* @param {string} url - The URL of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setURL(url) {
if (!url) return this;
@@ -455,7 +456,7 @@ Embeds.js
diff --git a/docs/FieldsEmbed.html b/docs/FieldsEmbed.html
index 948c77a..e3a7000 100644
--- a/docs/FieldsEmbed.html
+++ b/docs/FieldsEmbed.html
@@ -22,7 +22,7 @@
@@ -304,7 +304,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -326,7 +326,7 @@ authori
- Inherited From:
@@ -360,7 +360,7 @@ authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -538,7 +538,7 @@ Type:
-elementList
+elementList :Array.<*>
@@ -594,6 +594,16 @@ elementLis
+ Type:
+
+ -
+
+Array.<*>
+
+
+
+
+
@@ -1063,9 +1073,9 @@ (async) buildExamples
- // Object as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed({
authorisedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
+ // Object as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed({
authorizedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
- // Methods as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed()
.setAuthorisedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
+ // Methods as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed()
.setAuthorizedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
@@ -1089,7 +1099,7 @@ Examples
- formatField(name, value, inlineopt) → {FieldsEmbed}
+ formatField(name, value, inlineopt) → {PaginationEmbed}
@@ -1308,10 +1318,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -1320,7 +1326,7 @@ Returns:
-
-FieldsEmbed
+PaginationEmbed
@@ -1468,10 +1474,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1494,7 +1496,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1517,7 +1519,7 @@ setA
- Inherited From:
@@ -1551,7 +1553,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1577,12 +1579,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1606,23 +1604,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1648,10 +1630,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1808,10 +1786,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1834,7 +1808,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1948,8 +1922,6 @@ Parameters:
- <optional>
-
@@ -1960,12 +1932,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -2027,10 +1997,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2053,7 +2019,7 @@ Returns:
- setElementsPerPage(numberopt) → {FieldsEmbed}
+ setElementsPerPage(number) → {PaginationEmbed}
@@ -2131,12 +2097,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2160,24 +2122,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 10
-
-
-
Maximum number of elements to be displayed per page.
@@ -2202,10 +2148,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -2214,7 +2156,7 @@ Returns:
-
-FieldsEmbed
+PaginationEmbed
@@ -2228,7 +2170,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -2311,12 +2253,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2340,23 +2278,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -2382,10 +2304,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2408,7 +2326,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -2491,12 +2409,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2523,24 +2437,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 1
-
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -2565,10 +2463,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2591,7 +2485,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -2674,12 +2568,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2703,23 +2593,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2745,10 +2619,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2771,7 +2641,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2854,12 +2724,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2883,24 +2749,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2925,10 +2775,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2964,7 +2810,7 @@ Returns:
diff --git a/docs/FieldsEmbed.js.html b/docs/FieldsEmbed.js.html
index 5d36097..9bad270 100644
--- a/docs/FieldsEmbed.js.html
+++ b/docs/FieldsEmbed.js.html
@@ -22,7 +22,7 @@
@@ -81,7 +81,7 @@ FieldsEmbed.js
/**
* Elements in the current page.
- * @returns {Array.<*>} - An array for a page.
+ * @type {Array.<*>}
*/
get elementList() {
const begin = (this.page - 1) * this.elementsPerPage;
@@ -96,11 +96,11 @@ FieldsEmbed.js
* @example
*
* // Object as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -126,11 +126,11 @@ FieldsEmbed.js
* @example
*
* // Methods as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -185,7 +185,7 @@ FieldsEmbed.js
* @param {string} name - Name of the field.
* @param {Function} value - Value of the field. Function for Array.prototype.map().join('\n').
* @param {boolean} [inline=true] - Whether the field is inline with other field or not.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @returns {PaginationEmbed}
*/
formatField(name, value, inline = true) {
this.fields.push({ name, value, inline });
@@ -195,10 +195,10 @@ FieldsEmbed.js
/**
* Sets the maximum number of elements to be displayed per page.
- * @param {number} [number=10] - Maximum number of elements to be displayed per page.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @param {number} number - Maximum number of elements to be displayed per page.
+ * @returns {PaginationEmbed}
*/
- setElementsPerPage(number = 10) {
+ setElementsPerPage(number) {
if (typeof number !== 'number') throw new Error('setElementsPerPage() only accepts number type.');
this.elementsPerPage = number;
@@ -266,7 +266,7 @@ FieldsEmbed.js
diff --git a/docs/PaginationEmbed.html b/docs/PaginationEmbed.html
index 58d735a..994485d 100644
--- a/docs/PaginationEmbed.html
+++ b/docs/PaginationEmbed.html
@@ -22,7 +22,7 @@
@@ -299,7 +299,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -350,7 +350,7 @@ authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -951,10 +951,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -977,7 +973,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1029,7 +1025,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1055,12 +1051,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1084,23 +1076,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1126,10 +1102,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1281,10 +1253,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1307,7 +1275,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1416,8 +1384,6 @@ Parameters:
- <optional>
-
@@ -1428,12 +1394,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -1495,10 +1459,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1521,7 +1481,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -1599,12 +1559,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1628,23 +1584,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -1670,10 +1610,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1696,7 +1632,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -1774,12 +1710,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1806,23 +1738,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -1848,10 +1764,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1874,7 +1786,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -1952,12 +1864,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1981,23 +1889,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2023,10 +1915,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2049,7 +1937,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2127,12 +2015,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2156,24 +2040,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2198,10 +2066,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2237,7 +2101,7 @@ Returns:
diff --git a/docs/base_PaginationEmbed.js.html b/docs/base_PaginationEmbed.js.html
index c40af28..e74e322 100644
--- a/docs/base_PaginationEmbed.js.html
+++ b/docs/base_PaginationEmbed.js.html
@@ -22,7 +22,7 @@
@@ -63,7 +63,7 @@ base/PaginationEmbed.js
/**
* Options for the constructor.
* @typedef {Object} PaginationEmbedOptions
- * @property {User} [authorisedUser=null] - The authorised user to navigate the pages.
+ * @property {User} [authorizedUser=null] - The authorized user to navigate the pages.
* @property {TextChannel} channel - The channel where to send the embed.
* @property {ClientMessageOptions} [clientMessage=null] - Settings for the message sent by the client.
* @property {Array.<*>} array - An array of elements to paginate.
@@ -82,10 +82,10 @@ base/PaginationEmbed.js
super(options);
/**
- * The authorised user to navigate the pages.
+ * The authorized user to navigate the pages.
* @type {User}
*/
- this.authorisedUser = options.authorisedUser || null;
+ this.authorizedUser = options.authorizedUser || null;
/**
* The channel where to send the embed.
@@ -149,7 +149,7 @@ base/PaginationEmbed.js
/**
* Sets the array of elements to paginate.
* @param {Array} array - An array of elements to paginate.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -162,12 +162,12 @@ base/PaginationEmbed.js
}
/**
- * Set the authorised person to navigate the pages.
- * @param {User} [user=null] - The user object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * Set the authorized person to navigate the pages.
+ * @param {User} user - The user object.
+ * @returns {PaginationEmbed}
*/
- setAuthorisedUser(user = null) {
- this.authorisedUser = user;
+ setAuthorizedUser(user) {
+ this.authorizedUser = user;
return this;
}
@@ -175,7 +175,7 @@ base/PaginationEmbed.js
/**
* The channel where to send the embed.
* @param {TextChannel} channel - The channel object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setChannel(channel) {
this.channel = channel;
@@ -185,11 +185,11 @@ base/PaginationEmbed.js
/**
* Sets the settings for the message sent by the client.
- * @param {Message} [message=null] - The message object sent by the client, if there is any.
+ * @param {Message} message - The message object sent by the client.
* @param {string} [content='Preparing...'] - The custom message content while preparing the embed.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
- setClientMessage(message = null, content = null) {
+ setClientMessage(message, content = null) {
if (!content) content = 'Preparing...';
Object.assign(this.clientMessage, { message, content });
@@ -199,8 +199,8 @@ base/PaginationEmbed.js
/**
* Sets the emojis used for navigation buttons.
- * @param {NavigationButtons} [emojis={}] - An object containing customised emojis to use as navigation buttons.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {NavigationButtons} emojis - An object containing customised emojis to use as navigation buttons.
+ * @returns {PaginationEmbed}
*/
setEmojis(emojis) {
Object.assign(this.emojis, emojis);
@@ -210,10 +210,10 @@ base/PaginationEmbed.js
/**
* Sets to jump to a certain page upon calling PaginationEmbed.build().
- * @param {number|string} [param=1] - The page number to jump to. As String: 'back', 'forward'
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number|string} param - The page number to jump to. As String: 'back', 'forward'
+ * @returns {PaginationEmbed}
*/
- setPage(param = 1) {
+ setPage(param) {
const isString = typeof param === 'string';
if (!(!isNaN(param) || isString)) throw new Error('setPage() only accepts number/string type.');
@@ -229,10 +229,10 @@ base/PaginationEmbed.js
/**
* Sets the time for awaiting a user action before timeout in ms.
- * @param {number} [timeout=30000] Timeout value in ms.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number} timeout Timeout value in ms.
+ * @returns {PaginationEmbed}
*/
- setTimeout(timeout = 30000) {
+ setTimeout(timeout) {
if (typeof timeout !== 'number') throw new Error('setTimeout() only accepts number type.');
this.timeout = timeout;
@@ -242,10 +242,10 @@ base/PaginationEmbed.js
/**
* Sets whether page number indicator on client's message is shown or not.
- * @param {boolean} [boolean=true] - Show page indicator?
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {boolean} boolean - Show page indicator?
+ * @returns {PaginationEmbed}
*/
- showPageIndicator(boolean = true) {
+ showPageIndicator(boolean) {
if (typeof boolean !== 'boolean') throw new Error('showPageIndicator() only accepts boolean type.');
this.pageIndicator = boolean;
@@ -261,7 +261,7 @@ base/PaginationEmbed.js
async _verify(pages) {
this
.setChannel(this.channel)
- .setAuthorisedUser(this.authorisedUser)
+ .setAuthorizedUser(this.authorizedUser)
.setClientMessage(this.clientMessage.message, this.clientMessage.content)
.setArray(this.array)
.showPageIndicator(this.pageIndicator)
@@ -337,8 +337,8 @@ base/PaginationEmbed.js
async _awaitResponse() {
const emojis = Object.values(this.emojis);
const filter = (r, u) => {
- if (this.authorisedUser)
- return u.id === this.authorisedUser.id && emojis.includes(r.emoji.name);
+ if (this.authorizedUser)
+ return u.id === this.authorizedUser.id && emojis.includes(r.emoji.name);
return !u.bot && emojis.includes(r.emoji.name);
};
@@ -432,7 +432,7 @@ base/PaginationEmbed.js
diff --git a/docs/global.html b/docs/global.html
index 23000ba..3f7e34b 100644
--- a/docs/global.html
+++ b/docs/global.html
@@ -22,7 +22,7 @@
@@ -1487,7 +1487,7 @@ Properties:
- authorisedUser
+ authorizedUser
@@ -1517,7 +1517,7 @@ Properties:
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -1820,7 +1820,7 @@ Type:
diff --git a/docs/index.html b/docs/index.html
index 80eb8c4..c53f893 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -22,7 +22,7 @@
@@ -51,20 +51,21 @@ Home
Classes
const FieldsEmbedMode = require('discord-paginationembed').FieldsEmbed;
+const { FieldsEmbed: FieldsEmbedMode } = require('discord-paginationembed');
new FieldsEmbedMode()
.setArray([ { name: "John Doe" }, { name: "Jane Doe" } ])
- .setAuthorisedUser(message.author)
+ .setAuthorizedUser(message.author)
.setChannel(message.channel)
.setElementsPerPage(1)
.setPage(2)
.showPageIndicator(false)
- .build();
const EmbedsMode = require('discord-paginationembed').Embeds;
+ .build();
const { Embeds: EmbedsMode } = require('discord-paginationembed');
const { MessageEmbed } = require("discord.js");
const embeds = [];
@@ -76,7 +77,7 @@ Under message
event
new EmbedsMode()
.setArray(embeds)
- .setAuthorisedUser(message.author)
+ .setAuthorizedUser(message.author)
.setChannel(message.channel)
.showPageIndicator(true)
.setPage(3)
@@ -99,7 +100,7 @@ Contributing
- Fork this repository.
- Execute
npm install
- Code and code and code and code and... code!
-npm test
to verify your additions/adjustments are following ESLint's rules and verify docs are valid.
+npm test
to verify if your additions/adjustments are following ESLint's rules and to verify if the docs are valid.
- File a Pull Request!
License
MIT
@@ -115,7 +116,7 @@ License
MIT
diff --git a/package.json b/package.json
index f30a2be..44c632d 100644
--- a/package.json
+++ b/package.json
@@ -1,11 +1,11 @@
{
"name": "discord-paginationembed",
- "version": "0.1.0",
+ "version": "0.2.0",
"description": "Pagination Embed for Discord.JS",
"main": "./src/index.js",
"scripts": {
- "test": "eslint --ignore-path .eslintignore . && npm run generate-docs",
- "generate-docs": "jsdoc -c jsdoc.json"
+ "test": "eslint ./src && npm run docs",
+ "docs": "node_modules/.bin/jsdoc -c .jsdoc.json"
},
"repository": {
"type": "git",
@@ -27,7 +27,7 @@
"url": "https://github.com/gazmull/discord-paginationembed/issues"
},
"homepage": "https://github.com/gazmull/discord-paginationembed#readme",
- "dependencies": {
+ "peerDependencies": {
"discord.js": "discordjs/discord.js"
},
"devDependencies": {
diff --git a/src/struct/Embeds.js b/src/struct/Embeds.js
index e8ed7be..ac4fb33 100644
--- a/src/struct/Embeds.js
+++ b/src/struct/Embeds.js
@@ -72,6 +72,7 @@ class Embeds extends PaginationEmbed {
/**
* The thumbnail of all embeds.
+ * @type {string}
*/
this.thumbnail = options.thumbnail || null;
@@ -96,7 +97,7 @@ class Embeds extends PaginationEmbed {
/**
* Embed in the current page.
- * @returns {MessageEmbed} - An instance of MessageEmbed.
+ * @type {MessageEmbed}
*/
get currentEmbed() {
return this.array[this.page - 1];
@@ -105,7 +106,7 @@ class Embeds extends PaginationEmbed {
/**
* Adds a blank field to the fields of all embeds.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addBlankField(inline = false) {
const arr = this.array;
@@ -121,7 +122,7 @@ class Embeds extends PaginationEmbed {
* @param {string} name - The name of the field.
* @param {string} value - The value of the field.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addField(name, value, inline = false) {
if (!name && !value) return this;
@@ -140,12 +141,12 @@ class Embeds extends PaginationEmbed {
* @example
*
* // Object as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -169,12 +170,12 @@ class Embeds extends PaginationEmbed {
* @example
*
* // Methods as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -230,7 +231,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the array of embeds to paginate.
* @param {Array} array - An array of embeds to paginate.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -251,7 +252,7 @@ class Embeds extends PaginationEmbed {
* @param {StringResolvable} name - The name of the author.
* @param {string} [iconURL=null] - The icon URL of the author.
* @param {string} [url=null] - The URL of the author.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setAuthor(name, iconURL = null, url = null) {
if (!name) return this;
@@ -267,7 +268,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the color of all embeds.
* @param {ColorResolvable} color - The color of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setColor(color) {
if (!color) return this;
@@ -283,7 +284,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the description of all embeds.
* @param {string} description - The description of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setDescription(description) {
if (!description) return this;
@@ -300,7 +301,7 @@ class Embeds extends PaginationEmbed {
* Sets the footer of all embeds.
* @param {string} text - The footer text.
* @param {string} [iconURL=null] - URL for the footer's icon.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setFooter(text, iconURL = null) {
if (!text) return this;
@@ -316,7 +317,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the image of all embeds.
* @param {string} image - The image of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setImage(image) {
if (!image) return this;
@@ -332,7 +333,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the thumbnail of all embeds.
* @param {string} thumbnail - The thumbnail of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setThumbnail(thumbnail) {
if (!thumbnail) return this;
@@ -347,7 +348,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the timestamp of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTimestamp() {
const arr = this.array;
@@ -361,7 +362,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the title of all embeds.
* @param {string} title - The title of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTitle(title) {
if (!title) return this;
@@ -377,7 +378,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the URL of all embeds.
* @param {string} url - The URL of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setURL(url) {
if (!url) return this;
diff --git a/src/struct/FieldsEmbed.js b/src/struct/FieldsEmbed.js
index 71b2281..d631b76 100644
--- a/src/struct/FieldsEmbed.js
+++ b/src/struct/FieldsEmbed.js
@@ -42,7 +42,7 @@ class FieldsEmbed extends PaginationEmbed {
/**
* Elements in the current page.
- * @returns {Array.<*>} - An array for a page.
+ * @type {Array.<*>}
*/
get elementList() {
const begin = (this.page - 1) * this.elementsPerPage;
@@ -57,11 +57,11 @@ class FieldsEmbed extends PaginationEmbed {
* @example
*
* // Object as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -87,11 +87,11 @@ class FieldsEmbed extends PaginationEmbed {
* @example
*
* // Methods as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -146,7 +146,7 @@ class FieldsEmbed extends PaginationEmbed {
* @param {string} name - Name of the field.
* @param {Function} value - Value of the field. Function for Array.prototype.map().join('\n').
* @param {boolean} [inline=true] - Whether the field is inline with other field or not.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @returns {PaginationEmbed}
*/
formatField(name, value, inline = true) {
this.fields.push({ name, value, inline });
@@ -156,10 +156,10 @@ class FieldsEmbed extends PaginationEmbed {
/**
* Sets the maximum number of elements to be displayed per page.
- * @param {number} [number=10] - Maximum number of elements to be displayed per page.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @param {number} number - Maximum number of elements to be displayed per page.
+ * @returns {PaginationEmbed}
*/
- setElementsPerPage(number = 10) {
+ setElementsPerPage(number) {
if (typeof number !== 'number') throw new Error('setElementsPerPage() only accepts number type.');
this.elementsPerPage = number;
diff --git a/src/struct/base/PaginationEmbed.js b/src/struct/base/PaginationEmbed.js
index 11a5a9f..9f9ec45 100644
--- a/src/struct/base/PaginationEmbed.js
+++ b/src/struct/base/PaginationEmbed.js
@@ -24,7 +24,7 @@ class PaginationEmbed extends MessageEmbed {
/**
* Options for the constructor.
* @typedef {Object} PaginationEmbedOptions
- * @property {User} [authorisedUser=null] - The authorised user to navigate the pages.
+ * @property {User} [authorizedUser=null] - The authorized user to navigate the pages.
* @property {TextChannel} channel - The channel where to send the embed.
* @property {ClientMessageOptions} [clientMessage=null] - Settings for the message sent by the client.
* @property {Array.<*>} array - An array of elements to paginate.
@@ -43,10 +43,10 @@ class PaginationEmbed extends MessageEmbed {
super(options);
/**
- * The authorised user to navigate the pages.
+ * The authorized user to navigate the pages.
* @type {User}
*/
- this.authorisedUser = options.authorisedUser || null;
+ this.authorizedUser = options.authorizedUser || null;
/**
* The channel where to send the embed.
@@ -110,7 +110,7 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the array of elements to paginate.
* @param {Array} array - An array of elements to paginate.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -123,12 +123,12 @@ class PaginationEmbed extends MessageEmbed {
}
/**
- * Set the authorised person to navigate the pages.
- * @param {User} [user=null] - The user object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * Set the authorized person to navigate the pages.
+ * @param {User} user - The user object.
+ * @returns {PaginationEmbed}
*/
- setAuthorisedUser(user = null) {
- this.authorisedUser = user;
+ setAuthorizedUser(user) {
+ this.authorizedUser = user;
return this;
}
@@ -136,7 +136,7 @@ class PaginationEmbed extends MessageEmbed {
/**
* The channel where to send the embed.
* @param {TextChannel} channel - The channel object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setChannel(channel) {
this.channel = channel;
@@ -146,11 +146,11 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the settings for the message sent by the client.
- * @param {Message} [message=null] - The message object sent by the client, if there is any.
+ * @param {Message} message - The message object sent by the client.
* @param {string} [content='Preparing...'] - The custom message content while preparing the embed.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
- setClientMessage(message = null, content = null) {
+ setClientMessage(message, content = null) {
if (!content) content = 'Preparing...';
Object.assign(this.clientMessage, { message, content });
@@ -160,8 +160,8 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the emojis used for navigation buttons.
- * @param {NavigationButtons} [emojis={}] - An object containing customised emojis to use as navigation buttons.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {NavigationButtons} emojis - An object containing customised emojis to use as navigation buttons.
+ * @returns {PaginationEmbed}
*/
setEmojis(emojis) {
Object.assign(this.emojis, emojis);
@@ -171,10 +171,10 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets to jump to a certain page upon calling PaginationEmbed.build().
- * @param {number|string} [param=1] - The page number to jump to. As String: 'back', 'forward'
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number|string} param - The page number to jump to. As String: 'back', 'forward'
+ * @returns {PaginationEmbed}
*/
- setPage(param = 1) {
+ setPage(param) {
const isString = typeof param === 'string';
if (!(!isNaN(param) || isString)) throw new Error('setPage() only accepts number/string type.');
@@ -190,10 +190,10 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the time for awaiting a user action before timeout in ms.
- * @param {number} [timeout=30000] Timeout value in ms.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number} timeout Timeout value in ms.
+ * @returns {PaginationEmbed}
*/
- setTimeout(timeout = 30000) {
+ setTimeout(timeout) {
if (typeof timeout !== 'number') throw new Error('setTimeout() only accepts number type.');
this.timeout = timeout;
@@ -203,10 +203,10 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets whether page number indicator on client's message is shown or not.
- * @param {boolean} [boolean=true] - Show page indicator?
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {boolean} boolean - Show page indicator?
+ * @returns {PaginationEmbed}
*/
- showPageIndicator(boolean = true) {
+ showPageIndicator(boolean) {
if (typeof boolean !== 'boolean') throw new Error('showPageIndicator() only accepts boolean type.');
this.pageIndicator = boolean;
@@ -222,7 +222,7 @@ class PaginationEmbed extends MessageEmbed {
async _verify(pages) {
this
.setChannel(this.channel)
- .setAuthorisedUser(this.authorisedUser)
+ .setAuthorizedUser(this.authorizedUser)
.setClientMessage(this.clientMessage.message, this.clientMessage.content)
.setArray(this.array)
.showPageIndicator(this.pageIndicator)
@@ -298,8 +298,8 @@ class PaginationEmbed extends MessageEmbed {
async _awaitResponse() {
const emojis = Object.values(this.emojis);
const filter = (r, u) => {
- if (this.authorisedUser)
- return u.id === this.authorisedUser.id && emojis.includes(r.emoji.name);
+ if (this.authorizedUser)
+ return u.id === this.authorizedUser.id && emojis.includes(r.emoji.name);
return !u.bot && emojis.includes(r.emoji.name);
};
Returns:
Returns:
-setAuthor(name, iconURLopt, urlopt) → {Embeds}
+setAuthor(name, iconURLopt, urlopt) → {PaginationEmbed}
@@ -2328,7 +2336,7 @@setAuthorSource:
@@ -2539,10 +2547,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -2551,7 +2555,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -2565,7 +2569,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -2588,7 +2592,7 @@ setA
- Inherited From:
@@ -2622,7 +2626,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -2648,12 +2652,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2677,23 +2677,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -2719,10 +2703,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2879,10 +2859,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2905,7 +2881,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -3019,8 +2995,6 @@ Parameters:
- <optional>
-
@@ -3031,12 +3005,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -3098,10 +3070,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -3124,7 +3092,7 @@ Returns:
- setColor(color) → {Embeds}
+ setColor(color) → {PaginationEmbed}
@@ -3136,7 +3104,7 @@ setColorSource:
@@ -3253,10 +3221,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3265,7 +3229,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3279,7 +3243,7 @@ Returns:
- setDescription(description) → {Embeds}
+ setDescription(description) → {PaginationEmbed}
@@ -3291,7 +3255,7 @@ setDesc
- Source:
@@ -3408,10 +3372,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3420,7 +3380,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3434,7 +3394,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -3517,12 +3477,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -3546,23 +3502,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -3588,10 +3528,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -3614,7 +3550,7 @@ Returns:
- setFooter(text, iconURLopt) → {Embeds}
+ setFooter(text, iconURLopt) → {PaginationEmbed}
@@ -3626,7 +3562,7 @@ setFooterSource:
@@ -3798,10 +3734,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3810,7 +3742,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3824,7 +3756,7 @@ Returns:
- setImage(image) → {Embeds}
+ setImage(image) → {PaginationEmbed}
@@ -3836,7 +3768,7 @@ setImageSource:
@@ -3953,10 +3885,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3965,7 +3893,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -3979,7 +3907,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -4062,12 +3990,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -4094,23 +4018,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -4136,10 +4044,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -4162,7 +4066,7 @@ Returns:
- setThumbnail(thumbnail) → {Embeds}
+ setThumbnail(thumbnail) → {PaginationEmbed}
@@ -4174,7 +4078,7 @@ setThumbn
- Source:
@@ -4291,10 +4195,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4303,7 +4203,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4317,7 +4217,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -4400,12 +4300,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -4429,23 +4325,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -4471,10 +4351,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -4497,7 +4373,7 @@ Returns:
- setTimestamp() → {Embeds}
+ setTimestamp() → {PaginationEmbed}
@@ -4509,7 +4385,7 @@ setTimest
- Source:
@@ -4577,10 +4453,6 @@ setTimest
Returns:
-
- - Instance of Embeds
-
-
@@ -4589,7 +4461,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4603,7 +4475,7 @@ Returns:
- setTitle(title) → {Embeds}
+ setTitle(title) → {PaginationEmbed}
@@ -4615,7 +4487,7 @@ setTitleSource:
@@ -4732,10 +4604,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4744,7 +4612,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4758,7 +4626,7 @@ Returns:
- setURL(url) → {Embeds}
+ setURL(url) → {PaginationEmbed}
@@ -4770,7 +4638,7 @@ setURLSource:
@@ -4887,10 +4755,6 @@ Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4899,7 +4763,7 @@ Returns:
-
-Embeds
+PaginationEmbed
@@ -4913,7 +4777,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -4996,12 +4860,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -5025,23 +4885,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- true
-
-
Show page indicator?
@@ -5067,10 +4911,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -5106,7 +4946,7 @@ Returns:
diff --git a/docs/Embeds.js.html b/docs/Embeds.js.html
index 637f285..ba6e1c4 100644
--- a/docs/Embeds.js.html
+++ b/docs/Embeds.js.html
@@ -22,7 +22,7 @@
@@ -111,6 +111,7 @@ Embeds.js
/**
* The thumbnail of all embeds.
+ * @type {string}
*/
this.thumbnail = options.thumbnail || null;
@@ -135,7 +136,7 @@ Embeds.js
/**
* Embed in the current page.
- * @returns {MessageEmbed} - An instance of MessageEmbed.
+ * @type {MessageEmbed}
*/
get currentEmbed() {
return this.array[this.page - 1];
@@ -144,7 +145,7 @@ Embeds.js
/**
* Adds a blank field to the fields of all embeds.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addBlankField(inline = false) {
const arr = this.array;
@@ -160,7 +161,7 @@ Embeds.js
* @param {string} name - The name of the field.
* @param {string} value - The value of the field.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addField(name, value, inline = false) {
if (!name && !value) return this;
@@ -179,12 +180,12 @@ Embeds.js
* @example
*
* // Object as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -208,12 +209,12 @@ Embeds.js
* @example
*
* // Methods as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -269,7 +270,7 @@ Embeds.js
/**
* Sets the array of embeds to paginate.
* @param {Array} array - An array of embeds to paginate.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -290,7 +291,7 @@ Embeds.js
* @param {StringResolvable} name - The name of the author.
* @param {string} [iconURL=null] - The icon URL of the author.
* @param {string} [url=null] - The URL of the author.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setAuthor(name, iconURL = null, url = null) {
if (!name) return this;
@@ -306,7 +307,7 @@ Embeds.js
/**
* Sets the color of all embeds.
* @param {ColorResolvable} color - The color of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setColor(color) {
if (!color) return this;
@@ -322,7 +323,7 @@ Embeds.js
/**
* Sets the description of all embeds.
* @param {string} description - The description of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setDescription(description) {
if (!description) return this;
@@ -339,7 +340,7 @@ Embeds.js
* Sets the footer of all embeds.
* @param {string} text - The footer text.
* @param {string} [iconURL=null] - URL for the footer's icon.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setFooter(text, iconURL = null) {
if (!text) return this;
@@ -355,7 +356,7 @@ Embeds.js
/**
* Sets the image of all embeds.
* @param {string} image - The image of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setImage(image) {
if (!image) return this;
@@ -371,7 +372,7 @@ Embeds.js
/**
* Sets the thumbnail of all embeds.
* @param {string} thumbnail - The thumbnail of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setThumbnail(thumbnail) {
if (!thumbnail) return this;
@@ -386,7 +387,7 @@ Embeds.js
/**
* Sets the timestamp of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTimestamp() {
const arr = this.array;
@@ -400,7 +401,7 @@ Embeds.js
/**
* Sets the title of all embeds.
* @param {string} title - The title of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTitle(title) {
if (!title) return this;
@@ -416,7 +417,7 @@ Embeds.js
/**
* Sets the URL of all embeds.
* @param {string} url - The URL of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setURL(url) {
if (!url) return this;
@@ -455,7 +456,7 @@ Embeds.js
diff --git a/docs/FieldsEmbed.html b/docs/FieldsEmbed.html
index 948c77a..e3a7000 100644
--- a/docs/FieldsEmbed.html
+++ b/docs/FieldsEmbed.html
@@ -22,7 +22,7 @@
@@ -304,7 +304,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -326,7 +326,7 @@ authori
- Inherited From:
@@ -360,7 +360,7 @@ authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -538,7 +538,7 @@ Type:
-elementList
+elementList :Array.<*>
@@ -594,6 +594,16 @@ elementLis
+ Type:
+
+ -
+
+Array.<*>
+
+
+
+
+
@@ -1063,9 +1073,9 @@ (async) buildExamples
- // Object as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed({
authorisedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
+ // Object as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed({
authorizedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
- // Methods as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed()
.setAuthorisedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
+ // Methods as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed()
.setAuthorizedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
@@ -1089,7 +1099,7 @@ Examples
- formatField(name, value, inlineopt) → {FieldsEmbed}
+ formatField(name, value, inlineopt) → {PaginationEmbed}
@@ -1308,10 +1318,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -1320,7 +1326,7 @@ Returns:
-
-FieldsEmbed
+PaginationEmbed
@@ -1468,10 +1474,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1494,7 +1496,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1517,7 +1519,7 @@ setA
- Inherited From:
@@ -1551,7 +1553,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1577,12 +1579,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1606,23 +1604,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1648,10 +1630,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1808,10 +1786,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1834,7 +1808,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1948,8 +1922,6 @@ Parameters:
- <optional>
-
@@ -1960,12 +1932,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -2027,10 +1997,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2053,7 +2019,7 @@ Returns:
- setElementsPerPage(numberopt) → {FieldsEmbed}
+ setElementsPerPage(number) → {PaginationEmbed}
@@ -2131,12 +2097,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2160,24 +2122,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 10
-
-
-
Maximum number of elements to be displayed per page.
@@ -2202,10 +2148,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -2214,7 +2156,7 @@ Returns:
-
-FieldsEmbed
+PaginationEmbed
@@ -2228,7 +2170,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -2311,12 +2253,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2340,23 +2278,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -2382,10 +2304,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2408,7 +2326,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -2491,12 +2409,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2523,24 +2437,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 1
-
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -2565,10 +2463,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2591,7 +2485,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -2674,12 +2568,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2703,23 +2593,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2745,10 +2619,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2771,7 +2641,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2854,12 +2724,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2883,24 +2749,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2925,10 +2775,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2964,7 +2810,7 @@ Returns:
diff --git a/docs/FieldsEmbed.js.html b/docs/FieldsEmbed.js.html
index 5d36097..9bad270 100644
--- a/docs/FieldsEmbed.js.html
+++ b/docs/FieldsEmbed.js.html
@@ -22,7 +22,7 @@
@@ -81,7 +81,7 @@ FieldsEmbed.js
/**
* Elements in the current page.
- * @returns {Array.<*>} - An array for a page.
+ * @type {Array.<*>}
*/
get elementList() {
const begin = (this.page - 1) * this.elementsPerPage;
@@ -96,11 +96,11 @@ FieldsEmbed.js
* @example
*
* // Object as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -126,11 +126,11 @@ FieldsEmbed.js
* @example
*
* // Methods as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -185,7 +185,7 @@ FieldsEmbed.js
* @param {string} name - Name of the field.
* @param {Function} value - Value of the field. Function for Array.prototype.map().join('\n').
* @param {boolean} [inline=true] - Whether the field is inline with other field or not.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @returns {PaginationEmbed}
*/
formatField(name, value, inline = true) {
this.fields.push({ name, value, inline });
@@ -195,10 +195,10 @@ FieldsEmbed.js
/**
* Sets the maximum number of elements to be displayed per page.
- * @param {number} [number=10] - Maximum number of elements to be displayed per page.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @param {number} number - Maximum number of elements to be displayed per page.
+ * @returns {PaginationEmbed}
*/
- setElementsPerPage(number = 10) {
+ setElementsPerPage(number) {
if (typeof number !== 'number') throw new Error('setElementsPerPage() only accepts number type.');
this.elementsPerPage = number;
@@ -266,7 +266,7 @@ FieldsEmbed.js
diff --git a/docs/PaginationEmbed.html b/docs/PaginationEmbed.html
index 58d735a..994485d 100644
--- a/docs/PaginationEmbed.html
+++ b/docs/PaginationEmbed.html
@@ -22,7 +22,7 @@
@@ -299,7 +299,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -350,7 +350,7 @@ authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -951,10 +951,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -977,7 +973,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1029,7 +1025,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1055,12 +1051,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1084,23 +1076,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1126,10 +1102,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1281,10 +1253,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1307,7 +1275,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1416,8 +1384,6 @@ Parameters:
- <optional>
-
@@ -1428,12 +1394,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -1495,10 +1459,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1521,7 +1481,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -1599,12 +1559,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1628,23 +1584,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -1670,10 +1610,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1696,7 +1632,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -1774,12 +1710,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1806,23 +1738,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -1848,10 +1764,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1874,7 +1786,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -1952,12 +1864,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1981,23 +1889,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2023,10 +1915,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2049,7 +1937,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2127,12 +2015,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2156,24 +2040,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2198,10 +2066,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2237,7 +2101,7 @@ Returns:
diff --git a/docs/base_PaginationEmbed.js.html b/docs/base_PaginationEmbed.js.html
index c40af28..e74e322 100644
--- a/docs/base_PaginationEmbed.js.html
+++ b/docs/base_PaginationEmbed.js.html
@@ -22,7 +22,7 @@
@@ -63,7 +63,7 @@ base/PaginationEmbed.js
/**
* Options for the constructor.
* @typedef {Object} PaginationEmbedOptions
- * @property {User} [authorisedUser=null] - The authorised user to navigate the pages.
+ * @property {User} [authorizedUser=null] - The authorized user to navigate the pages.
* @property {TextChannel} channel - The channel where to send the embed.
* @property {ClientMessageOptions} [clientMessage=null] - Settings for the message sent by the client.
* @property {Array.<*>} array - An array of elements to paginate.
@@ -82,10 +82,10 @@ base/PaginationEmbed.js
super(options);
/**
- * The authorised user to navigate the pages.
+ * The authorized user to navigate the pages.
* @type {User}
*/
- this.authorisedUser = options.authorisedUser || null;
+ this.authorizedUser = options.authorizedUser || null;
/**
* The channel where to send the embed.
@@ -149,7 +149,7 @@ base/PaginationEmbed.js
/**
* Sets the array of elements to paginate.
* @param {Array} array - An array of elements to paginate.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -162,12 +162,12 @@ base/PaginationEmbed.js
}
/**
- * Set the authorised person to navigate the pages.
- * @param {User} [user=null] - The user object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * Set the authorized person to navigate the pages.
+ * @param {User} user - The user object.
+ * @returns {PaginationEmbed}
*/
- setAuthorisedUser(user = null) {
- this.authorisedUser = user;
+ setAuthorizedUser(user) {
+ this.authorizedUser = user;
return this;
}
@@ -175,7 +175,7 @@ base/PaginationEmbed.js
/**
* The channel where to send the embed.
* @param {TextChannel} channel - The channel object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setChannel(channel) {
this.channel = channel;
@@ -185,11 +185,11 @@ base/PaginationEmbed.js
/**
* Sets the settings for the message sent by the client.
- * @param {Message} [message=null] - The message object sent by the client, if there is any.
+ * @param {Message} message - The message object sent by the client.
* @param {string} [content='Preparing...'] - The custom message content while preparing the embed.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
- setClientMessage(message = null, content = null) {
+ setClientMessage(message, content = null) {
if (!content) content = 'Preparing...';
Object.assign(this.clientMessage, { message, content });
@@ -199,8 +199,8 @@ base/PaginationEmbed.js
/**
* Sets the emojis used for navigation buttons.
- * @param {NavigationButtons} [emojis={}] - An object containing customised emojis to use as navigation buttons.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {NavigationButtons} emojis - An object containing customised emojis to use as navigation buttons.
+ * @returns {PaginationEmbed}
*/
setEmojis(emojis) {
Object.assign(this.emojis, emojis);
@@ -210,10 +210,10 @@ base/PaginationEmbed.js
/**
* Sets to jump to a certain page upon calling PaginationEmbed.build().
- * @param {number|string} [param=1] - The page number to jump to. As String: 'back', 'forward'
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number|string} param - The page number to jump to. As String: 'back', 'forward'
+ * @returns {PaginationEmbed}
*/
- setPage(param = 1) {
+ setPage(param) {
const isString = typeof param === 'string';
if (!(!isNaN(param) || isString)) throw new Error('setPage() only accepts number/string type.');
@@ -229,10 +229,10 @@ base/PaginationEmbed.js
/**
* Sets the time for awaiting a user action before timeout in ms.
- * @param {number} [timeout=30000] Timeout value in ms.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number} timeout Timeout value in ms.
+ * @returns {PaginationEmbed}
*/
- setTimeout(timeout = 30000) {
+ setTimeout(timeout) {
if (typeof timeout !== 'number') throw new Error('setTimeout() only accepts number type.');
this.timeout = timeout;
@@ -242,10 +242,10 @@ base/PaginationEmbed.js
/**
* Sets whether page number indicator on client's message is shown or not.
- * @param {boolean} [boolean=true] - Show page indicator?
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {boolean} boolean - Show page indicator?
+ * @returns {PaginationEmbed}
*/
- showPageIndicator(boolean = true) {
+ showPageIndicator(boolean) {
if (typeof boolean !== 'boolean') throw new Error('showPageIndicator() only accepts boolean type.');
this.pageIndicator = boolean;
@@ -261,7 +261,7 @@ base/PaginationEmbed.js
async _verify(pages) {
this
.setChannel(this.channel)
- .setAuthorisedUser(this.authorisedUser)
+ .setAuthorizedUser(this.authorizedUser)
.setClientMessage(this.clientMessage.message, this.clientMessage.content)
.setArray(this.array)
.showPageIndicator(this.pageIndicator)
@@ -337,8 +337,8 @@ base/PaginationEmbed.js
async _awaitResponse() {
const emojis = Object.values(this.emojis);
const filter = (r, u) => {
- if (this.authorisedUser)
- return u.id === this.authorisedUser.id && emojis.includes(r.emoji.name);
+ if (this.authorizedUser)
+ return u.id === this.authorizedUser.id && emojis.includes(r.emoji.name);
return !u.bot && emojis.includes(r.emoji.name);
};
@@ -432,7 +432,7 @@ base/PaginationEmbed.js
diff --git a/docs/global.html b/docs/global.html
index 23000ba..3f7e34b 100644
--- a/docs/global.html
+++ b/docs/global.html
@@ -22,7 +22,7 @@
@@ -1487,7 +1487,7 @@ Properties:
- authorisedUser
+ authorizedUser
@@ -1517,7 +1517,7 @@ Properties:
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -1820,7 +1820,7 @@ Type:
diff --git a/docs/index.html b/docs/index.html
index 80eb8c4..c53f893 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -22,7 +22,7 @@
@@ -51,20 +51,21 @@ Home
Classes
const FieldsEmbedMode = require('discord-paginationembed').FieldsEmbed;
+const { FieldsEmbed: FieldsEmbedMode } = require('discord-paginationembed');
new FieldsEmbedMode()
.setArray([ { name: "John Doe" }, { name: "Jane Doe" } ])
- .setAuthorisedUser(message.author)
+ .setAuthorizedUser(message.author)
.setChannel(message.channel)
.setElementsPerPage(1)
.setPage(2)
.showPageIndicator(false)
- .build();
const EmbedsMode = require('discord-paginationembed').Embeds;
+ .build();
const { Embeds: EmbedsMode } = require('discord-paginationembed');
const { MessageEmbed } = require("discord.js");
const embeds = [];
@@ -76,7 +77,7 @@ Under message
event
new EmbedsMode()
.setArray(embeds)
- .setAuthorisedUser(message.author)
+ .setAuthorizedUser(message.author)
.setChannel(message.channel)
.showPageIndicator(true)
.setPage(3)
@@ -99,7 +100,7 @@ Contributing
- Fork this repository.
- Execute
npm install
- Code and code and code and code and... code!
-npm test
to verify your additions/adjustments are following ESLint's rules and verify docs are valid.
+npm test
to verify if your additions/adjustments are following ESLint's rules and to verify if the docs are valid.
- File a Pull Request!
License
MIT
@@ -115,7 +116,7 @@ License
MIT
diff --git a/package.json b/package.json
index f30a2be..44c632d 100644
--- a/package.json
+++ b/package.json
@@ -1,11 +1,11 @@
{
"name": "discord-paginationembed",
- "version": "0.1.0",
+ "version": "0.2.0",
"description": "Pagination Embed for Discord.JS",
"main": "./src/index.js",
"scripts": {
- "test": "eslint --ignore-path .eslintignore . && npm run generate-docs",
- "generate-docs": "jsdoc -c jsdoc.json"
+ "test": "eslint ./src && npm run docs",
+ "docs": "node_modules/.bin/jsdoc -c .jsdoc.json"
},
"repository": {
"type": "git",
@@ -27,7 +27,7 @@
"url": "https://github.com/gazmull/discord-paginationembed/issues"
},
"homepage": "https://github.com/gazmull/discord-paginationembed#readme",
- "dependencies": {
+ "peerDependencies": {
"discord.js": "discordjs/discord.js"
},
"devDependencies": {
diff --git a/src/struct/Embeds.js b/src/struct/Embeds.js
index e8ed7be..ac4fb33 100644
--- a/src/struct/Embeds.js
+++ b/src/struct/Embeds.js
@@ -72,6 +72,7 @@ class Embeds extends PaginationEmbed {
/**
* The thumbnail of all embeds.
+ * @type {string}
*/
this.thumbnail = options.thumbnail || null;
@@ -96,7 +97,7 @@ class Embeds extends PaginationEmbed {
/**
* Embed in the current page.
- * @returns {MessageEmbed} - An instance of MessageEmbed.
+ * @type {MessageEmbed}
*/
get currentEmbed() {
return this.array[this.page - 1];
@@ -105,7 +106,7 @@ class Embeds extends PaginationEmbed {
/**
* Adds a blank field to the fields of all embeds.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addBlankField(inline = false) {
const arr = this.array;
@@ -121,7 +122,7 @@ class Embeds extends PaginationEmbed {
* @param {string} name - The name of the field.
* @param {string} value - The value of the field.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addField(name, value, inline = false) {
if (!name && !value) return this;
@@ -140,12 +141,12 @@ class Embeds extends PaginationEmbed {
* @example
*
* // Object as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -169,12 +170,12 @@ class Embeds extends PaginationEmbed {
* @example
*
* // Methods as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -230,7 +231,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the array of embeds to paginate.
* @param {Array} array - An array of embeds to paginate.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -251,7 +252,7 @@ class Embeds extends PaginationEmbed {
* @param {StringResolvable} name - The name of the author.
* @param {string} [iconURL=null] - The icon URL of the author.
* @param {string} [url=null] - The URL of the author.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setAuthor(name, iconURL = null, url = null) {
if (!name) return this;
@@ -267,7 +268,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the color of all embeds.
* @param {ColorResolvable} color - The color of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setColor(color) {
if (!color) return this;
@@ -283,7 +284,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the description of all embeds.
* @param {string} description - The description of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setDescription(description) {
if (!description) return this;
@@ -300,7 +301,7 @@ class Embeds extends PaginationEmbed {
* Sets the footer of all embeds.
* @param {string} text - The footer text.
* @param {string} [iconURL=null] - URL for the footer's icon.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setFooter(text, iconURL = null) {
if (!text) return this;
@@ -316,7 +317,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the image of all embeds.
* @param {string} image - The image of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setImage(image) {
if (!image) return this;
@@ -332,7 +333,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the thumbnail of all embeds.
* @param {string} thumbnail - The thumbnail of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setThumbnail(thumbnail) {
if (!thumbnail) return this;
@@ -347,7 +348,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the timestamp of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTimestamp() {
const arr = this.array;
@@ -361,7 +362,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the title of all embeds.
* @param {string} title - The title of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTitle(title) {
if (!title) return this;
@@ -377,7 +378,7 @@ class Embeds extends PaginationEmbed {
/**
* Sets the URL of all embeds.
* @param {string} url - The URL of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setURL(url) {
if (!url) return this;
diff --git a/src/struct/FieldsEmbed.js b/src/struct/FieldsEmbed.js
index 71b2281..d631b76 100644
--- a/src/struct/FieldsEmbed.js
+++ b/src/struct/FieldsEmbed.js
@@ -42,7 +42,7 @@ class FieldsEmbed extends PaginationEmbed {
/**
* Elements in the current page.
- * @returns {Array.<*>} - An array for a page.
+ * @type {Array.<*>}
*/
get elementList() {
const begin = (this.page - 1) * this.elementsPerPage;
@@ -57,11 +57,11 @@ class FieldsEmbed extends PaginationEmbed {
* @example
*
* // Object as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -87,11 +87,11 @@ class FieldsEmbed extends PaginationEmbed {
* @example
*
* // Methods as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -146,7 +146,7 @@ class FieldsEmbed extends PaginationEmbed {
* @param {string} name - Name of the field.
* @param {Function} value - Value of the field. Function for Array.prototype.map().join('\n').
* @param {boolean} [inline=true] - Whether the field is inline with other field or not.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @returns {PaginationEmbed}
*/
formatField(name, value, inline = true) {
this.fields.push({ name, value, inline });
@@ -156,10 +156,10 @@ class FieldsEmbed extends PaginationEmbed {
/**
* Sets the maximum number of elements to be displayed per page.
- * @param {number} [number=10] - Maximum number of elements to be displayed per page.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @param {number} number - Maximum number of elements to be displayed per page.
+ * @returns {PaginationEmbed}
*/
- setElementsPerPage(number = 10) {
+ setElementsPerPage(number) {
if (typeof number !== 'number') throw new Error('setElementsPerPage() only accepts number type.');
this.elementsPerPage = number;
diff --git a/src/struct/base/PaginationEmbed.js b/src/struct/base/PaginationEmbed.js
index 11a5a9f..9f9ec45 100644
--- a/src/struct/base/PaginationEmbed.js
+++ b/src/struct/base/PaginationEmbed.js
@@ -24,7 +24,7 @@ class PaginationEmbed extends MessageEmbed {
/**
* Options for the constructor.
* @typedef {Object} PaginationEmbedOptions
- * @property {User} [authorisedUser=null] - The authorised user to navigate the pages.
+ * @property {User} [authorizedUser=null] - The authorized user to navigate the pages.
* @property {TextChannel} channel - The channel where to send the embed.
* @property {ClientMessageOptions} [clientMessage=null] - Settings for the message sent by the client.
* @property {Array.<*>} array - An array of elements to paginate.
@@ -43,10 +43,10 @@ class PaginationEmbed extends MessageEmbed {
super(options);
/**
- * The authorised user to navigate the pages.
+ * The authorized user to navigate the pages.
* @type {User}
*/
- this.authorisedUser = options.authorisedUser || null;
+ this.authorizedUser = options.authorizedUser || null;
/**
* The channel where to send the embed.
@@ -110,7 +110,7 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the array of elements to paginate.
* @param {Array} array - An array of elements to paginate.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -123,12 +123,12 @@ class PaginationEmbed extends MessageEmbed {
}
/**
- * Set the authorised person to navigate the pages.
- * @param {User} [user=null] - The user object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * Set the authorized person to navigate the pages.
+ * @param {User} user - The user object.
+ * @returns {PaginationEmbed}
*/
- setAuthorisedUser(user = null) {
- this.authorisedUser = user;
+ setAuthorizedUser(user) {
+ this.authorizedUser = user;
return this;
}
@@ -136,7 +136,7 @@ class PaginationEmbed extends MessageEmbed {
/**
* The channel where to send the embed.
* @param {TextChannel} channel - The channel object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setChannel(channel) {
this.channel = channel;
@@ -146,11 +146,11 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the settings for the message sent by the client.
- * @param {Message} [message=null] - The message object sent by the client, if there is any.
+ * @param {Message} message - The message object sent by the client.
* @param {string} [content='Preparing...'] - The custom message content while preparing the embed.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
- setClientMessage(message = null, content = null) {
+ setClientMessage(message, content = null) {
if (!content) content = 'Preparing...';
Object.assign(this.clientMessage, { message, content });
@@ -160,8 +160,8 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the emojis used for navigation buttons.
- * @param {NavigationButtons} [emojis={}] - An object containing customised emojis to use as navigation buttons.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {NavigationButtons} emojis - An object containing customised emojis to use as navigation buttons.
+ * @returns {PaginationEmbed}
*/
setEmojis(emojis) {
Object.assign(this.emojis, emojis);
@@ -171,10 +171,10 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets to jump to a certain page upon calling PaginationEmbed.build().
- * @param {number|string} [param=1] - The page number to jump to. As String: 'back', 'forward'
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number|string} param - The page number to jump to. As String: 'back', 'forward'
+ * @returns {PaginationEmbed}
*/
- setPage(param = 1) {
+ setPage(param) {
const isString = typeof param === 'string';
if (!(!isNaN(param) || isString)) throw new Error('setPage() only accepts number/string type.');
@@ -190,10 +190,10 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets the time for awaiting a user action before timeout in ms.
- * @param {number} [timeout=30000] Timeout value in ms.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number} timeout Timeout value in ms.
+ * @returns {PaginationEmbed}
*/
- setTimeout(timeout = 30000) {
+ setTimeout(timeout) {
if (typeof timeout !== 'number') throw new Error('setTimeout() only accepts number type.');
this.timeout = timeout;
@@ -203,10 +203,10 @@ class PaginationEmbed extends MessageEmbed {
/**
* Sets whether page number indicator on client's message is shown or not.
- * @param {boolean} [boolean=true] - Show page indicator?
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {boolean} boolean - Show page indicator?
+ * @returns {PaginationEmbed}
*/
- showPageIndicator(boolean = true) {
+ showPageIndicator(boolean) {
if (typeof boolean !== 'boolean') throw new Error('showPageIndicator() only accepts boolean type.');
this.pageIndicator = boolean;
@@ -222,7 +222,7 @@ class PaginationEmbed extends MessageEmbed {
async _verify(pages) {
this
.setChannel(this.channel)
- .setAuthorisedUser(this.authorisedUser)
+ .setAuthorizedUser(this.authorizedUser)
.setClientMessage(this.clientMessage.message, this.clientMessage.content)
.setArray(this.array)
.showPageIndicator(this.pageIndicator)
@@ -298,8 +298,8 @@ class PaginationEmbed extends MessageEmbed {
async _awaitResponse() {
const emojis = Object.values(this.emojis);
const filter = (r, u) => {
- if (this.authorisedUser)
- return u.id === this.authorisedUser.id && emojis.includes(r.emoji.name);
+ if (this.authorizedUser)
+ return u.id === this.authorizedUser.id && emojis.includes(r.emoji.name);
return !u.bot && emojis.includes(r.emoji.name);
};
Parameters:
Returns:
--
@@ -2551,7 +2555,7 @@
- -Embeds +PaginationEmbed @@ -2565,7 +2569,7 @@
- Inherited From:
- @@ -2622,7 +2626,7 @@
- @@ -3253,10 +3221,6 @@
- -Embeds +PaginationEmbed @@ -3279,7 +3243,7 @@
- Source:
- @@ -3408,10 +3372,6 @@
- -Embeds +PaginationEmbed @@ -3434,7 +3394,7 @@
- @@ -3798,10 +3734,6 @@
- -Embeds +PaginationEmbed @@ -3824,7 +3756,7 @@
- @@ -3953,10 +3885,6 @@
- -Embeds +PaginationEmbed @@ -3979,7 +3907,7 @@
- Source:
- @@ -4291,10 +4195,6 @@
- -Embeds +PaginationEmbed @@ -4317,7 +4217,7 @@
- Source:
- @@ -4577,10 +4453,6 @@
- -Embeds +PaginationEmbed @@ -4603,7 +4475,7 @@
- @@ -4732,10 +4604,6 @@
- -Embeds +PaginationEmbed @@ -4758,7 +4626,7 @@
- @@ -4887,10 +4755,6 @@
- -Embeds +PaginationEmbed @@ -4913,7 +4777,7 @@
- Inherited From:
- @@ -360,7 +360,7 @@
- + +Array.<*> + + + +
- -FieldsEmbed +PaginationEmbed @@ -1468,10 +1474,6 @@
- Inherited From:
- @@ -1551,7 +1553,7 @@
- -FieldsEmbed +PaginationEmbed @@ -2228,7 +2170,7 @@
const FieldsEmbedMode = require('discord-paginationembed').FieldsEmbed; +
const { FieldsEmbed: FieldsEmbedMode } = require('discord-paginationembed'); new FieldsEmbedMode() .setArray([ { name: "John Doe" }, { name: "Jane Doe" } ]) - .setAuthorisedUser(message.author) + .setAuthorizedUser(message.author) .setChannel(message.channel) .setElementsPerPage(1) .setPage(2) .showPageIndicator(false) - .build();
const EmbedsMode = require('discord-paginationembed').Embeds; + .build();
const { Embeds: EmbedsMode } = require('discord-paginationembed'); const { MessageEmbed } = require("discord.js"); const embeds = []; @@ -76,7 +77,7 @@
Under
new EmbedsMode() .setArray(embeds) - .setAuthorisedUser(message.author) + .setAuthorizedUser(message.author) .setChannel(message.channel) .showPageIndicator(true) .setPage(3) @@ -99,7 +100,7 @@message
eventContributing
- Fork this repository.
- Execute
npm install
- Code and code and code and code and... code! -
npm test
to verify your additions/adjustments are following ESLint's rules and verify docs are valid.
+npm test
to verify if your additions/adjustments are following ESLint's rules and to verify if the docs are valid.- File a Pull Request!
License
MIT
@@ -115,7 +116,7 @@License
MIT
diff --git a/package.json b/package.json index f30a2be..44c632d 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,11 @@ { "name": "discord-paginationembed", - "version": "0.1.0", + "version": "0.2.0", "description": "Pagination Embed for Discord.JS", "main": "./src/index.js", "scripts": { - "test": "eslint --ignore-path .eslintignore . && npm run generate-docs", - "generate-docs": "jsdoc -c jsdoc.json" + "test": "eslint ./src && npm run docs", + "docs": "node_modules/.bin/jsdoc -c .jsdoc.json" }, "repository": { "type": "git", @@ -27,7 +27,7 @@ "url": "https://github.com/gazmull/discord-paginationembed/issues" }, "homepage": "https://github.com/gazmull/discord-paginationembed#readme", - "dependencies": { + "peerDependencies": { "discord.js": "discordjs/discord.js" }, "devDependencies": { diff --git a/src/struct/Embeds.js b/src/struct/Embeds.js index e8ed7be..ac4fb33 100644 --- a/src/struct/Embeds.js +++ b/src/struct/Embeds.js @@ -72,6 +72,7 @@ class Embeds extends PaginationEmbed { /** * The thumbnail of all embeds. + * @type {string} */ this.thumbnail = options.thumbnail || null; @@ -96,7 +97,7 @@ class Embeds extends PaginationEmbed { /** * Embed in the current page. - * @returns {MessageEmbed} - An instance of MessageEmbed. + * @type {MessageEmbed} */ get currentEmbed() { return this.array[this.page - 1]; @@ -105,7 +106,7 @@ class Embeds extends PaginationEmbed { /** * Adds a blank field to the fields of all embeds. * @param {boolean} [inline=false] - Whether the field is inline or not to the other fields. - * @returns {Embeds} - Instance of Embeds + * @returns {PaginationEmbed} */ addBlankField(inline = false) { const arr = this.array; @@ -121,7 +122,7 @@ class Embeds extends PaginationEmbed { * @param {string} name - The name of the field. * @param {string} value - The value of the field. * @param {boolean} [inline=false] - Whether the field is inline or not to the other fields. - * @returns {Embeds} - Instance of Embeds + * @returns {PaginationEmbed} */ addField(name, value, inline = false) { if (!name && !value) return this; @@ -140,12 +141,12 @@ class Embeds extends PaginationEmbed { * @example * * // Object as constructor. - * const Embeds = require('discord-paginationembed').Embeds; + * const { Embeds } = require('discord-paginationembed'); * const { MessageEmbed } = require('discord.js'); * * // Under message event. * new Embeds({ - * authorisedUser: message.author, + * authorizedUser: message.author, * channel: message.channel, * clientMessage: { content: 'Preparing the embed...' }, * array: [ @@ -169,12 +170,12 @@ class Embeds extends PaginationEmbed { * @example * * // Methods as constructor. - * const Embeds = require('discord-paginationembed').Embeds; + * const { Embeds } = require('discord-paginationembed'); * const { MessageEmbed } = require('discord.js'); * * // Under message event. * new Embeds() - * .setAuthorisedUser(message.author) + * .setAuthorizedUser(message.author) * .setChannel(message.channel) * .setClientMessage(null, 'Preparing the embed...') * .setArray([ @@ -230,7 +231,7 @@ class Embeds extends PaginationEmbed { /** * Sets the array of embeds to paginate. * @param {Array} array - An array of embeds to paginate. - * @returns {Embeds} - Instance of Embeds + * @returns {PaginationEmbed} */ setArray(array) { const isValidArray = Array.isArray(array) && Boolean(array.length); @@ -251,7 +252,7 @@ class Embeds extends PaginationEmbed { * @param {StringResolvable} name - The name of the author. * @param {string} [iconURL=null] - The icon URL of the author. * @param {string} [url=null] - The URL of the author. - * @returns {Embeds} - Instance of Embeds + * @returns {PaginationEmbed} */ setAuthor(name, iconURL = null, url = null) { if (!name) return this; @@ -267,7 +268,7 @@ class Embeds extends PaginationEmbed { /** * Sets the color of all embeds. * @param {ColorResolvable} color - The color of all embeds. - * @returns {Embeds} - Instance of Embeds + * @returns {PaginationEmbed} */ setColor(color) { if (!color) return this; @@ -283,7 +284,7 @@ class Embeds extends PaginationEmbed { /** * Sets the description of all embeds. * @param {string} description - The description of all embeds. - * @returns {Embeds} - Instance of Embeds + * @returns {PaginationEmbed} */ setDescription(description) { if (!description) return this; @@ -300,7 +301,7 @@ class Embeds extends PaginationEmbed { * Sets the footer of all embeds. * @param {string} text - The footer text. * @param {string} [iconURL=null] - URL for the footer's icon. - * @returns {Embeds} - Instance of Embeds + * @returns {PaginationEmbed} */ setFooter(text, iconURL = null) { if (!text) return this; @@ -316,7 +317,7 @@ class Embeds extends PaginationEmbed { /** * Sets the image of all embeds. * @param {string} image - The image of all embeds. - * @returns {Embeds} - Instance of Embeds + * @returns {PaginationEmbed} */ setImage(image) { if (!image) return this; @@ -332,7 +333,7 @@ class Embeds extends PaginationEmbed { /** * Sets the thumbnail of all embeds. * @param {string} thumbnail - The thumbnail of all embeds. - * @returns {Embeds} - Instance of Embeds + * @returns {PaginationEmbed} */ setThumbnail(thumbnail) { if (!thumbnail) return this; @@ -347,7 +348,7 @@ class Embeds extends PaginationEmbed { /** * Sets the timestamp of all embeds. - * @returns {Embeds} - Instance of Embeds + * @returns {PaginationEmbed} */ setTimestamp() { const arr = this.array; @@ -361,7 +362,7 @@ class Embeds extends PaginationEmbed { /** * Sets the title of all embeds. * @param {string} title - The title of all embeds. - * @returns {Embeds} - Instance of Embeds + * @returns {PaginationEmbed} */ setTitle(title) { if (!title) return this; @@ -377,7 +378,7 @@ class Embeds extends PaginationEmbed { /** * Sets the URL of all embeds. * @param {string} url - The URL of all embeds. - * @returns {Embeds} - Instance of Embeds + * @returns {PaginationEmbed} */ setURL(url) { if (!url) return this; diff --git a/src/struct/FieldsEmbed.js b/src/struct/FieldsEmbed.js index 71b2281..d631b76 100644 --- a/src/struct/FieldsEmbed.js +++ b/src/struct/FieldsEmbed.js @@ -42,7 +42,7 @@ class FieldsEmbed extends PaginationEmbed { /** * Elements in the current page. - * @returns {Array.<*>} - An array for a page. + * @type {Array.<*>} */ get elementList() { const begin = (this.page - 1) * this.elementsPerPage; @@ -57,11 +57,11 @@ class FieldsEmbed extends PaginationEmbed { * @example * * // Object as constructor. - * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed; + * const { FieldsEmbed } = require('discord-paginationembed'); * * // Under message event. * new FieldsEmbed({ - * authorisedUser: message.author, + * authorizedUser: message.author, * channel: message.channel, * clientMessage: { content: 'Preparing the embed...' }, * array: [ @@ -87,11 +87,11 @@ class FieldsEmbed extends PaginationEmbed { * @example * * // Methods as constructor. - * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed; + * const { FieldsEmbed } = require('discord-paginationembed'); * * // Under message event. * new FieldsEmbed() - * .setAuthorisedUser(message.author) + * .setAuthorizedUser(message.author) * .setChannel(message.channel) * .setClientMessage(null, 'Preparing the embed...') * .setArray([ @@ -146,7 +146,7 @@ class FieldsEmbed extends PaginationEmbed { * @param {string} name - Name of the field. * @param {Function} value - Value of the field. Function for Array.prototype.map().join('\n'). * @param {boolean} [inline=true] - Whether the field is inline with other field or not. - * @returns {FieldsEmbed} - Instance of FieldsEmbed + * @returns {PaginationEmbed} */ formatField(name, value, inline = true) { this.fields.push({ name, value, inline }); @@ -156,10 +156,10 @@ class FieldsEmbed extends PaginationEmbed { /** * Sets the maximum number of elements to be displayed per page. - * @param {number} [number=10] - Maximum number of elements to be displayed per page. - * @returns {FieldsEmbed} - Instance of FieldsEmbed + * @param {number} number - Maximum number of elements to be displayed per page. + * @returns {PaginationEmbed} */ - setElementsPerPage(number = 10) { + setElementsPerPage(number) { if (typeof number !== 'number') throw new Error('setElementsPerPage() only accepts number type.'); this.elementsPerPage = number; diff --git a/src/struct/base/PaginationEmbed.js b/src/struct/base/PaginationEmbed.js index 11a5a9f..9f9ec45 100644 --- a/src/struct/base/PaginationEmbed.js +++ b/src/struct/base/PaginationEmbed.js @@ -24,7 +24,7 @@ class PaginationEmbed extends MessageEmbed { /** * Options for the constructor. * @typedef {Object} PaginationEmbedOptions - * @property {User} [authorisedUser=null] - The authorised user to navigate the pages. + * @property {User} [authorizedUser=null] - The authorized user to navigate the pages. * @property {TextChannel} channel - The channel where to send the embed. * @property {ClientMessageOptions} [clientMessage=null] - Settings for the message sent by the client. * @property {Array.<*>} array - An array of elements to paginate. @@ -43,10 +43,10 @@ class PaginationEmbed extends MessageEmbed { super(options); /** - * The authorised user to navigate the pages. + * The authorized user to navigate the pages. * @type {User} */ - this.authorisedUser = options.authorisedUser || null; + this.authorizedUser = options.authorizedUser || null; /** * The channel where to send the embed. @@ -110,7 +110,7 @@ class PaginationEmbed extends MessageEmbed { /** * Sets the array of elements to paginate. * @param {Array} array - An array of elements to paginate. - * @returns {PaginationEmbed} - Instance of PaginationEmbed + * @returns {PaginationEmbed} */ setArray(array) { const isValidArray = Array.isArray(array) && Boolean(array.length); @@ -123,12 +123,12 @@ class PaginationEmbed extends MessageEmbed { } /** - * Set the authorised person to navigate the pages. - * @param {User} [user=null] - The user object. - * @returns {PaginationEmbed} - Instance of PaginationEmbed + * Set the authorized person to navigate the pages. + * @param {User} user - The user object. + * @returns {PaginationEmbed} */ - setAuthorisedUser(user = null) { - this.authorisedUser = user; + setAuthorizedUser(user) { + this.authorizedUser = user; return this; } @@ -136,7 +136,7 @@ class PaginationEmbed extends MessageEmbed { /** * The channel where to send the embed. * @param {TextChannel} channel - The channel object. - * @returns {PaginationEmbed} - Instance of PaginationEmbed + * @returns {PaginationEmbed} */ setChannel(channel) { this.channel = channel; @@ -146,11 +146,11 @@ class PaginationEmbed extends MessageEmbed { /** * Sets the settings for the message sent by the client. - * @param {Message} [message=null] - The message object sent by the client, if there is any. + * @param {Message} message - The message object sent by the client. * @param {string} [content='Preparing...'] - The custom message content while preparing the embed. - * @returns {PaginationEmbed} - Instance of PaginationEmbed + * @returns {PaginationEmbed} */ - setClientMessage(message = null, content = null) { + setClientMessage(message, content = null) { if (!content) content = 'Preparing...'; Object.assign(this.clientMessage, { message, content }); @@ -160,8 +160,8 @@ class PaginationEmbed extends MessageEmbed { /** * Sets the emojis used for navigation buttons. - * @param {NavigationButtons} [emojis={}] - An object containing customised emojis to use as navigation buttons. - * @returns {PaginationEmbed} - Instance of PaginationEmbed + * @param {NavigationButtons} emojis - An object containing customised emojis to use as navigation buttons. + * @returns {PaginationEmbed} */ setEmojis(emojis) { Object.assign(this.emojis, emojis); @@ -171,10 +171,10 @@ class PaginationEmbed extends MessageEmbed { /** * Sets to jump to a certain page upon calling PaginationEmbed.build(). - * @param {number|string} [param=1] - The page number to jump to. As String: 'back', 'forward' - * @returns {PaginationEmbed} - Instance of PaginationEmbed + * @param {number|string} param - The page number to jump to. As String: 'back', 'forward' + * @returns {PaginationEmbed} */ - setPage(param = 1) { + setPage(param) { const isString = typeof param === 'string'; if (!(!isNaN(param) || isString)) throw new Error('setPage() only accepts number/string type.'); @@ -190,10 +190,10 @@ class PaginationEmbed extends MessageEmbed { /** * Sets the time for awaiting a user action before timeout in ms. - * @param {number} [timeout=30000] Timeout value in ms. - * @returns {PaginationEmbed} - Instance of PaginationEmbed + * @param {number} timeout Timeout value in ms. + * @returns {PaginationEmbed} */ - setTimeout(timeout = 30000) { + setTimeout(timeout) { if (typeof timeout !== 'number') throw new Error('setTimeout() only accepts number type.'); this.timeout = timeout; @@ -203,10 +203,10 @@ class PaginationEmbed extends MessageEmbed { /** * Sets whether page number indicator on client's message is shown or not. - * @param {boolean} [boolean=true] - Show page indicator? - * @returns {PaginationEmbed} - Instance of PaginationEmbed + * @param {boolean} boolean - Show page indicator? + * @returns {PaginationEmbed} */ - showPageIndicator(boolean = true) { + showPageIndicator(boolean) { if (typeof boolean !== 'boolean') throw new Error('showPageIndicator() only accepts boolean type.'); this.pageIndicator = boolean; @@ -222,7 +222,7 @@ class PaginationEmbed extends MessageEmbed { async _verify(pages) { this .setChannel(this.channel) - .setAuthorisedUser(this.authorisedUser) + .setAuthorizedUser(this.authorizedUser) .setClientMessage(this.clientMessage.message, this.clientMessage.content) .setArray(this.array) .showPageIndicator(this.pageIndicator) @@ -298,8 +298,8 @@ class PaginationEmbed extends MessageEmbed { async _awaitResponse() { const emojis = Object.values(this.emojis); const filter = (r, u) => { - if (this.authorisedUser) - return u.id === this.authorisedUser.id && emojis.includes(r.emoji.name); + if (this.authorizedUser) + return u.id === this.authorizedUser.id && emojis.includes(r.emoji.name); return !u.bot && emojis.includes(r.emoji.name); };
Returns:
Returns:
-setAuthorisedUser(useropt) → {PaginationEmbed}
+setAuthorizedUser(user) → {PaginationEmbed}
@@ -2588,7 +2592,7 @@setA
setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -2648,12 +2652,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2677,23 +2677,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -2719,10 +2703,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2879,10 +2859,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2905,7 +2881,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -3019,8 +2995,6 @@ Parameters:
- <optional>
-
@@ -3031,12 +3005,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -3098,10 +3070,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -3124,7 +3092,7 @@ Returns:
- setColor(color) → {Embeds}
+ setColor(color) → {PaginationEmbed}
@@ -3136,7 +3104,7 @@ setColorSource:
Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3265,7 +3229,7 @@ Returns:
Returns:
- setDescription(description) → {Embeds}
+ setDescription(description) → {PaginationEmbed}
@@ -3291,7 +3255,7 @@ setDesc
Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3420,7 +3380,7 @@ Returns:
Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -3517,12 +3477,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -3546,23 +3502,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -3588,10 +3528,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -3614,7 +3550,7 @@ Returns:
- setFooter(text, iconURLopt) → {Embeds}
+ setFooter(text, iconURLopt) → {PaginationEmbed}
@@ -3626,7 +3562,7 @@ setFooterSource:
Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3810,7 +3742,7 @@ Returns:
Returns:
- setImage(image) → {Embeds}
+ setImage(image) → {PaginationEmbed}
@@ -3836,7 +3768,7 @@ setImageSource:
Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3965,7 +3893,7 @@ Returns:
Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -4062,12 +3990,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -4094,23 +4018,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -4136,10 +4044,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -4162,7 +4066,7 @@ Returns:
- setThumbnail(thumbnail) → {Embeds}
+ setThumbnail(thumbnail) → {PaginationEmbed}
@@ -4174,7 +4078,7 @@ setThumbn
Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4303,7 +4203,7 @@ Returns:
Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -4400,12 +4300,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -4429,23 +4325,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -4471,10 +4351,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -4497,7 +4373,7 @@ Returns:
- setTimestamp() → {Embeds}
+ setTimestamp() → {PaginationEmbed}
@@ -4509,7 +4385,7 @@ setTimest
setTimest
Returns:
-
- - Instance of Embeds
-
-
@@ -4589,7 +4461,7 @@ Returns:
Returns:
- setTitle(title) → {Embeds}
+ setTitle(title) → {PaginationEmbed}
@@ -4615,7 +4487,7 @@ setTitleSource:
Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4744,7 +4612,7 @@ Returns:
Returns:
- setURL(url) → {Embeds}
+ setURL(url) → {PaginationEmbed}
@@ -4770,7 +4638,7 @@ setURLSource:
Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4899,7 +4763,7 @@ Returns:
Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -4996,12 +4860,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -5025,23 +4885,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- true
-
-
Show page indicator?
@@ -5067,10 +4911,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -5106,7 +4946,7 @@ Returns:
diff --git a/docs/Embeds.js.html b/docs/Embeds.js.html
index 637f285..ba6e1c4 100644
--- a/docs/Embeds.js.html
+++ b/docs/Embeds.js.html
@@ -22,7 +22,7 @@
@@ -111,6 +111,7 @@ Embeds.js
/**
* The thumbnail of all embeds.
+ * @type {string}
*/
this.thumbnail = options.thumbnail || null;
@@ -135,7 +136,7 @@ Embeds.js
/**
* Embed in the current page.
- * @returns {MessageEmbed} - An instance of MessageEmbed.
+ * @type {MessageEmbed}
*/
get currentEmbed() {
return this.array[this.page - 1];
@@ -144,7 +145,7 @@ Embeds.js
/**
* Adds a blank field to the fields of all embeds.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addBlankField(inline = false) {
const arr = this.array;
@@ -160,7 +161,7 @@ Embeds.js
* @param {string} name - The name of the field.
* @param {string} value - The value of the field.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addField(name, value, inline = false) {
if (!name && !value) return this;
@@ -179,12 +180,12 @@ Embeds.js
* @example
*
* // Object as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -208,12 +209,12 @@ Embeds.js
* @example
*
* // Methods as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -269,7 +270,7 @@ Embeds.js
/**
* Sets the array of embeds to paginate.
* @param {Array} array - An array of embeds to paginate.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -290,7 +291,7 @@ Embeds.js
* @param {StringResolvable} name - The name of the author.
* @param {string} [iconURL=null] - The icon URL of the author.
* @param {string} [url=null] - The URL of the author.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setAuthor(name, iconURL = null, url = null) {
if (!name) return this;
@@ -306,7 +307,7 @@ Embeds.js
/**
* Sets the color of all embeds.
* @param {ColorResolvable} color - The color of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setColor(color) {
if (!color) return this;
@@ -322,7 +323,7 @@ Embeds.js
/**
* Sets the description of all embeds.
* @param {string} description - The description of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setDescription(description) {
if (!description) return this;
@@ -339,7 +340,7 @@ Embeds.js
* Sets the footer of all embeds.
* @param {string} text - The footer text.
* @param {string} [iconURL=null] - URL for the footer's icon.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setFooter(text, iconURL = null) {
if (!text) return this;
@@ -355,7 +356,7 @@ Embeds.js
/**
* Sets the image of all embeds.
* @param {string} image - The image of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setImage(image) {
if (!image) return this;
@@ -371,7 +372,7 @@ Embeds.js
/**
* Sets the thumbnail of all embeds.
* @param {string} thumbnail - The thumbnail of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setThumbnail(thumbnail) {
if (!thumbnail) return this;
@@ -386,7 +387,7 @@ Embeds.js
/**
* Sets the timestamp of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTimestamp() {
const arr = this.array;
@@ -400,7 +401,7 @@ Embeds.js
/**
* Sets the title of all embeds.
* @param {string} title - The title of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTitle(title) {
if (!title) return this;
@@ -416,7 +417,7 @@ Embeds.js
/**
* Sets the URL of all embeds.
* @param {string} url - The URL of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setURL(url) {
if (!url) return this;
@@ -455,7 +456,7 @@ Embeds.js
diff --git a/docs/FieldsEmbed.html b/docs/FieldsEmbed.html
index 948c77a..e3a7000 100644
--- a/docs/FieldsEmbed.html
+++ b/docs/FieldsEmbed.html
@@ -22,7 +22,7 @@
@@ -304,7 +304,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -326,7 +326,7 @@ authori
authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -538,7 +538,7 @@ Type:
-elementList
+elementList :Array.<*>
@@ -594,6 +594,16 @@ elementLis
+ Type:
+
+
+
@@ -1063,9 +1073,9 @@ (async) buildExamples
- // Object as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed({
authorisedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
+ // Object as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed({
authorizedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
- // Methods as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed()
.setAuthorisedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
+ // Methods as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed()
.setAuthorizedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
@@ -1089,7 +1099,7 @@ Examples
- formatField(name, value, inlineopt) → {FieldsEmbed}
+ formatField(name, value, inlineopt) → {PaginationEmbed}
@@ -1308,10 +1318,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -1320,7 +1326,7 @@ Returns:
Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1494,7 +1496,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1517,7 +1519,7 @@ setA
setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1577,12 +1579,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1606,23 +1604,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1648,10 +1630,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1808,10 +1786,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1834,7 +1808,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1948,8 +1922,6 @@ Parameters:
- <optional>
-
@@ -1960,12 +1932,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -2027,10 +1997,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2053,7 +2019,7 @@ Returns:
- setElementsPerPage(numberopt) → {FieldsEmbed}
+ setElementsPerPage(number) → {PaginationEmbed}
@@ -2131,12 +2097,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2160,24 +2122,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 10
-
-
-
Maximum number of elements to be displayed per page.
@@ -2202,10 +2148,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -2214,7 +2156,7 @@ Returns:
Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -2311,12 +2253,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2340,23 +2278,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -2382,10 +2304,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2408,7 +2326,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -2491,12 +2409,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2523,24 +2437,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 1
-
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -2565,10 +2463,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2591,7 +2485,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -2674,12 +2568,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2703,23 +2593,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2745,10 +2619,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2771,7 +2641,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2854,12 +2724,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2883,24 +2749,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2925,10 +2775,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2964,7 +2810,7 @@ Returns:
diff --git a/docs/FieldsEmbed.js.html b/docs/FieldsEmbed.js.html
index 5d36097..9bad270 100644
--- a/docs/FieldsEmbed.js.html
+++ b/docs/FieldsEmbed.js.html
@@ -22,7 +22,7 @@
@@ -81,7 +81,7 @@ FieldsEmbed.js
/**
* Elements in the current page.
- * @returns {Array.<*>} - An array for a page.
+ * @type {Array.<*>}
*/
get elementList() {
const begin = (this.page - 1) * this.elementsPerPage;
@@ -96,11 +96,11 @@ FieldsEmbed.js
* @example
*
* // Object as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -126,11 +126,11 @@ FieldsEmbed.js
* @example
*
* // Methods as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -185,7 +185,7 @@ FieldsEmbed.js
* @param {string} name - Name of the field.
* @param {Function} value - Value of the field. Function for Array.prototype.map().join('\n').
* @param {boolean} [inline=true] - Whether the field is inline with other field or not.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @returns {PaginationEmbed}
*/
formatField(name, value, inline = true) {
this.fields.push({ name, value, inline });
@@ -195,10 +195,10 @@ FieldsEmbed.js
/**
* Sets the maximum number of elements to be displayed per page.
- * @param {number} [number=10] - Maximum number of elements to be displayed per page.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @param {number} number - Maximum number of elements to be displayed per page.
+ * @returns {PaginationEmbed}
*/
- setElementsPerPage(number = 10) {
+ setElementsPerPage(number) {
if (typeof number !== 'number') throw new Error('setElementsPerPage() only accepts number type.');
this.elementsPerPage = number;
@@ -266,7 +266,7 @@ FieldsEmbed.js
diff --git a/docs/PaginationEmbed.html b/docs/PaginationEmbed.html
index 58d735a..994485d 100644
--- a/docs/PaginationEmbed.html
+++ b/docs/PaginationEmbed.html
@@ -22,7 +22,7 @@
@@ -299,7 +299,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -350,7 +350,7 @@ authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -951,10 +951,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -977,7 +973,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1029,7 +1025,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1055,12 +1051,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1084,23 +1076,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1126,10 +1102,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1281,10 +1253,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1307,7 +1275,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1416,8 +1384,6 @@ Parameters:
- <optional>
-
@@ -1428,12 +1394,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -1495,10 +1459,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1521,7 +1481,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -1599,12 +1559,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1628,23 +1584,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -1670,10 +1610,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1696,7 +1632,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -1774,12 +1710,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1806,23 +1738,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -1848,10 +1764,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1874,7 +1786,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -1952,12 +1864,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1981,23 +1889,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2023,10 +1915,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2049,7 +1937,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2127,12 +2015,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2156,24 +2040,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2198,10 +2066,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2237,7 +2101,7 @@ Returns:
diff --git a/docs/base_PaginationEmbed.js.html b/docs/base_PaginationEmbed.js.html
index c40af28..e74e322 100644
--- a/docs/base_PaginationEmbed.js.html
+++ b/docs/base_PaginationEmbed.js.html
@@ -22,7 +22,7 @@
@@ -63,7 +63,7 @@ base/PaginationEmbed.js
/**
* Options for the constructor.
* @typedef {Object} PaginationEmbedOptions
- * @property {User} [authorisedUser=null] - The authorised user to navigate the pages.
+ * @property {User} [authorizedUser=null] - The authorized user to navigate the pages.
* @property {TextChannel} channel - The channel where to send the embed.
* @property {ClientMessageOptions} [clientMessage=null] - Settings for the message sent by the client.
* @property {Array.<*>} array - An array of elements to paginate.
@@ -82,10 +82,10 @@ base/PaginationEmbed.js
super(options);
/**
- * The authorised user to navigate the pages.
+ * The authorized user to navigate the pages.
* @type {User}
*/
- this.authorisedUser = options.authorisedUser || null;
+ this.authorizedUser = options.authorizedUser || null;
/**
* The channel where to send the embed.
@@ -149,7 +149,7 @@ base/PaginationEmbed.js
/**
* Sets the array of elements to paginate.
* @param {Array} array - An array of elements to paginate.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -162,12 +162,12 @@ base/PaginationEmbed.js
}
/**
- * Set the authorised person to navigate the pages.
- * @param {User} [user=null] - The user object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * Set the authorized person to navigate the pages.
+ * @param {User} user - The user object.
+ * @returns {PaginationEmbed}
*/
- setAuthorisedUser(user = null) {
- this.authorisedUser = user;
+ setAuthorizedUser(user) {
+ this.authorizedUser = user;
return this;
}
@@ -175,7 +175,7 @@ base/PaginationEmbed.js
/**
* The channel where to send the embed.
* @param {TextChannel} channel - The channel object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setChannel(channel) {
this.channel = channel;
@@ -185,11 +185,11 @@ base/PaginationEmbed.js
/**
* Sets the settings for the message sent by the client.
- * @param {Message} [message=null] - The message object sent by the client, if there is any.
+ * @param {Message} message - The message object sent by the client.
* @param {string} [content='Preparing...'] - The custom message content while preparing the embed.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
- setClientMessage(message = null, content = null) {
+ setClientMessage(message, content = null) {
if (!content) content = 'Preparing...';
Object.assign(this.clientMessage, { message, content });
@@ -199,8 +199,8 @@ base/PaginationEmbed.js
/**
* Sets the emojis used for navigation buttons.
- * @param {NavigationButtons} [emojis={}] - An object containing customised emojis to use as navigation buttons.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {NavigationButtons} emojis - An object containing customised emojis to use as navigation buttons.
+ * @returns {PaginationEmbed}
*/
setEmojis(emojis) {
Object.assign(this.emojis, emojis);
@@ -210,10 +210,10 @@ base/PaginationEmbed.js
/**
* Sets to jump to a certain page upon calling PaginationEmbed.build().
- * @param {number|string} [param=1] - The page number to jump to. As String: 'back', 'forward'
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number|string} param - The page number to jump to. As String: 'back', 'forward'
+ * @returns {PaginationEmbed}
*/
- setPage(param = 1) {
+ setPage(param) {
const isString = typeof param === 'string';
if (!(!isNaN(param) || isString)) throw new Error('setPage() only accepts number/string type.');
@@ -229,10 +229,10 @@ base/PaginationEmbed.js
/**
* Sets the time for awaiting a user action before timeout in ms.
- * @param {number} [timeout=30000] Timeout value in ms.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number} timeout Timeout value in ms.
+ * @returns {PaginationEmbed}
*/
- setTimeout(timeout = 30000) {
+ setTimeout(timeout) {
if (typeof timeout !== 'number') throw new Error('setTimeout() only accepts number type.');
this.timeout = timeout;
@@ -242,10 +242,10 @@ base/PaginationEmbed.js
/**
* Sets whether page number indicator on client's message is shown or not.
- * @param {boolean} [boolean=true] - Show page indicator?
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {boolean} boolean - Show page indicator?
+ * @returns {PaginationEmbed}
*/
- showPageIndicator(boolean = true) {
+ showPageIndicator(boolean) {
if (typeof boolean !== 'boolean') throw new Error('showPageIndicator() only accepts boolean type.');
this.pageIndicator = boolean;
@@ -261,7 +261,7 @@ base/PaginationEmbed.js
async _verify(pages) {
this
.setChannel(this.channel)
- .setAuthorisedUser(this.authorisedUser)
+ .setAuthorizedUser(this.authorizedUser)
.setClientMessage(this.clientMessage.message, this.clientMessage.content)
.setArray(this.array)
.showPageIndicator(this.pageIndicator)
@@ -337,8 +337,8 @@ base/PaginationEmbed.js
async _awaitResponse() {
const emojis = Object.values(this.emojis);
const filter = (r, u) => {
- if (this.authorisedUser)
- return u.id === this.authorisedUser.id && emojis.includes(r.emoji.name);
+ if (this.authorizedUser)
+ return u.id === this.authorizedUser.id && emojis.includes(r.emoji.name);
return !u.bot && emojis.includes(r.emoji.name);
};
@@ -432,7 +432,7 @@ base/PaginationEmbed.js
diff --git a/docs/global.html b/docs/global.html
index 23000ba..3f7e34b 100644
--- a/docs/global.html
+++ b/docs/global.html
@@ -22,7 +22,7 @@
@@ -1487,7 +1487,7 @@ Properties:
- authorisedUser
+ authorizedUser
@@ -1517,7 +1517,7 @@ Properties:
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -1820,7 +1820,7 @@ Type:
diff --git a/docs/index.html b/docs/index.html
index 80eb8c4..c53f893 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -22,7 +22,7 @@
@@ -51,20 +51,21 @@ Home
Classes
Parameters:
Parameters:
-- - - - -
null
-
- Parameters:
Returns:
--
@@ -2879,10 +2859,6 @@
Parameters:
Returns:
--
@@ -2905,7 +2881,7 @@
Returns:
-setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -3019,8 +2995,6 @@Parameters:
- @@ -3031,12 +3005,10 @@
Parameters:
null
-
Parameters:
Returns:
--
@@ -3124,7 +3092,7 @@
Returns:
-setColor(color) → {Embeds}
+setColor(color) → {PaginationEmbed}
@@ -3136,7 +3104,7 @@setColorSource:
Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3265,7 +3229,7 @@ Returns:
Returns:
- setDescription(description) → {Embeds}
+ setDescription(description) → {PaginationEmbed}
@@ -3291,7 +3255,7 @@ setDesc
Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3420,7 +3380,7 @@ Returns:
Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -3517,12 +3477,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -3546,23 +3502,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -3588,10 +3528,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -3614,7 +3550,7 @@ Returns:
- setFooter(text, iconURLopt) → {Embeds}
+ setFooter(text, iconURLopt) → {PaginationEmbed}
@@ -3626,7 +3562,7 @@ setFooterSource:
Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3810,7 +3742,7 @@ Returns:
Returns:
- setImage(image) → {Embeds}
+ setImage(image) → {PaginationEmbed}
@@ -3836,7 +3768,7 @@ setImageSource:
Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3965,7 +3893,7 @@ Returns:
Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -4062,12 +3990,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -4094,23 +4018,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -4136,10 +4044,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -4162,7 +4066,7 @@ Returns:
- setThumbnail(thumbnail) → {Embeds}
+ setThumbnail(thumbnail) → {PaginationEmbed}
@@ -4174,7 +4078,7 @@ setThumbn
Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4303,7 +4203,7 @@ Returns:
Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -4400,12 +4300,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -4429,23 +4325,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -4471,10 +4351,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -4497,7 +4373,7 @@ Returns:
- setTimestamp() → {Embeds}
+ setTimestamp() → {PaginationEmbed}
@@ -4509,7 +4385,7 @@ setTimest
setTimest
Returns:
-
- - Instance of Embeds
-
-
@@ -4589,7 +4461,7 @@ Returns:
Returns:
- setTitle(title) → {Embeds}
+ setTitle(title) → {PaginationEmbed}
@@ -4615,7 +4487,7 @@ setTitleSource:
Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4744,7 +4612,7 @@ Returns:
Returns:
- setURL(url) → {Embeds}
+ setURL(url) → {PaginationEmbed}
@@ -4770,7 +4638,7 @@ setURLSource:
Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4899,7 +4763,7 @@ Returns:
Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -4996,12 +4860,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -5025,23 +4885,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- true
-
-
Show page indicator?
@@ -5067,10 +4911,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -5106,7 +4946,7 @@ Returns:
diff --git a/docs/Embeds.js.html b/docs/Embeds.js.html
index 637f285..ba6e1c4 100644
--- a/docs/Embeds.js.html
+++ b/docs/Embeds.js.html
@@ -22,7 +22,7 @@
@@ -111,6 +111,7 @@ Embeds.js
/**
* The thumbnail of all embeds.
+ * @type {string}
*/
this.thumbnail = options.thumbnail || null;
@@ -135,7 +136,7 @@ Embeds.js
/**
* Embed in the current page.
- * @returns {MessageEmbed} - An instance of MessageEmbed.
+ * @type {MessageEmbed}
*/
get currentEmbed() {
return this.array[this.page - 1];
@@ -144,7 +145,7 @@ Embeds.js
/**
* Adds a blank field to the fields of all embeds.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addBlankField(inline = false) {
const arr = this.array;
@@ -160,7 +161,7 @@ Embeds.js
* @param {string} name - The name of the field.
* @param {string} value - The value of the field.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addField(name, value, inline = false) {
if (!name && !value) return this;
@@ -179,12 +180,12 @@ Embeds.js
* @example
*
* // Object as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -208,12 +209,12 @@ Embeds.js
* @example
*
* // Methods as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -269,7 +270,7 @@ Embeds.js
/**
* Sets the array of embeds to paginate.
* @param {Array} array - An array of embeds to paginate.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -290,7 +291,7 @@ Embeds.js
* @param {StringResolvable} name - The name of the author.
* @param {string} [iconURL=null] - The icon URL of the author.
* @param {string} [url=null] - The URL of the author.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setAuthor(name, iconURL = null, url = null) {
if (!name) return this;
@@ -306,7 +307,7 @@ Embeds.js
/**
* Sets the color of all embeds.
* @param {ColorResolvable} color - The color of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setColor(color) {
if (!color) return this;
@@ -322,7 +323,7 @@ Embeds.js
/**
* Sets the description of all embeds.
* @param {string} description - The description of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setDescription(description) {
if (!description) return this;
@@ -339,7 +340,7 @@ Embeds.js
* Sets the footer of all embeds.
* @param {string} text - The footer text.
* @param {string} [iconURL=null] - URL for the footer's icon.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setFooter(text, iconURL = null) {
if (!text) return this;
@@ -355,7 +356,7 @@ Embeds.js
/**
* Sets the image of all embeds.
* @param {string} image - The image of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setImage(image) {
if (!image) return this;
@@ -371,7 +372,7 @@ Embeds.js
/**
* Sets the thumbnail of all embeds.
* @param {string} thumbnail - The thumbnail of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setThumbnail(thumbnail) {
if (!thumbnail) return this;
@@ -386,7 +387,7 @@ Embeds.js
/**
* Sets the timestamp of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTimestamp() {
const arr = this.array;
@@ -400,7 +401,7 @@ Embeds.js
/**
* Sets the title of all embeds.
* @param {string} title - The title of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTitle(title) {
if (!title) return this;
@@ -416,7 +417,7 @@ Embeds.js
/**
* Sets the URL of all embeds.
* @param {string} url - The URL of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setURL(url) {
if (!url) return this;
@@ -455,7 +456,7 @@ Embeds.js
diff --git a/docs/FieldsEmbed.html b/docs/FieldsEmbed.html
index 948c77a..e3a7000 100644
--- a/docs/FieldsEmbed.html
+++ b/docs/FieldsEmbed.html
@@ -22,7 +22,7 @@
@@ -304,7 +304,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -326,7 +326,7 @@ authori
authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -538,7 +538,7 @@ Type:
-elementList
+elementList :Array.<*>
@@ -594,6 +594,16 @@ elementLis
+ Type:
+
+
+
@@ -1063,9 +1073,9 @@ (async) buildExamples
- // Object as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed({
authorisedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
+ // Object as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed({
authorizedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
- // Methods as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed()
.setAuthorisedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
+ // Methods as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed()
.setAuthorizedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
@@ -1089,7 +1099,7 @@ Examples
- formatField(name, value, inlineopt) → {FieldsEmbed}
+ formatField(name, value, inlineopt) → {PaginationEmbed}
@@ -1308,10 +1318,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -1320,7 +1326,7 @@ Returns:
Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1494,7 +1496,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1517,7 +1519,7 @@ setA
setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1577,12 +1579,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1606,23 +1604,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1648,10 +1630,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1808,10 +1786,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1834,7 +1808,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1948,8 +1922,6 @@ Parameters:
- <optional>
-
@@ -1960,12 +1932,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -2027,10 +1997,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2053,7 +2019,7 @@ Returns:
- setElementsPerPage(numberopt) → {FieldsEmbed}
+ setElementsPerPage(number) → {PaginationEmbed}
@@ -2131,12 +2097,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2160,24 +2122,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 10
-
-
-
Maximum number of elements to be displayed per page.
@@ -2202,10 +2148,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -2214,7 +2156,7 @@ Returns:
Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -2311,12 +2253,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2340,23 +2278,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -2382,10 +2304,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2408,7 +2326,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -2491,12 +2409,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2523,24 +2437,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 1
-
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -2565,10 +2463,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2591,7 +2485,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -2674,12 +2568,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2703,23 +2593,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2745,10 +2619,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2771,7 +2641,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2854,12 +2724,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2883,24 +2749,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2925,10 +2775,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2964,7 +2810,7 @@ Returns:
diff --git a/docs/FieldsEmbed.js.html b/docs/FieldsEmbed.js.html
index 5d36097..9bad270 100644
--- a/docs/FieldsEmbed.js.html
+++ b/docs/FieldsEmbed.js.html
@@ -22,7 +22,7 @@
@@ -81,7 +81,7 @@ FieldsEmbed.js
/**
* Elements in the current page.
- * @returns {Array.<*>} - An array for a page.
+ * @type {Array.<*>}
*/
get elementList() {
const begin = (this.page - 1) * this.elementsPerPage;
@@ -96,11 +96,11 @@ FieldsEmbed.js
* @example
*
* // Object as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -126,11 +126,11 @@ FieldsEmbed.js
* @example
*
* // Methods as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -185,7 +185,7 @@ FieldsEmbed.js
* @param {string} name - Name of the field.
* @param {Function} value - Value of the field. Function for Array.prototype.map().join('\n').
* @param {boolean} [inline=true] - Whether the field is inline with other field or not.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @returns {PaginationEmbed}
*/
formatField(name, value, inline = true) {
this.fields.push({ name, value, inline });
@@ -195,10 +195,10 @@ FieldsEmbed.js
/**
* Sets the maximum number of elements to be displayed per page.
- * @param {number} [number=10] - Maximum number of elements to be displayed per page.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @param {number} number - Maximum number of elements to be displayed per page.
+ * @returns {PaginationEmbed}
*/
- setElementsPerPage(number = 10) {
+ setElementsPerPage(number) {
if (typeof number !== 'number') throw new Error('setElementsPerPage() only accepts number type.');
this.elementsPerPage = number;
@@ -266,7 +266,7 @@ FieldsEmbed.js
diff --git a/docs/PaginationEmbed.html b/docs/PaginationEmbed.html
index 58d735a..994485d 100644
--- a/docs/PaginationEmbed.html
+++ b/docs/PaginationEmbed.html
@@ -22,7 +22,7 @@
@@ -299,7 +299,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -350,7 +350,7 @@ authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -951,10 +951,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -977,7 +973,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1029,7 +1025,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1055,12 +1051,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1084,23 +1076,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1126,10 +1102,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1281,10 +1253,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1307,7 +1275,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1416,8 +1384,6 @@ Parameters:
- <optional>
-
@@ -1428,12 +1394,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -1495,10 +1459,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1521,7 +1481,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -1599,12 +1559,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1628,23 +1584,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -1670,10 +1610,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1696,7 +1632,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -1774,12 +1710,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1806,23 +1738,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -1848,10 +1764,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1874,7 +1786,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -1952,12 +1864,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1981,23 +1889,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2023,10 +1915,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2049,7 +1937,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2127,12 +2015,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2156,24 +2040,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2198,10 +2066,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2237,7 +2101,7 @@ Returns:
diff --git a/docs/base_PaginationEmbed.js.html b/docs/base_PaginationEmbed.js.html
index c40af28..e74e322 100644
--- a/docs/base_PaginationEmbed.js.html
+++ b/docs/base_PaginationEmbed.js.html
@@ -22,7 +22,7 @@
@@ -63,7 +63,7 @@ base/PaginationEmbed.js
/**
* Options for the constructor.
* @typedef {Object} PaginationEmbedOptions
- * @property {User} [authorisedUser=null] - The authorised user to navigate the pages.
+ * @property {User} [authorizedUser=null] - The authorized user to navigate the pages.
* @property {TextChannel} channel - The channel where to send the embed.
* @property {ClientMessageOptions} [clientMessage=null] - Settings for the message sent by the client.
* @property {Array.<*>} array - An array of elements to paginate.
@@ -82,10 +82,10 @@ base/PaginationEmbed.js
super(options);
/**
- * The authorised user to navigate the pages.
+ * The authorized user to navigate the pages.
* @type {User}
*/
- this.authorisedUser = options.authorisedUser || null;
+ this.authorizedUser = options.authorizedUser || null;
/**
* The channel where to send the embed.
@@ -149,7 +149,7 @@ base/PaginationEmbed.js
/**
* Sets the array of elements to paginate.
* @param {Array} array - An array of elements to paginate.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -162,12 +162,12 @@ base/PaginationEmbed.js
}
/**
- * Set the authorised person to navigate the pages.
- * @param {User} [user=null] - The user object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * Set the authorized person to navigate the pages.
+ * @param {User} user - The user object.
+ * @returns {PaginationEmbed}
*/
- setAuthorisedUser(user = null) {
- this.authorisedUser = user;
+ setAuthorizedUser(user) {
+ this.authorizedUser = user;
return this;
}
@@ -175,7 +175,7 @@ base/PaginationEmbed.js
/**
* The channel where to send the embed.
* @param {TextChannel} channel - The channel object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setChannel(channel) {
this.channel = channel;
@@ -185,11 +185,11 @@ base/PaginationEmbed.js
/**
* Sets the settings for the message sent by the client.
- * @param {Message} [message=null] - The message object sent by the client, if there is any.
+ * @param {Message} message - The message object sent by the client.
* @param {string} [content='Preparing...'] - The custom message content while preparing the embed.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
- setClientMessage(message = null, content = null) {
+ setClientMessage(message, content = null) {
if (!content) content = 'Preparing...';
Object.assign(this.clientMessage, { message, content });
@@ -199,8 +199,8 @@ base/PaginationEmbed.js
/**
* Sets the emojis used for navigation buttons.
- * @param {NavigationButtons} [emojis={}] - An object containing customised emojis to use as navigation buttons.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {NavigationButtons} emojis - An object containing customised emojis to use as navigation buttons.
+ * @returns {PaginationEmbed}
*/
setEmojis(emojis) {
Object.assign(this.emojis, emojis);
@@ -210,10 +210,10 @@ base/PaginationEmbed.js
/**
* Sets to jump to a certain page upon calling PaginationEmbed.build().
- * @param {number|string} [param=1] - The page number to jump to. As String: 'back', 'forward'
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number|string} param - The page number to jump to. As String: 'back', 'forward'
+ * @returns {PaginationEmbed}
*/
- setPage(param = 1) {
+ setPage(param) {
const isString = typeof param === 'string';
if (!(!isNaN(param) || isString)) throw new Error('setPage() only accepts number/string type.');
@@ -229,10 +229,10 @@ base/PaginationEmbed.js
/**
* Sets the time for awaiting a user action before timeout in ms.
- * @param {number} [timeout=30000] Timeout value in ms.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number} timeout Timeout value in ms.
+ * @returns {PaginationEmbed}
*/
- setTimeout(timeout = 30000) {
+ setTimeout(timeout) {
if (typeof timeout !== 'number') throw new Error('setTimeout() only accepts number type.');
this.timeout = timeout;
@@ -242,10 +242,10 @@ base/PaginationEmbed.js
/**
* Sets whether page number indicator on client's message is shown or not.
- * @param {boolean} [boolean=true] - Show page indicator?
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {boolean} boolean - Show page indicator?
+ * @returns {PaginationEmbed}
*/
- showPageIndicator(boolean = true) {
+ showPageIndicator(boolean) {
if (typeof boolean !== 'boolean') throw new Error('showPageIndicator() only accepts boolean type.');
this.pageIndicator = boolean;
@@ -261,7 +261,7 @@ base/PaginationEmbed.js
async _verify(pages) {
this
.setChannel(this.channel)
- .setAuthorisedUser(this.authorisedUser)
+ .setAuthorizedUser(this.authorizedUser)
.setClientMessage(this.clientMessage.message, this.clientMessage.content)
.setArray(this.array)
.showPageIndicator(this.pageIndicator)
@@ -337,8 +337,8 @@ base/PaginationEmbed.js
async _awaitResponse() {
const emojis = Object.values(this.emojis);
const filter = (r, u) => {
- if (this.authorisedUser)
- return u.id === this.authorisedUser.id && emojis.includes(r.emoji.name);
+ if (this.authorizedUser)
+ return u.id === this.authorizedUser.id && emojis.includes(r.emoji.name);
return !u.bot && emojis.includes(r.emoji.name);
};
@@ -432,7 +432,7 @@ base/PaginationEmbed.js
diff --git a/docs/global.html b/docs/global.html
index 23000ba..3f7e34b 100644
--- a/docs/global.html
+++ b/docs/global.html
@@ -22,7 +22,7 @@
@@ -1487,7 +1487,7 @@ Properties:
- authorisedUser
+ authorizedUser
@@ -1517,7 +1517,7 @@ Properties:
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -1820,7 +1820,7 @@ Type:
diff --git a/docs/index.html b/docs/index.html
index 80eb8c4..c53f893 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -22,7 +22,7 @@
@@ -51,20 +51,21 @@ Home
Classes
Returns:
Returns:
-setDescription(description) → {Embeds}
+setDescription(description) → {PaginationEmbed}
@@ -3291,7 +3255,7 @@setDesc
Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3420,7 +3380,7 @@ Returns:
Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -3517,12 +3477,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -3546,23 +3502,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -3588,10 +3528,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -3614,7 +3550,7 @@ Returns:
- setFooter(text, iconURLopt) → {Embeds}
+ setFooter(text, iconURLopt) → {PaginationEmbed}
@@ -3626,7 +3562,7 @@ setFooterSource:
Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3810,7 +3742,7 @@ Returns:
Returns:
- setImage(image) → {Embeds}
+ setImage(image) → {PaginationEmbed}
@@ -3836,7 +3768,7 @@ setImageSource:
Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3965,7 +3893,7 @@ Returns:
Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -4062,12 +3990,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -4094,23 +4018,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -4136,10 +4044,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -4162,7 +4066,7 @@ Returns:
- setThumbnail(thumbnail) → {Embeds}
+ setThumbnail(thumbnail) → {PaginationEmbed}
@@ -4174,7 +4078,7 @@ setThumbn
Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4303,7 +4203,7 @@ Returns:
Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -4400,12 +4300,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -4429,23 +4325,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -4471,10 +4351,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -4497,7 +4373,7 @@ Returns:
- setTimestamp() → {Embeds}
+ setTimestamp() → {PaginationEmbed}
@@ -4509,7 +4385,7 @@ setTimest
setTimest
Returns:
-
- - Instance of Embeds
-
-
@@ -4589,7 +4461,7 @@ Returns:
Returns:
- setTitle(title) → {Embeds}
+ setTitle(title) → {PaginationEmbed}
@@ -4615,7 +4487,7 @@ setTitleSource:
Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4744,7 +4612,7 @@ Returns:
Returns:
- setURL(url) → {Embeds}
+ setURL(url) → {PaginationEmbed}
@@ -4770,7 +4638,7 @@ setURLSource:
Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4899,7 +4763,7 @@ Returns:
Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -4996,12 +4860,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -5025,23 +4885,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- true
-
-
Show page indicator?
@@ -5067,10 +4911,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -5106,7 +4946,7 @@ Returns:
diff --git a/docs/Embeds.js.html b/docs/Embeds.js.html
index 637f285..ba6e1c4 100644
--- a/docs/Embeds.js.html
+++ b/docs/Embeds.js.html
@@ -22,7 +22,7 @@
@@ -111,6 +111,7 @@ Embeds.js
/**
* The thumbnail of all embeds.
+ * @type {string}
*/
this.thumbnail = options.thumbnail || null;
@@ -135,7 +136,7 @@ Embeds.js
/**
* Embed in the current page.
- * @returns {MessageEmbed} - An instance of MessageEmbed.
+ * @type {MessageEmbed}
*/
get currentEmbed() {
return this.array[this.page - 1];
@@ -144,7 +145,7 @@ Embeds.js
/**
* Adds a blank field to the fields of all embeds.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addBlankField(inline = false) {
const arr = this.array;
@@ -160,7 +161,7 @@ Embeds.js
* @param {string} name - The name of the field.
* @param {string} value - The value of the field.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addField(name, value, inline = false) {
if (!name && !value) return this;
@@ -179,12 +180,12 @@ Embeds.js
* @example
*
* // Object as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -208,12 +209,12 @@ Embeds.js
* @example
*
* // Methods as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -269,7 +270,7 @@ Embeds.js
/**
* Sets the array of embeds to paginate.
* @param {Array} array - An array of embeds to paginate.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -290,7 +291,7 @@ Embeds.js
* @param {StringResolvable} name - The name of the author.
* @param {string} [iconURL=null] - The icon URL of the author.
* @param {string} [url=null] - The URL of the author.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setAuthor(name, iconURL = null, url = null) {
if (!name) return this;
@@ -306,7 +307,7 @@ Embeds.js
/**
* Sets the color of all embeds.
* @param {ColorResolvable} color - The color of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setColor(color) {
if (!color) return this;
@@ -322,7 +323,7 @@ Embeds.js
/**
* Sets the description of all embeds.
* @param {string} description - The description of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setDescription(description) {
if (!description) return this;
@@ -339,7 +340,7 @@ Embeds.js
* Sets the footer of all embeds.
* @param {string} text - The footer text.
* @param {string} [iconURL=null] - URL for the footer's icon.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setFooter(text, iconURL = null) {
if (!text) return this;
@@ -355,7 +356,7 @@ Embeds.js
/**
* Sets the image of all embeds.
* @param {string} image - The image of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setImage(image) {
if (!image) return this;
@@ -371,7 +372,7 @@ Embeds.js
/**
* Sets the thumbnail of all embeds.
* @param {string} thumbnail - The thumbnail of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setThumbnail(thumbnail) {
if (!thumbnail) return this;
@@ -386,7 +387,7 @@ Embeds.js
/**
* Sets the timestamp of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTimestamp() {
const arr = this.array;
@@ -400,7 +401,7 @@ Embeds.js
/**
* Sets the title of all embeds.
* @param {string} title - The title of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTitle(title) {
if (!title) return this;
@@ -416,7 +417,7 @@ Embeds.js
/**
* Sets the URL of all embeds.
* @param {string} url - The URL of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setURL(url) {
if (!url) return this;
@@ -455,7 +456,7 @@ Embeds.js
diff --git a/docs/FieldsEmbed.html b/docs/FieldsEmbed.html
index 948c77a..e3a7000 100644
--- a/docs/FieldsEmbed.html
+++ b/docs/FieldsEmbed.html
@@ -22,7 +22,7 @@
@@ -304,7 +304,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -326,7 +326,7 @@ authori
authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -538,7 +538,7 @@ Type:
-elementList
+elementList :Array.<*>
@@ -594,6 +594,16 @@ elementLis
+ Type:
+
+
+
@@ -1063,9 +1073,9 @@ (async) buildExamples
- // Object as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed({
authorisedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
+ // Object as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed({
authorizedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
- // Methods as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed()
.setAuthorisedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
+ // Methods as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed()
.setAuthorizedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
@@ -1089,7 +1099,7 @@ Examples
- formatField(name, value, inlineopt) → {FieldsEmbed}
+ formatField(name, value, inlineopt) → {PaginationEmbed}
@@ -1308,10 +1318,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -1320,7 +1326,7 @@ Returns:
Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1494,7 +1496,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1517,7 +1519,7 @@ setA
setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1577,12 +1579,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1606,23 +1604,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1648,10 +1630,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1808,10 +1786,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1834,7 +1808,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1948,8 +1922,6 @@ Parameters:
- <optional>
-
@@ -1960,12 +1932,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -2027,10 +1997,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2053,7 +2019,7 @@ Returns:
- setElementsPerPage(numberopt) → {FieldsEmbed}
+ setElementsPerPage(number) → {PaginationEmbed}
@@ -2131,12 +2097,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2160,24 +2122,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 10
-
-
-
Maximum number of elements to be displayed per page.
@@ -2202,10 +2148,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -2214,7 +2156,7 @@ Returns:
Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -2311,12 +2253,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2340,23 +2278,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -2382,10 +2304,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2408,7 +2326,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -2491,12 +2409,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2523,24 +2437,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 1
-
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -2565,10 +2463,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2591,7 +2485,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -2674,12 +2568,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2703,23 +2593,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2745,10 +2619,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2771,7 +2641,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2854,12 +2724,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2883,24 +2749,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2925,10 +2775,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2964,7 +2810,7 @@ Returns:
diff --git a/docs/FieldsEmbed.js.html b/docs/FieldsEmbed.js.html
index 5d36097..9bad270 100644
--- a/docs/FieldsEmbed.js.html
+++ b/docs/FieldsEmbed.js.html
@@ -22,7 +22,7 @@
@@ -81,7 +81,7 @@ FieldsEmbed.js
/**
* Elements in the current page.
- * @returns {Array.<*>} - An array for a page.
+ * @type {Array.<*>}
*/
get elementList() {
const begin = (this.page - 1) * this.elementsPerPage;
@@ -96,11 +96,11 @@ FieldsEmbed.js
* @example
*
* // Object as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -126,11 +126,11 @@ FieldsEmbed.js
* @example
*
* // Methods as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -185,7 +185,7 @@ FieldsEmbed.js
* @param {string} name - Name of the field.
* @param {Function} value - Value of the field. Function for Array.prototype.map().join('\n').
* @param {boolean} [inline=true] - Whether the field is inline with other field or not.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @returns {PaginationEmbed}
*/
formatField(name, value, inline = true) {
this.fields.push({ name, value, inline });
@@ -195,10 +195,10 @@ FieldsEmbed.js
/**
* Sets the maximum number of elements to be displayed per page.
- * @param {number} [number=10] - Maximum number of elements to be displayed per page.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @param {number} number - Maximum number of elements to be displayed per page.
+ * @returns {PaginationEmbed}
*/
- setElementsPerPage(number = 10) {
+ setElementsPerPage(number) {
if (typeof number !== 'number') throw new Error('setElementsPerPage() only accepts number type.');
this.elementsPerPage = number;
@@ -266,7 +266,7 @@ FieldsEmbed.js
diff --git a/docs/PaginationEmbed.html b/docs/PaginationEmbed.html
index 58d735a..994485d 100644
--- a/docs/PaginationEmbed.html
+++ b/docs/PaginationEmbed.html
@@ -22,7 +22,7 @@
@@ -299,7 +299,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -350,7 +350,7 @@ authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -951,10 +951,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -977,7 +973,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1029,7 +1025,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1055,12 +1051,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1084,23 +1076,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1126,10 +1102,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1281,10 +1253,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1307,7 +1275,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1416,8 +1384,6 @@ Parameters:
- <optional>
-
@@ -1428,12 +1394,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -1495,10 +1459,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1521,7 +1481,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -1599,12 +1559,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1628,23 +1584,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -1670,10 +1610,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1696,7 +1632,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -1774,12 +1710,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1806,23 +1738,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -1848,10 +1764,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1874,7 +1786,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -1952,12 +1864,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1981,23 +1889,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2023,10 +1915,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2049,7 +1937,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2127,12 +2015,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2156,24 +2040,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2198,10 +2066,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2237,7 +2101,7 @@ Returns:
diff --git a/docs/base_PaginationEmbed.js.html b/docs/base_PaginationEmbed.js.html
index c40af28..e74e322 100644
--- a/docs/base_PaginationEmbed.js.html
+++ b/docs/base_PaginationEmbed.js.html
@@ -22,7 +22,7 @@
@@ -63,7 +63,7 @@ base/PaginationEmbed.js
/**
* Options for the constructor.
* @typedef {Object} PaginationEmbedOptions
- * @property {User} [authorisedUser=null] - The authorised user to navigate the pages.
+ * @property {User} [authorizedUser=null] - The authorized user to navigate the pages.
* @property {TextChannel} channel - The channel where to send the embed.
* @property {ClientMessageOptions} [clientMessage=null] - Settings for the message sent by the client.
* @property {Array.<*>} array - An array of elements to paginate.
@@ -82,10 +82,10 @@ base/PaginationEmbed.js
super(options);
/**
- * The authorised user to navigate the pages.
+ * The authorized user to navigate the pages.
* @type {User}
*/
- this.authorisedUser = options.authorisedUser || null;
+ this.authorizedUser = options.authorizedUser || null;
/**
* The channel where to send the embed.
@@ -149,7 +149,7 @@ base/PaginationEmbed.js
/**
* Sets the array of elements to paginate.
* @param {Array} array - An array of elements to paginate.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -162,12 +162,12 @@ base/PaginationEmbed.js
}
/**
- * Set the authorised person to navigate the pages.
- * @param {User} [user=null] - The user object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * Set the authorized person to navigate the pages.
+ * @param {User} user - The user object.
+ * @returns {PaginationEmbed}
*/
- setAuthorisedUser(user = null) {
- this.authorisedUser = user;
+ setAuthorizedUser(user) {
+ this.authorizedUser = user;
return this;
}
@@ -175,7 +175,7 @@ base/PaginationEmbed.js
/**
* The channel where to send the embed.
* @param {TextChannel} channel - The channel object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setChannel(channel) {
this.channel = channel;
@@ -185,11 +185,11 @@ base/PaginationEmbed.js
/**
* Sets the settings for the message sent by the client.
- * @param {Message} [message=null] - The message object sent by the client, if there is any.
+ * @param {Message} message - The message object sent by the client.
* @param {string} [content='Preparing...'] - The custom message content while preparing the embed.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
- setClientMessage(message = null, content = null) {
+ setClientMessage(message, content = null) {
if (!content) content = 'Preparing...';
Object.assign(this.clientMessage, { message, content });
@@ -199,8 +199,8 @@ base/PaginationEmbed.js
/**
* Sets the emojis used for navigation buttons.
- * @param {NavigationButtons} [emojis={}] - An object containing customised emojis to use as navigation buttons.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {NavigationButtons} emojis - An object containing customised emojis to use as navigation buttons.
+ * @returns {PaginationEmbed}
*/
setEmojis(emojis) {
Object.assign(this.emojis, emojis);
@@ -210,10 +210,10 @@ base/PaginationEmbed.js
/**
* Sets to jump to a certain page upon calling PaginationEmbed.build().
- * @param {number|string} [param=1] - The page number to jump to. As String: 'back', 'forward'
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number|string} param - The page number to jump to. As String: 'back', 'forward'
+ * @returns {PaginationEmbed}
*/
- setPage(param = 1) {
+ setPage(param) {
const isString = typeof param === 'string';
if (!(!isNaN(param) || isString)) throw new Error('setPage() only accepts number/string type.');
@@ -229,10 +229,10 @@ base/PaginationEmbed.js
/**
* Sets the time for awaiting a user action before timeout in ms.
- * @param {number} [timeout=30000] Timeout value in ms.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number} timeout Timeout value in ms.
+ * @returns {PaginationEmbed}
*/
- setTimeout(timeout = 30000) {
+ setTimeout(timeout) {
if (typeof timeout !== 'number') throw new Error('setTimeout() only accepts number type.');
this.timeout = timeout;
@@ -242,10 +242,10 @@ base/PaginationEmbed.js
/**
* Sets whether page number indicator on client's message is shown or not.
- * @param {boolean} [boolean=true] - Show page indicator?
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {boolean} boolean - Show page indicator?
+ * @returns {PaginationEmbed}
*/
- showPageIndicator(boolean = true) {
+ showPageIndicator(boolean) {
if (typeof boolean !== 'boolean') throw new Error('showPageIndicator() only accepts boolean type.');
this.pageIndicator = boolean;
@@ -261,7 +261,7 @@ base/PaginationEmbed.js
async _verify(pages) {
this
.setChannel(this.channel)
- .setAuthorisedUser(this.authorisedUser)
+ .setAuthorizedUser(this.authorizedUser)
.setClientMessage(this.clientMessage.message, this.clientMessage.content)
.setArray(this.array)
.showPageIndicator(this.pageIndicator)
@@ -337,8 +337,8 @@ base/PaginationEmbed.js
async _awaitResponse() {
const emojis = Object.values(this.emojis);
const filter = (r, u) => {
- if (this.authorisedUser)
- return u.id === this.authorisedUser.id && emojis.includes(r.emoji.name);
+ if (this.authorizedUser)
+ return u.id === this.authorizedUser.id && emojis.includes(r.emoji.name);
return !u.bot && emojis.includes(r.emoji.name);
};
@@ -432,7 +432,7 @@ base/PaginationEmbed.js
diff --git a/docs/global.html b/docs/global.html
index 23000ba..3f7e34b 100644
--- a/docs/global.html
+++ b/docs/global.html
@@ -22,7 +22,7 @@
@@ -1487,7 +1487,7 @@ Properties:
- authorisedUser
+ authorizedUser
@@ -1517,7 +1517,7 @@ Properties:
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -1820,7 +1820,7 @@ Type:
diff --git a/docs/index.html b/docs/index.html
index 80eb8c4..c53f893 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -22,7 +22,7 @@
@@ -51,20 +51,21 @@ Home
Classes
Returns:
Returns:
-setEmojis(emojisopt) → {PaginationEmbed}
+setEmojis(emojis) → {PaginationEmbed}
@@ -3517,12 +3477,8 @@Parameters:
Parameters:
-- - - - -
{}
-
- Parameters:
Returns:
--
@@ -3614,7 +3550,7 @@
Returns:
-setFooter(text, iconURLopt) → {Embeds}
+setFooter(text, iconURLopt) → {PaginationEmbed}
@@ -3626,7 +3562,7 @@setFooterSource:
Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3810,7 +3742,7 @@ Returns:
Returns:
- setImage(image) → {Embeds}
+ setImage(image) → {PaginationEmbed}
@@ -3836,7 +3768,7 @@ setImageSource:
Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3965,7 +3893,7 @@ Returns:
Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -4062,12 +3990,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -4094,23 +4018,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -4136,10 +4044,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -4162,7 +4066,7 @@ Returns:
- setThumbnail(thumbnail) → {Embeds}
+ setThumbnail(thumbnail) → {PaginationEmbed}
@@ -4174,7 +4078,7 @@ setThumbn
Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4303,7 +4203,7 @@ Returns:
Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -4400,12 +4300,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -4429,23 +4325,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -4471,10 +4351,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -4497,7 +4373,7 @@ Returns:
- setTimestamp() → {Embeds}
+ setTimestamp() → {PaginationEmbed}
@@ -4509,7 +4385,7 @@ setTimest
setTimest
Returns:
-
- - Instance of Embeds
-
-
@@ -4589,7 +4461,7 @@ Returns:
Returns:
- setTitle(title) → {Embeds}
+ setTitle(title) → {PaginationEmbed}
@@ -4615,7 +4487,7 @@ setTitleSource:
Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4744,7 +4612,7 @@ Returns:
Returns:
- setURL(url) → {Embeds}
+ setURL(url) → {PaginationEmbed}
@@ -4770,7 +4638,7 @@ setURLSource:
Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4899,7 +4763,7 @@ Returns:
Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -4996,12 +4860,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -5025,23 +4885,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- true
-
-
Show page indicator?
@@ -5067,10 +4911,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -5106,7 +4946,7 @@ Returns:
diff --git a/docs/Embeds.js.html b/docs/Embeds.js.html
index 637f285..ba6e1c4 100644
--- a/docs/Embeds.js.html
+++ b/docs/Embeds.js.html
@@ -22,7 +22,7 @@
@@ -111,6 +111,7 @@ Embeds.js
/**
* The thumbnail of all embeds.
+ * @type {string}
*/
this.thumbnail = options.thumbnail || null;
@@ -135,7 +136,7 @@ Embeds.js
/**
* Embed in the current page.
- * @returns {MessageEmbed} - An instance of MessageEmbed.
+ * @type {MessageEmbed}
*/
get currentEmbed() {
return this.array[this.page - 1];
@@ -144,7 +145,7 @@ Embeds.js
/**
* Adds a blank field to the fields of all embeds.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addBlankField(inline = false) {
const arr = this.array;
@@ -160,7 +161,7 @@ Embeds.js
* @param {string} name - The name of the field.
* @param {string} value - The value of the field.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addField(name, value, inline = false) {
if (!name && !value) return this;
@@ -179,12 +180,12 @@ Embeds.js
* @example
*
* // Object as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -208,12 +209,12 @@ Embeds.js
* @example
*
* // Methods as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -269,7 +270,7 @@ Embeds.js
/**
* Sets the array of embeds to paginate.
* @param {Array} array - An array of embeds to paginate.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -290,7 +291,7 @@ Embeds.js
* @param {StringResolvable} name - The name of the author.
* @param {string} [iconURL=null] - The icon URL of the author.
* @param {string} [url=null] - The URL of the author.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setAuthor(name, iconURL = null, url = null) {
if (!name) return this;
@@ -306,7 +307,7 @@ Embeds.js
/**
* Sets the color of all embeds.
* @param {ColorResolvable} color - The color of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setColor(color) {
if (!color) return this;
@@ -322,7 +323,7 @@ Embeds.js
/**
* Sets the description of all embeds.
* @param {string} description - The description of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setDescription(description) {
if (!description) return this;
@@ -339,7 +340,7 @@ Embeds.js
* Sets the footer of all embeds.
* @param {string} text - The footer text.
* @param {string} [iconURL=null] - URL for the footer's icon.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setFooter(text, iconURL = null) {
if (!text) return this;
@@ -355,7 +356,7 @@ Embeds.js
/**
* Sets the image of all embeds.
* @param {string} image - The image of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setImage(image) {
if (!image) return this;
@@ -371,7 +372,7 @@ Embeds.js
/**
* Sets the thumbnail of all embeds.
* @param {string} thumbnail - The thumbnail of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setThumbnail(thumbnail) {
if (!thumbnail) return this;
@@ -386,7 +387,7 @@ Embeds.js
/**
* Sets the timestamp of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTimestamp() {
const arr = this.array;
@@ -400,7 +401,7 @@ Embeds.js
/**
* Sets the title of all embeds.
* @param {string} title - The title of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTitle(title) {
if (!title) return this;
@@ -416,7 +417,7 @@ Embeds.js
/**
* Sets the URL of all embeds.
* @param {string} url - The URL of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setURL(url) {
if (!url) return this;
@@ -455,7 +456,7 @@ Embeds.js
diff --git a/docs/FieldsEmbed.html b/docs/FieldsEmbed.html
index 948c77a..e3a7000 100644
--- a/docs/FieldsEmbed.html
+++ b/docs/FieldsEmbed.html
@@ -22,7 +22,7 @@
@@ -304,7 +304,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -326,7 +326,7 @@ authori
authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -538,7 +538,7 @@ Type:
-elementList
+elementList :Array.<*>
@@ -594,6 +594,16 @@ elementLis
+ Type:
+
+
+
@@ -1063,9 +1073,9 @@ (async) buildExamples
- // Object as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed({
authorisedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
+ // Object as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed({
authorizedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
- // Methods as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed()
.setAuthorisedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
+ // Methods as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed()
.setAuthorizedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
@@ -1089,7 +1099,7 @@ Examples
- formatField(name, value, inlineopt) → {FieldsEmbed}
+ formatField(name, value, inlineopt) → {PaginationEmbed}
@@ -1308,10 +1318,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -1320,7 +1326,7 @@ Returns:
Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1494,7 +1496,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1517,7 +1519,7 @@ setA
setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1577,12 +1579,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1606,23 +1604,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1648,10 +1630,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1808,10 +1786,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1834,7 +1808,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1948,8 +1922,6 @@ Parameters:
- <optional>
-
@@ -1960,12 +1932,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -2027,10 +1997,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2053,7 +2019,7 @@ Returns:
- setElementsPerPage(numberopt) → {FieldsEmbed}
+ setElementsPerPage(number) → {PaginationEmbed}
@@ -2131,12 +2097,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2160,24 +2122,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 10
-
-
-
Maximum number of elements to be displayed per page.
@@ -2202,10 +2148,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -2214,7 +2156,7 @@ Returns:
Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -2311,12 +2253,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2340,23 +2278,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -2382,10 +2304,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2408,7 +2326,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -2491,12 +2409,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2523,24 +2437,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 1
-
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -2565,10 +2463,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2591,7 +2485,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -2674,12 +2568,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2703,23 +2593,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2745,10 +2619,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2771,7 +2641,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2854,12 +2724,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2883,24 +2749,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2925,10 +2775,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2964,7 +2810,7 @@ Returns:
diff --git a/docs/FieldsEmbed.js.html b/docs/FieldsEmbed.js.html
index 5d36097..9bad270 100644
--- a/docs/FieldsEmbed.js.html
+++ b/docs/FieldsEmbed.js.html
@@ -22,7 +22,7 @@
@@ -81,7 +81,7 @@ FieldsEmbed.js
/**
* Elements in the current page.
- * @returns {Array.<*>} - An array for a page.
+ * @type {Array.<*>}
*/
get elementList() {
const begin = (this.page - 1) * this.elementsPerPage;
@@ -96,11 +96,11 @@ FieldsEmbed.js
* @example
*
* // Object as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -126,11 +126,11 @@ FieldsEmbed.js
* @example
*
* // Methods as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -185,7 +185,7 @@ FieldsEmbed.js
* @param {string} name - Name of the field.
* @param {Function} value - Value of the field. Function for Array.prototype.map().join('\n').
* @param {boolean} [inline=true] - Whether the field is inline with other field or not.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @returns {PaginationEmbed}
*/
formatField(name, value, inline = true) {
this.fields.push({ name, value, inline });
@@ -195,10 +195,10 @@ FieldsEmbed.js
/**
* Sets the maximum number of elements to be displayed per page.
- * @param {number} [number=10] - Maximum number of elements to be displayed per page.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @param {number} number - Maximum number of elements to be displayed per page.
+ * @returns {PaginationEmbed}
*/
- setElementsPerPage(number = 10) {
+ setElementsPerPage(number) {
if (typeof number !== 'number') throw new Error('setElementsPerPage() only accepts number type.');
this.elementsPerPage = number;
@@ -266,7 +266,7 @@ FieldsEmbed.js
diff --git a/docs/PaginationEmbed.html b/docs/PaginationEmbed.html
index 58d735a..994485d 100644
--- a/docs/PaginationEmbed.html
+++ b/docs/PaginationEmbed.html
@@ -22,7 +22,7 @@
@@ -299,7 +299,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -350,7 +350,7 @@ authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -951,10 +951,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -977,7 +973,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1029,7 +1025,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1055,12 +1051,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1084,23 +1076,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1126,10 +1102,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1281,10 +1253,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1307,7 +1275,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1416,8 +1384,6 @@ Parameters:
- <optional>
-
@@ -1428,12 +1394,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -1495,10 +1459,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1521,7 +1481,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -1599,12 +1559,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1628,23 +1584,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -1670,10 +1610,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1696,7 +1632,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -1774,12 +1710,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1806,23 +1738,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -1848,10 +1764,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1874,7 +1786,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -1952,12 +1864,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1981,23 +1889,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2023,10 +1915,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2049,7 +1937,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2127,12 +2015,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2156,24 +2040,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2198,10 +2066,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2237,7 +2101,7 @@ Returns:
diff --git a/docs/base_PaginationEmbed.js.html b/docs/base_PaginationEmbed.js.html
index c40af28..e74e322 100644
--- a/docs/base_PaginationEmbed.js.html
+++ b/docs/base_PaginationEmbed.js.html
@@ -22,7 +22,7 @@
@@ -63,7 +63,7 @@ base/PaginationEmbed.js
/**
* Options for the constructor.
* @typedef {Object} PaginationEmbedOptions
- * @property {User} [authorisedUser=null] - The authorised user to navigate the pages.
+ * @property {User} [authorizedUser=null] - The authorized user to navigate the pages.
* @property {TextChannel} channel - The channel where to send the embed.
* @property {ClientMessageOptions} [clientMessage=null] - Settings for the message sent by the client.
* @property {Array.<*>} array - An array of elements to paginate.
@@ -82,10 +82,10 @@ base/PaginationEmbed.js
super(options);
/**
- * The authorised user to navigate the pages.
+ * The authorized user to navigate the pages.
* @type {User}
*/
- this.authorisedUser = options.authorisedUser || null;
+ this.authorizedUser = options.authorizedUser || null;
/**
* The channel where to send the embed.
@@ -149,7 +149,7 @@ base/PaginationEmbed.js
/**
* Sets the array of elements to paginate.
* @param {Array} array - An array of elements to paginate.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -162,12 +162,12 @@ base/PaginationEmbed.js
}
/**
- * Set the authorised person to navigate the pages.
- * @param {User} [user=null] - The user object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * Set the authorized person to navigate the pages.
+ * @param {User} user - The user object.
+ * @returns {PaginationEmbed}
*/
- setAuthorisedUser(user = null) {
- this.authorisedUser = user;
+ setAuthorizedUser(user) {
+ this.authorizedUser = user;
return this;
}
@@ -175,7 +175,7 @@ base/PaginationEmbed.js
/**
* The channel where to send the embed.
* @param {TextChannel} channel - The channel object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setChannel(channel) {
this.channel = channel;
@@ -185,11 +185,11 @@ base/PaginationEmbed.js
/**
* Sets the settings for the message sent by the client.
- * @param {Message} [message=null] - The message object sent by the client, if there is any.
+ * @param {Message} message - The message object sent by the client.
* @param {string} [content='Preparing...'] - The custom message content while preparing the embed.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
- setClientMessage(message = null, content = null) {
+ setClientMessage(message, content = null) {
if (!content) content = 'Preparing...';
Object.assign(this.clientMessage, { message, content });
@@ -199,8 +199,8 @@ base/PaginationEmbed.js
/**
* Sets the emojis used for navigation buttons.
- * @param {NavigationButtons} [emojis={}] - An object containing customised emojis to use as navigation buttons.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {NavigationButtons} emojis - An object containing customised emojis to use as navigation buttons.
+ * @returns {PaginationEmbed}
*/
setEmojis(emojis) {
Object.assign(this.emojis, emojis);
@@ -210,10 +210,10 @@ base/PaginationEmbed.js
/**
* Sets to jump to a certain page upon calling PaginationEmbed.build().
- * @param {number|string} [param=1] - The page number to jump to. As String: 'back', 'forward'
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number|string} param - The page number to jump to. As String: 'back', 'forward'
+ * @returns {PaginationEmbed}
*/
- setPage(param = 1) {
+ setPage(param) {
const isString = typeof param === 'string';
if (!(!isNaN(param) || isString)) throw new Error('setPage() only accepts number/string type.');
@@ -229,10 +229,10 @@ base/PaginationEmbed.js
/**
* Sets the time for awaiting a user action before timeout in ms.
- * @param {number} [timeout=30000] Timeout value in ms.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number} timeout Timeout value in ms.
+ * @returns {PaginationEmbed}
*/
- setTimeout(timeout = 30000) {
+ setTimeout(timeout) {
if (typeof timeout !== 'number') throw new Error('setTimeout() only accepts number type.');
this.timeout = timeout;
@@ -242,10 +242,10 @@ base/PaginationEmbed.js
/**
* Sets whether page number indicator on client's message is shown or not.
- * @param {boolean} [boolean=true] - Show page indicator?
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {boolean} boolean - Show page indicator?
+ * @returns {PaginationEmbed}
*/
- showPageIndicator(boolean = true) {
+ showPageIndicator(boolean) {
if (typeof boolean !== 'boolean') throw new Error('showPageIndicator() only accepts boolean type.');
this.pageIndicator = boolean;
@@ -261,7 +261,7 @@ base/PaginationEmbed.js
async _verify(pages) {
this
.setChannel(this.channel)
- .setAuthorisedUser(this.authorisedUser)
+ .setAuthorizedUser(this.authorizedUser)
.setClientMessage(this.clientMessage.message, this.clientMessage.content)
.setArray(this.array)
.showPageIndicator(this.pageIndicator)
@@ -337,8 +337,8 @@ base/PaginationEmbed.js
async _awaitResponse() {
const emojis = Object.values(this.emojis);
const filter = (r, u) => {
- if (this.authorisedUser)
- return u.id === this.authorisedUser.id && emojis.includes(r.emoji.name);
+ if (this.authorizedUser)
+ return u.id === this.authorizedUser.id && emojis.includes(r.emoji.name);
return !u.bot && emojis.includes(r.emoji.name);
};
@@ -432,7 +432,7 @@ base/PaginationEmbed.js
diff --git a/docs/global.html b/docs/global.html
index 23000ba..3f7e34b 100644
--- a/docs/global.html
+++ b/docs/global.html
@@ -22,7 +22,7 @@
@@ -1487,7 +1487,7 @@ Properties:
- authorisedUser
+ authorizedUser
@@ -1517,7 +1517,7 @@ Properties:
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -1820,7 +1820,7 @@ Type:
diff --git a/docs/index.html b/docs/index.html
index 80eb8c4..c53f893 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -22,7 +22,7 @@
@@ -51,20 +51,21 @@ Home
Classes
Parameters:
Returns:
--
@@ -3810,7 +3742,7 @@
Returns:
Returns:
-setImage(image) → {Embeds}
+setImage(image) → {PaginationEmbed}
@@ -3836,7 +3768,7 @@setImageSource:
Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -3965,7 +3893,7 @@ Returns:
Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -4062,12 +3990,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -4094,23 +4018,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -4136,10 +4044,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -4162,7 +4066,7 @@ Returns:
- setThumbnail(thumbnail) → {Embeds}
+ setThumbnail(thumbnail) → {PaginationEmbed}
@@ -4174,7 +4078,7 @@ setThumbn
Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4303,7 +4203,7 @@ Returns:
Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -4400,12 +4300,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -4429,23 +4325,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -4471,10 +4351,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -4497,7 +4373,7 @@ Returns:
- setTimestamp() → {Embeds}
+ setTimestamp() → {PaginationEmbed}
@@ -4509,7 +4385,7 @@ setTimest
setTimest
Returns:
-
- - Instance of Embeds
-
-
@@ -4589,7 +4461,7 @@ Returns:
Returns:
- setTitle(title) → {Embeds}
+ setTitle(title) → {PaginationEmbed}
@@ -4615,7 +4487,7 @@ setTitleSource:
Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4744,7 +4612,7 @@ Returns:
Returns:
- setURL(url) → {Embeds}
+ setURL(url) → {PaginationEmbed}
@@ -4770,7 +4638,7 @@ setURLSource:
Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4899,7 +4763,7 @@ Returns:
Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -4996,12 +4860,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -5025,23 +4885,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- true
-
-
Show page indicator?
@@ -5067,10 +4911,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -5106,7 +4946,7 @@ Returns:
diff --git a/docs/Embeds.js.html b/docs/Embeds.js.html
index 637f285..ba6e1c4 100644
--- a/docs/Embeds.js.html
+++ b/docs/Embeds.js.html
@@ -22,7 +22,7 @@
@@ -111,6 +111,7 @@ Embeds.js
/**
* The thumbnail of all embeds.
+ * @type {string}
*/
this.thumbnail = options.thumbnail || null;
@@ -135,7 +136,7 @@ Embeds.js
/**
* Embed in the current page.
- * @returns {MessageEmbed} - An instance of MessageEmbed.
+ * @type {MessageEmbed}
*/
get currentEmbed() {
return this.array[this.page - 1];
@@ -144,7 +145,7 @@ Embeds.js
/**
* Adds a blank field to the fields of all embeds.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addBlankField(inline = false) {
const arr = this.array;
@@ -160,7 +161,7 @@ Embeds.js
* @param {string} name - The name of the field.
* @param {string} value - The value of the field.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addField(name, value, inline = false) {
if (!name && !value) return this;
@@ -179,12 +180,12 @@ Embeds.js
* @example
*
* // Object as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -208,12 +209,12 @@ Embeds.js
* @example
*
* // Methods as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -269,7 +270,7 @@ Embeds.js
/**
* Sets the array of embeds to paginate.
* @param {Array} array - An array of embeds to paginate.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -290,7 +291,7 @@ Embeds.js
* @param {StringResolvable} name - The name of the author.
* @param {string} [iconURL=null] - The icon URL of the author.
* @param {string} [url=null] - The URL of the author.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setAuthor(name, iconURL = null, url = null) {
if (!name) return this;
@@ -306,7 +307,7 @@ Embeds.js
/**
* Sets the color of all embeds.
* @param {ColorResolvable} color - The color of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setColor(color) {
if (!color) return this;
@@ -322,7 +323,7 @@ Embeds.js
/**
* Sets the description of all embeds.
* @param {string} description - The description of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setDescription(description) {
if (!description) return this;
@@ -339,7 +340,7 @@ Embeds.js
* Sets the footer of all embeds.
* @param {string} text - The footer text.
* @param {string} [iconURL=null] - URL for the footer's icon.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setFooter(text, iconURL = null) {
if (!text) return this;
@@ -355,7 +356,7 @@ Embeds.js
/**
* Sets the image of all embeds.
* @param {string} image - The image of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setImage(image) {
if (!image) return this;
@@ -371,7 +372,7 @@ Embeds.js
/**
* Sets the thumbnail of all embeds.
* @param {string} thumbnail - The thumbnail of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setThumbnail(thumbnail) {
if (!thumbnail) return this;
@@ -386,7 +387,7 @@ Embeds.js
/**
* Sets the timestamp of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTimestamp() {
const arr = this.array;
@@ -400,7 +401,7 @@ Embeds.js
/**
* Sets the title of all embeds.
* @param {string} title - The title of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTitle(title) {
if (!title) return this;
@@ -416,7 +417,7 @@ Embeds.js
/**
* Sets the URL of all embeds.
* @param {string} url - The URL of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setURL(url) {
if (!url) return this;
@@ -455,7 +456,7 @@ Embeds.js
diff --git a/docs/FieldsEmbed.html b/docs/FieldsEmbed.html
index 948c77a..e3a7000 100644
--- a/docs/FieldsEmbed.html
+++ b/docs/FieldsEmbed.html
@@ -22,7 +22,7 @@
@@ -304,7 +304,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -326,7 +326,7 @@ authori
authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -538,7 +538,7 @@ Type:
-elementList
+elementList :Array.<*>
@@ -594,6 +594,16 @@ elementLis
+ Type:
+
+
+
@@ -1063,9 +1073,9 @@ (async) buildExamples
- // Object as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed({
authorisedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
+ // Object as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed({
authorizedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
- // Methods as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed()
.setAuthorisedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
+ // Methods as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed()
.setAuthorizedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
@@ -1089,7 +1099,7 @@ Examples
- formatField(name, value, inlineopt) → {FieldsEmbed}
+ formatField(name, value, inlineopt) → {PaginationEmbed}
@@ -1308,10 +1318,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -1320,7 +1326,7 @@ Returns:
Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1494,7 +1496,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1517,7 +1519,7 @@ setA
setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1577,12 +1579,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1606,23 +1604,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1648,10 +1630,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1808,10 +1786,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1834,7 +1808,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1948,8 +1922,6 @@ Parameters:
- <optional>
-
@@ -1960,12 +1932,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -2027,10 +1997,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2053,7 +2019,7 @@ Returns:
- setElementsPerPage(numberopt) → {FieldsEmbed}
+ setElementsPerPage(number) → {PaginationEmbed}
@@ -2131,12 +2097,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2160,24 +2122,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 10
-
-
-
Maximum number of elements to be displayed per page.
@@ -2202,10 +2148,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -2214,7 +2156,7 @@ Returns:
Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -2311,12 +2253,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2340,23 +2278,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -2382,10 +2304,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2408,7 +2326,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -2491,12 +2409,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2523,24 +2437,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 1
-
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -2565,10 +2463,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2591,7 +2485,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -2674,12 +2568,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2703,23 +2593,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2745,10 +2619,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2771,7 +2641,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2854,12 +2724,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2883,24 +2749,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2925,10 +2775,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2964,7 +2810,7 @@ Returns:
diff --git a/docs/FieldsEmbed.js.html b/docs/FieldsEmbed.js.html
index 5d36097..9bad270 100644
--- a/docs/FieldsEmbed.js.html
+++ b/docs/FieldsEmbed.js.html
@@ -22,7 +22,7 @@
@@ -81,7 +81,7 @@ FieldsEmbed.js
/**
* Elements in the current page.
- * @returns {Array.<*>} - An array for a page.
+ * @type {Array.<*>}
*/
get elementList() {
const begin = (this.page - 1) * this.elementsPerPage;
@@ -96,11 +96,11 @@ FieldsEmbed.js
* @example
*
* // Object as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -126,11 +126,11 @@ FieldsEmbed.js
* @example
*
* // Methods as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -185,7 +185,7 @@ FieldsEmbed.js
* @param {string} name - Name of the field.
* @param {Function} value - Value of the field. Function for Array.prototype.map().join('\n').
* @param {boolean} [inline=true] - Whether the field is inline with other field or not.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @returns {PaginationEmbed}
*/
formatField(name, value, inline = true) {
this.fields.push({ name, value, inline });
@@ -195,10 +195,10 @@ FieldsEmbed.js
/**
* Sets the maximum number of elements to be displayed per page.
- * @param {number} [number=10] - Maximum number of elements to be displayed per page.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @param {number} number - Maximum number of elements to be displayed per page.
+ * @returns {PaginationEmbed}
*/
- setElementsPerPage(number = 10) {
+ setElementsPerPage(number) {
if (typeof number !== 'number') throw new Error('setElementsPerPage() only accepts number type.');
this.elementsPerPage = number;
@@ -266,7 +266,7 @@ FieldsEmbed.js
diff --git a/docs/PaginationEmbed.html b/docs/PaginationEmbed.html
index 58d735a..994485d 100644
--- a/docs/PaginationEmbed.html
+++ b/docs/PaginationEmbed.html
@@ -22,7 +22,7 @@
@@ -299,7 +299,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -350,7 +350,7 @@ authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -951,10 +951,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -977,7 +973,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1029,7 +1025,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1055,12 +1051,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1084,23 +1076,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1126,10 +1102,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1281,10 +1253,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1307,7 +1275,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1416,8 +1384,6 @@ Parameters:
- <optional>
-
@@ -1428,12 +1394,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -1495,10 +1459,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1521,7 +1481,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -1599,12 +1559,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1628,23 +1584,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -1670,10 +1610,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1696,7 +1632,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -1774,12 +1710,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1806,23 +1738,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -1848,10 +1764,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1874,7 +1786,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -1952,12 +1864,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1981,23 +1889,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2023,10 +1915,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2049,7 +1937,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2127,12 +2015,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2156,24 +2040,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2198,10 +2066,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2237,7 +2101,7 @@ Returns:
diff --git a/docs/base_PaginationEmbed.js.html b/docs/base_PaginationEmbed.js.html
index c40af28..e74e322 100644
--- a/docs/base_PaginationEmbed.js.html
+++ b/docs/base_PaginationEmbed.js.html
@@ -22,7 +22,7 @@
@@ -63,7 +63,7 @@ base/PaginationEmbed.js
/**
* Options for the constructor.
* @typedef {Object} PaginationEmbedOptions
- * @property {User} [authorisedUser=null] - The authorised user to navigate the pages.
+ * @property {User} [authorizedUser=null] - The authorized user to navigate the pages.
* @property {TextChannel} channel - The channel where to send the embed.
* @property {ClientMessageOptions} [clientMessage=null] - Settings for the message sent by the client.
* @property {Array.<*>} array - An array of elements to paginate.
@@ -82,10 +82,10 @@ base/PaginationEmbed.js
super(options);
/**
- * The authorised user to navigate the pages.
+ * The authorized user to navigate the pages.
* @type {User}
*/
- this.authorisedUser = options.authorisedUser || null;
+ this.authorizedUser = options.authorizedUser || null;
/**
* The channel where to send the embed.
@@ -149,7 +149,7 @@ base/PaginationEmbed.js
/**
* Sets the array of elements to paginate.
* @param {Array} array - An array of elements to paginate.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -162,12 +162,12 @@ base/PaginationEmbed.js
}
/**
- * Set the authorised person to navigate the pages.
- * @param {User} [user=null] - The user object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * Set the authorized person to navigate the pages.
+ * @param {User} user - The user object.
+ * @returns {PaginationEmbed}
*/
- setAuthorisedUser(user = null) {
- this.authorisedUser = user;
+ setAuthorizedUser(user) {
+ this.authorizedUser = user;
return this;
}
@@ -175,7 +175,7 @@ base/PaginationEmbed.js
/**
* The channel where to send the embed.
* @param {TextChannel} channel - The channel object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setChannel(channel) {
this.channel = channel;
@@ -185,11 +185,11 @@ base/PaginationEmbed.js
/**
* Sets the settings for the message sent by the client.
- * @param {Message} [message=null] - The message object sent by the client, if there is any.
+ * @param {Message} message - The message object sent by the client.
* @param {string} [content='Preparing...'] - The custom message content while preparing the embed.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
- setClientMessage(message = null, content = null) {
+ setClientMessage(message, content = null) {
if (!content) content = 'Preparing...';
Object.assign(this.clientMessage, { message, content });
@@ -199,8 +199,8 @@ base/PaginationEmbed.js
/**
* Sets the emojis used for navigation buttons.
- * @param {NavigationButtons} [emojis={}] - An object containing customised emojis to use as navigation buttons.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {NavigationButtons} emojis - An object containing customised emojis to use as navigation buttons.
+ * @returns {PaginationEmbed}
*/
setEmojis(emojis) {
Object.assign(this.emojis, emojis);
@@ -210,10 +210,10 @@ base/PaginationEmbed.js
/**
* Sets to jump to a certain page upon calling PaginationEmbed.build().
- * @param {number|string} [param=1] - The page number to jump to. As String: 'back', 'forward'
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number|string} param - The page number to jump to. As String: 'back', 'forward'
+ * @returns {PaginationEmbed}
*/
- setPage(param = 1) {
+ setPage(param) {
const isString = typeof param === 'string';
if (!(!isNaN(param) || isString)) throw new Error('setPage() only accepts number/string type.');
@@ -229,10 +229,10 @@ base/PaginationEmbed.js
/**
* Sets the time for awaiting a user action before timeout in ms.
- * @param {number} [timeout=30000] Timeout value in ms.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number} timeout Timeout value in ms.
+ * @returns {PaginationEmbed}
*/
- setTimeout(timeout = 30000) {
+ setTimeout(timeout) {
if (typeof timeout !== 'number') throw new Error('setTimeout() only accepts number type.');
this.timeout = timeout;
@@ -242,10 +242,10 @@ base/PaginationEmbed.js
/**
* Sets whether page number indicator on client's message is shown or not.
- * @param {boolean} [boolean=true] - Show page indicator?
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {boolean} boolean - Show page indicator?
+ * @returns {PaginationEmbed}
*/
- showPageIndicator(boolean = true) {
+ showPageIndicator(boolean) {
if (typeof boolean !== 'boolean') throw new Error('showPageIndicator() only accepts boolean type.');
this.pageIndicator = boolean;
@@ -261,7 +261,7 @@ base/PaginationEmbed.js
async _verify(pages) {
this
.setChannel(this.channel)
- .setAuthorisedUser(this.authorisedUser)
+ .setAuthorizedUser(this.authorizedUser)
.setClientMessage(this.clientMessage.message, this.clientMessage.content)
.setArray(this.array)
.showPageIndicator(this.pageIndicator)
@@ -337,8 +337,8 @@ base/PaginationEmbed.js
async _awaitResponse() {
const emojis = Object.values(this.emojis);
const filter = (r, u) => {
- if (this.authorisedUser)
- return u.id === this.authorisedUser.id && emojis.includes(r.emoji.name);
+ if (this.authorizedUser)
+ return u.id === this.authorizedUser.id && emojis.includes(r.emoji.name);
return !u.bot && emojis.includes(r.emoji.name);
};
@@ -432,7 +432,7 @@ base/PaginationEmbed.js
diff --git a/docs/global.html b/docs/global.html
index 23000ba..3f7e34b 100644
--- a/docs/global.html
+++ b/docs/global.html
@@ -22,7 +22,7 @@
@@ -1487,7 +1487,7 @@ Properties:
- authorisedUser
+ authorizedUser
@@ -1517,7 +1517,7 @@ Properties:
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -1820,7 +1820,7 @@ Type:
diff --git a/docs/index.html b/docs/index.html
index 80eb8c4..c53f893 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -22,7 +22,7 @@
@@ -51,20 +51,21 @@ Home
Classes
Returns:
Returns:
-setPage(paramopt) → {PaginationEmbed}
+setPage(param) → {PaginationEmbed}
@@ -4062,12 +3990,8 @@Parameters:
Parameters:
-- - - - -
1
-
- Parameters:
Returns:
--
@@ -4162,7 +4066,7 @@
Returns:
-setThumbnail(thumbnail) → {Embeds}
+setThumbnail(thumbnail) → {PaginationEmbed}
@@ -4174,7 +4078,7 @@setThumbn
Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4303,7 +4203,7 @@ Returns:
Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -4400,12 +4300,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -4429,23 +4325,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -4471,10 +4351,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -4497,7 +4373,7 @@ Returns:
- setTimestamp() → {Embeds}
+ setTimestamp() → {PaginationEmbed}
@@ -4509,7 +4385,7 @@ setTimest
setTimest
Returns:
-
- - Instance of Embeds
-
-
@@ -4589,7 +4461,7 @@ Returns:
Returns:
- setTitle(title) → {Embeds}
+ setTitle(title) → {PaginationEmbed}
@@ -4615,7 +4487,7 @@ setTitleSource:
Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4744,7 +4612,7 @@ Returns:
Returns:
- setURL(url) → {Embeds}
+ setURL(url) → {PaginationEmbed}
@@ -4770,7 +4638,7 @@ setURLSource:
Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4899,7 +4763,7 @@ Returns:
Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -4996,12 +4860,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -5025,23 +4885,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- true
-
-
Show page indicator?
@@ -5067,10 +4911,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -5106,7 +4946,7 @@ Returns:
diff --git a/docs/Embeds.js.html b/docs/Embeds.js.html
index 637f285..ba6e1c4 100644
--- a/docs/Embeds.js.html
+++ b/docs/Embeds.js.html
@@ -22,7 +22,7 @@
@@ -111,6 +111,7 @@ Embeds.js
/**
* The thumbnail of all embeds.
+ * @type {string}
*/
this.thumbnail = options.thumbnail || null;
@@ -135,7 +136,7 @@ Embeds.js
/**
* Embed in the current page.
- * @returns {MessageEmbed} - An instance of MessageEmbed.
+ * @type {MessageEmbed}
*/
get currentEmbed() {
return this.array[this.page - 1];
@@ -144,7 +145,7 @@ Embeds.js
/**
* Adds a blank field to the fields of all embeds.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addBlankField(inline = false) {
const arr = this.array;
@@ -160,7 +161,7 @@ Embeds.js
* @param {string} name - The name of the field.
* @param {string} value - The value of the field.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addField(name, value, inline = false) {
if (!name && !value) return this;
@@ -179,12 +180,12 @@ Embeds.js
* @example
*
* // Object as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -208,12 +209,12 @@ Embeds.js
* @example
*
* // Methods as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -269,7 +270,7 @@ Embeds.js
/**
* Sets the array of embeds to paginate.
* @param {Array} array - An array of embeds to paginate.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -290,7 +291,7 @@ Embeds.js
* @param {StringResolvable} name - The name of the author.
* @param {string} [iconURL=null] - The icon URL of the author.
* @param {string} [url=null] - The URL of the author.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setAuthor(name, iconURL = null, url = null) {
if (!name) return this;
@@ -306,7 +307,7 @@ Embeds.js
/**
* Sets the color of all embeds.
* @param {ColorResolvable} color - The color of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setColor(color) {
if (!color) return this;
@@ -322,7 +323,7 @@ Embeds.js
/**
* Sets the description of all embeds.
* @param {string} description - The description of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setDescription(description) {
if (!description) return this;
@@ -339,7 +340,7 @@ Embeds.js
* Sets the footer of all embeds.
* @param {string} text - The footer text.
* @param {string} [iconURL=null] - URL for the footer's icon.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setFooter(text, iconURL = null) {
if (!text) return this;
@@ -355,7 +356,7 @@ Embeds.js
/**
* Sets the image of all embeds.
* @param {string} image - The image of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setImage(image) {
if (!image) return this;
@@ -371,7 +372,7 @@ Embeds.js
/**
* Sets the thumbnail of all embeds.
* @param {string} thumbnail - The thumbnail of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setThumbnail(thumbnail) {
if (!thumbnail) return this;
@@ -386,7 +387,7 @@ Embeds.js
/**
* Sets the timestamp of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTimestamp() {
const arr = this.array;
@@ -400,7 +401,7 @@ Embeds.js
/**
* Sets the title of all embeds.
* @param {string} title - The title of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTitle(title) {
if (!title) return this;
@@ -416,7 +417,7 @@ Embeds.js
/**
* Sets the URL of all embeds.
* @param {string} url - The URL of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setURL(url) {
if (!url) return this;
@@ -455,7 +456,7 @@ Embeds.js
diff --git a/docs/FieldsEmbed.html b/docs/FieldsEmbed.html
index 948c77a..e3a7000 100644
--- a/docs/FieldsEmbed.html
+++ b/docs/FieldsEmbed.html
@@ -22,7 +22,7 @@
@@ -304,7 +304,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -326,7 +326,7 @@ authori
authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -538,7 +538,7 @@ Type:
-elementList
+elementList :Array.<*>
@@ -594,6 +594,16 @@ elementLis
+ Type:
+
+
+
@@ -1063,9 +1073,9 @@ (async) buildExamples
- // Object as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed({
authorisedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
+ // Object as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed({
authorizedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
- // Methods as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed()
.setAuthorisedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
+ // Methods as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed()
.setAuthorizedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
@@ -1089,7 +1099,7 @@ Examples
- formatField(name, value, inlineopt) → {FieldsEmbed}
+ formatField(name, value, inlineopt) → {PaginationEmbed}
@@ -1308,10 +1318,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -1320,7 +1326,7 @@ Returns:
Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1494,7 +1496,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1517,7 +1519,7 @@ setA
setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1577,12 +1579,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1606,23 +1604,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1648,10 +1630,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1808,10 +1786,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1834,7 +1808,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1948,8 +1922,6 @@ Parameters:
- <optional>
-
@@ -1960,12 +1932,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -2027,10 +1997,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2053,7 +2019,7 @@ Returns:
- setElementsPerPage(numberopt) → {FieldsEmbed}
+ setElementsPerPage(number) → {PaginationEmbed}
@@ -2131,12 +2097,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2160,24 +2122,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 10
-
-
-
Maximum number of elements to be displayed per page.
@@ -2202,10 +2148,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -2214,7 +2156,7 @@ Returns:
Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -2311,12 +2253,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2340,23 +2278,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -2382,10 +2304,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2408,7 +2326,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -2491,12 +2409,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2523,24 +2437,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 1
-
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -2565,10 +2463,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2591,7 +2485,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -2674,12 +2568,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2703,23 +2593,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2745,10 +2619,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2771,7 +2641,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2854,12 +2724,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2883,24 +2749,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2925,10 +2775,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2964,7 +2810,7 @@ Returns:
diff --git a/docs/FieldsEmbed.js.html b/docs/FieldsEmbed.js.html
index 5d36097..9bad270 100644
--- a/docs/FieldsEmbed.js.html
+++ b/docs/FieldsEmbed.js.html
@@ -22,7 +22,7 @@
@@ -81,7 +81,7 @@ FieldsEmbed.js
/**
* Elements in the current page.
- * @returns {Array.<*>} - An array for a page.
+ * @type {Array.<*>}
*/
get elementList() {
const begin = (this.page - 1) * this.elementsPerPage;
@@ -96,11 +96,11 @@ FieldsEmbed.js
* @example
*
* // Object as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -126,11 +126,11 @@ FieldsEmbed.js
* @example
*
* // Methods as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -185,7 +185,7 @@ FieldsEmbed.js
* @param {string} name - Name of the field.
* @param {Function} value - Value of the field. Function for Array.prototype.map().join('\n').
* @param {boolean} [inline=true] - Whether the field is inline with other field or not.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @returns {PaginationEmbed}
*/
formatField(name, value, inline = true) {
this.fields.push({ name, value, inline });
@@ -195,10 +195,10 @@ FieldsEmbed.js
/**
* Sets the maximum number of elements to be displayed per page.
- * @param {number} [number=10] - Maximum number of elements to be displayed per page.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @param {number} number - Maximum number of elements to be displayed per page.
+ * @returns {PaginationEmbed}
*/
- setElementsPerPage(number = 10) {
+ setElementsPerPage(number) {
if (typeof number !== 'number') throw new Error('setElementsPerPage() only accepts number type.');
this.elementsPerPage = number;
@@ -266,7 +266,7 @@ FieldsEmbed.js
diff --git a/docs/PaginationEmbed.html b/docs/PaginationEmbed.html
index 58d735a..994485d 100644
--- a/docs/PaginationEmbed.html
+++ b/docs/PaginationEmbed.html
@@ -22,7 +22,7 @@
@@ -299,7 +299,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -350,7 +350,7 @@ authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -951,10 +951,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -977,7 +973,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1029,7 +1025,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1055,12 +1051,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1084,23 +1076,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1126,10 +1102,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1281,10 +1253,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1307,7 +1275,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1416,8 +1384,6 @@ Parameters:
- <optional>
-
@@ -1428,12 +1394,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -1495,10 +1459,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1521,7 +1481,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -1599,12 +1559,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1628,23 +1584,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -1670,10 +1610,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1696,7 +1632,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -1774,12 +1710,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1806,23 +1738,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -1848,10 +1764,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1874,7 +1786,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -1952,12 +1864,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1981,23 +1889,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2023,10 +1915,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2049,7 +1937,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2127,12 +2015,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2156,24 +2040,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2198,10 +2066,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2237,7 +2101,7 @@ Returns:
diff --git a/docs/base_PaginationEmbed.js.html b/docs/base_PaginationEmbed.js.html
index c40af28..e74e322 100644
--- a/docs/base_PaginationEmbed.js.html
+++ b/docs/base_PaginationEmbed.js.html
@@ -22,7 +22,7 @@
@@ -63,7 +63,7 @@ base/PaginationEmbed.js
/**
* Options for the constructor.
* @typedef {Object} PaginationEmbedOptions
- * @property {User} [authorisedUser=null] - The authorised user to navigate the pages.
+ * @property {User} [authorizedUser=null] - The authorized user to navigate the pages.
* @property {TextChannel} channel - The channel where to send the embed.
* @property {ClientMessageOptions} [clientMessage=null] - Settings for the message sent by the client.
* @property {Array.<*>} array - An array of elements to paginate.
@@ -82,10 +82,10 @@ base/PaginationEmbed.js
super(options);
/**
- * The authorised user to navigate the pages.
+ * The authorized user to navigate the pages.
* @type {User}
*/
- this.authorisedUser = options.authorisedUser || null;
+ this.authorizedUser = options.authorizedUser || null;
/**
* The channel where to send the embed.
@@ -149,7 +149,7 @@ base/PaginationEmbed.js
/**
* Sets the array of elements to paginate.
* @param {Array} array - An array of elements to paginate.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -162,12 +162,12 @@ base/PaginationEmbed.js
}
/**
- * Set the authorised person to navigate the pages.
- * @param {User} [user=null] - The user object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * Set the authorized person to navigate the pages.
+ * @param {User} user - The user object.
+ * @returns {PaginationEmbed}
*/
- setAuthorisedUser(user = null) {
- this.authorisedUser = user;
+ setAuthorizedUser(user) {
+ this.authorizedUser = user;
return this;
}
@@ -175,7 +175,7 @@ base/PaginationEmbed.js
/**
* The channel where to send the embed.
* @param {TextChannel} channel - The channel object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setChannel(channel) {
this.channel = channel;
@@ -185,11 +185,11 @@ base/PaginationEmbed.js
/**
* Sets the settings for the message sent by the client.
- * @param {Message} [message=null] - The message object sent by the client, if there is any.
+ * @param {Message} message - The message object sent by the client.
* @param {string} [content='Preparing...'] - The custom message content while preparing the embed.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
- setClientMessage(message = null, content = null) {
+ setClientMessage(message, content = null) {
if (!content) content = 'Preparing...';
Object.assign(this.clientMessage, { message, content });
@@ -199,8 +199,8 @@ base/PaginationEmbed.js
/**
* Sets the emojis used for navigation buttons.
- * @param {NavigationButtons} [emojis={}] - An object containing customised emojis to use as navigation buttons.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {NavigationButtons} emojis - An object containing customised emojis to use as navigation buttons.
+ * @returns {PaginationEmbed}
*/
setEmojis(emojis) {
Object.assign(this.emojis, emojis);
@@ -210,10 +210,10 @@ base/PaginationEmbed.js
/**
* Sets to jump to a certain page upon calling PaginationEmbed.build().
- * @param {number|string} [param=1] - The page number to jump to. As String: 'back', 'forward'
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number|string} param - The page number to jump to. As String: 'back', 'forward'
+ * @returns {PaginationEmbed}
*/
- setPage(param = 1) {
+ setPage(param) {
const isString = typeof param === 'string';
if (!(!isNaN(param) || isString)) throw new Error('setPage() only accepts number/string type.');
@@ -229,10 +229,10 @@ base/PaginationEmbed.js
/**
* Sets the time for awaiting a user action before timeout in ms.
- * @param {number} [timeout=30000] Timeout value in ms.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number} timeout Timeout value in ms.
+ * @returns {PaginationEmbed}
*/
- setTimeout(timeout = 30000) {
+ setTimeout(timeout) {
if (typeof timeout !== 'number') throw new Error('setTimeout() only accepts number type.');
this.timeout = timeout;
@@ -242,10 +242,10 @@ base/PaginationEmbed.js
/**
* Sets whether page number indicator on client's message is shown or not.
- * @param {boolean} [boolean=true] - Show page indicator?
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {boolean} boolean - Show page indicator?
+ * @returns {PaginationEmbed}
*/
- showPageIndicator(boolean = true) {
+ showPageIndicator(boolean) {
if (typeof boolean !== 'boolean') throw new Error('showPageIndicator() only accepts boolean type.');
this.pageIndicator = boolean;
@@ -261,7 +261,7 @@ base/PaginationEmbed.js
async _verify(pages) {
this
.setChannel(this.channel)
- .setAuthorisedUser(this.authorisedUser)
+ .setAuthorizedUser(this.authorizedUser)
.setClientMessage(this.clientMessage.message, this.clientMessage.content)
.setArray(this.array)
.showPageIndicator(this.pageIndicator)
@@ -337,8 +337,8 @@ base/PaginationEmbed.js
async _awaitResponse() {
const emojis = Object.values(this.emojis);
const filter = (r, u) => {
- if (this.authorisedUser)
- return u.id === this.authorisedUser.id && emojis.includes(r.emoji.name);
+ if (this.authorizedUser)
+ return u.id === this.authorizedUser.id && emojis.includes(r.emoji.name);
return !u.bot && emojis.includes(r.emoji.name);
};
@@ -432,7 +432,7 @@ base/PaginationEmbed.js
diff --git a/docs/global.html b/docs/global.html
index 23000ba..3f7e34b 100644
--- a/docs/global.html
+++ b/docs/global.html
@@ -22,7 +22,7 @@
@@ -1487,7 +1487,7 @@ Properties:
- authorisedUser
+ authorizedUser
@@ -1517,7 +1517,7 @@ Properties:
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -1820,7 +1820,7 @@ Type:
diff --git a/docs/index.html b/docs/index.html
index 80eb8c4..c53f893 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -22,7 +22,7 @@
@@ -51,20 +51,21 @@ Home
Classes
Returns:
Returns:
-setTimeout(timeoutopt) → {PaginationEmbed}
+setTimeout(timeout) → {PaginationEmbed}
@@ -4400,12 +4300,8 @@Parameters:
Parameters:
-- - - - -
30000
-
- Parameters:
Returns:
--
@@ -4497,7 +4373,7 @@
Returns:
-setTimestamp() → {Embeds}
+setTimestamp() → {PaginationEmbed}
@@ -4509,7 +4385,7 @@setTimest
setTimest
Returns:
-
- - Instance of Embeds
-
-
@@ -4589,7 +4461,7 @@ Returns:
Returns:
- setTitle(title) → {Embeds}
+ setTitle(title) → {PaginationEmbed}
@@ -4615,7 +4487,7 @@ setTitleSource:
Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4744,7 +4612,7 @@ Returns:
Returns:
- setURL(url) → {Embeds}
+ setURL(url) → {PaginationEmbed}
@@ -4770,7 +4638,7 @@ setURLSource:
Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4899,7 +4763,7 @@ Returns:
Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -4996,12 +4860,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -5025,23 +4885,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- true
-
-
Show page indicator?
@@ -5067,10 +4911,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -5106,7 +4946,7 @@ Returns:
diff --git a/docs/Embeds.js.html b/docs/Embeds.js.html
index 637f285..ba6e1c4 100644
--- a/docs/Embeds.js.html
+++ b/docs/Embeds.js.html
@@ -22,7 +22,7 @@
@@ -111,6 +111,7 @@ Embeds.js
/**
* The thumbnail of all embeds.
+ * @type {string}
*/
this.thumbnail = options.thumbnail || null;
@@ -135,7 +136,7 @@ Embeds.js
/**
* Embed in the current page.
- * @returns {MessageEmbed} - An instance of MessageEmbed.
+ * @type {MessageEmbed}
*/
get currentEmbed() {
return this.array[this.page - 1];
@@ -144,7 +145,7 @@ Embeds.js
/**
* Adds a blank field to the fields of all embeds.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addBlankField(inline = false) {
const arr = this.array;
@@ -160,7 +161,7 @@ Embeds.js
* @param {string} name - The name of the field.
* @param {string} value - The value of the field.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addField(name, value, inline = false) {
if (!name && !value) return this;
@@ -179,12 +180,12 @@ Embeds.js
* @example
*
* // Object as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -208,12 +209,12 @@ Embeds.js
* @example
*
* // Methods as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -269,7 +270,7 @@ Embeds.js
/**
* Sets the array of embeds to paginate.
* @param {Array} array - An array of embeds to paginate.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -290,7 +291,7 @@ Embeds.js
* @param {StringResolvable} name - The name of the author.
* @param {string} [iconURL=null] - The icon URL of the author.
* @param {string} [url=null] - The URL of the author.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setAuthor(name, iconURL = null, url = null) {
if (!name) return this;
@@ -306,7 +307,7 @@ Embeds.js
/**
* Sets the color of all embeds.
* @param {ColorResolvable} color - The color of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setColor(color) {
if (!color) return this;
@@ -322,7 +323,7 @@ Embeds.js
/**
* Sets the description of all embeds.
* @param {string} description - The description of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setDescription(description) {
if (!description) return this;
@@ -339,7 +340,7 @@ Embeds.js
* Sets the footer of all embeds.
* @param {string} text - The footer text.
* @param {string} [iconURL=null] - URL for the footer's icon.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setFooter(text, iconURL = null) {
if (!text) return this;
@@ -355,7 +356,7 @@ Embeds.js
/**
* Sets the image of all embeds.
* @param {string} image - The image of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setImage(image) {
if (!image) return this;
@@ -371,7 +372,7 @@ Embeds.js
/**
* Sets the thumbnail of all embeds.
* @param {string} thumbnail - The thumbnail of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setThumbnail(thumbnail) {
if (!thumbnail) return this;
@@ -386,7 +387,7 @@ Embeds.js
/**
* Sets the timestamp of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTimestamp() {
const arr = this.array;
@@ -400,7 +401,7 @@ Embeds.js
/**
* Sets the title of all embeds.
* @param {string} title - The title of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTitle(title) {
if (!title) return this;
@@ -416,7 +417,7 @@ Embeds.js
/**
* Sets the URL of all embeds.
* @param {string} url - The URL of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setURL(url) {
if (!url) return this;
@@ -455,7 +456,7 @@ Embeds.js
diff --git a/docs/FieldsEmbed.html b/docs/FieldsEmbed.html
index 948c77a..e3a7000 100644
--- a/docs/FieldsEmbed.html
+++ b/docs/FieldsEmbed.html
@@ -22,7 +22,7 @@
@@ -304,7 +304,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -326,7 +326,7 @@ authori
authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -538,7 +538,7 @@ Type:
-elementList
+elementList :Array.<*>
@@ -594,6 +594,16 @@ elementLis
+ Type:
+
+
+
@@ -1063,9 +1073,9 @@ (async) buildExamples
- // Object as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed({
authorisedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
+ // Object as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed({
authorizedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
- // Methods as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed()
.setAuthorisedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
+ // Methods as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed()
.setAuthorizedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
@@ -1089,7 +1099,7 @@ Examples
- formatField(name, value, inlineopt) → {FieldsEmbed}
+ formatField(name, value, inlineopt) → {PaginationEmbed}
@@ -1308,10 +1318,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -1320,7 +1326,7 @@ Returns:
Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1494,7 +1496,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1517,7 +1519,7 @@ setA
setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1577,12 +1579,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1606,23 +1604,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1648,10 +1630,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1808,10 +1786,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1834,7 +1808,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1948,8 +1922,6 @@ Parameters:
- <optional>
-
@@ -1960,12 +1932,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -2027,10 +1997,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2053,7 +2019,7 @@ Returns:
- setElementsPerPage(numberopt) → {FieldsEmbed}
+ setElementsPerPage(number) → {PaginationEmbed}
@@ -2131,12 +2097,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2160,24 +2122,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 10
-
-
-
Maximum number of elements to be displayed per page.
@@ -2202,10 +2148,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -2214,7 +2156,7 @@ Returns:
Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -2311,12 +2253,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2340,23 +2278,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -2382,10 +2304,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2408,7 +2326,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -2491,12 +2409,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2523,24 +2437,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 1
-
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -2565,10 +2463,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2591,7 +2485,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -2674,12 +2568,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2703,23 +2593,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2745,10 +2619,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2771,7 +2641,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2854,12 +2724,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2883,24 +2749,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2925,10 +2775,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2964,7 +2810,7 @@ Returns:
diff --git a/docs/FieldsEmbed.js.html b/docs/FieldsEmbed.js.html
index 5d36097..9bad270 100644
--- a/docs/FieldsEmbed.js.html
+++ b/docs/FieldsEmbed.js.html
@@ -22,7 +22,7 @@
@@ -81,7 +81,7 @@ FieldsEmbed.js
/**
* Elements in the current page.
- * @returns {Array.<*>} - An array for a page.
+ * @type {Array.<*>}
*/
get elementList() {
const begin = (this.page - 1) * this.elementsPerPage;
@@ -96,11 +96,11 @@ FieldsEmbed.js
* @example
*
* // Object as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -126,11 +126,11 @@ FieldsEmbed.js
* @example
*
* // Methods as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -185,7 +185,7 @@ FieldsEmbed.js
* @param {string} name - Name of the field.
* @param {Function} value - Value of the field. Function for Array.prototype.map().join('\n').
* @param {boolean} [inline=true] - Whether the field is inline with other field or not.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @returns {PaginationEmbed}
*/
formatField(name, value, inline = true) {
this.fields.push({ name, value, inline });
@@ -195,10 +195,10 @@ FieldsEmbed.js
/**
* Sets the maximum number of elements to be displayed per page.
- * @param {number} [number=10] - Maximum number of elements to be displayed per page.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @param {number} number - Maximum number of elements to be displayed per page.
+ * @returns {PaginationEmbed}
*/
- setElementsPerPage(number = 10) {
+ setElementsPerPage(number) {
if (typeof number !== 'number') throw new Error('setElementsPerPage() only accepts number type.');
this.elementsPerPage = number;
@@ -266,7 +266,7 @@ FieldsEmbed.js
diff --git a/docs/PaginationEmbed.html b/docs/PaginationEmbed.html
index 58d735a..994485d 100644
--- a/docs/PaginationEmbed.html
+++ b/docs/PaginationEmbed.html
@@ -22,7 +22,7 @@
@@ -299,7 +299,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -350,7 +350,7 @@ authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -951,10 +951,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -977,7 +973,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1029,7 +1025,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1055,12 +1051,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1084,23 +1076,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1126,10 +1102,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1281,10 +1253,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1307,7 +1275,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1416,8 +1384,6 @@ Parameters:
- <optional>
-
@@ -1428,12 +1394,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -1495,10 +1459,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1521,7 +1481,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -1599,12 +1559,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1628,23 +1584,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -1670,10 +1610,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1696,7 +1632,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -1774,12 +1710,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1806,23 +1738,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -1848,10 +1764,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1874,7 +1786,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -1952,12 +1864,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1981,23 +1889,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2023,10 +1915,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2049,7 +1937,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2127,12 +2015,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2156,24 +2040,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2198,10 +2066,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2237,7 +2101,7 @@ Returns:
diff --git a/docs/base_PaginationEmbed.js.html b/docs/base_PaginationEmbed.js.html
index c40af28..e74e322 100644
--- a/docs/base_PaginationEmbed.js.html
+++ b/docs/base_PaginationEmbed.js.html
@@ -22,7 +22,7 @@
@@ -63,7 +63,7 @@ base/PaginationEmbed.js
/**
* Options for the constructor.
* @typedef {Object} PaginationEmbedOptions
- * @property {User} [authorisedUser=null] - The authorised user to navigate the pages.
+ * @property {User} [authorizedUser=null] - The authorized user to navigate the pages.
* @property {TextChannel} channel - The channel where to send the embed.
* @property {ClientMessageOptions} [clientMessage=null] - Settings for the message sent by the client.
* @property {Array.<*>} array - An array of elements to paginate.
@@ -82,10 +82,10 @@ base/PaginationEmbed.js
super(options);
/**
- * The authorised user to navigate the pages.
+ * The authorized user to navigate the pages.
* @type {User}
*/
- this.authorisedUser = options.authorisedUser || null;
+ this.authorizedUser = options.authorizedUser || null;
/**
* The channel where to send the embed.
@@ -149,7 +149,7 @@ base/PaginationEmbed.js
/**
* Sets the array of elements to paginate.
* @param {Array} array - An array of elements to paginate.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -162,12 +162,12 @@ base/PaginationEmbed.js
}
/**
- * Set the authorised person to navigate the pages.
- * @param {User} [user=null] - The user object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * Set the authorized person to navigate the pages.
+ * @param {User} user - The user object.
+ * @returns {PaginationEmbed}
*/
- setAuthorisedUser(user = null) {
- this.authorisedUser = user;
+ setAuthorizedUser(user) {
+ this.authorizedUser = user;
return this;
}
@@ -175,7 +175,7 @@ base/PaginationEmbed.js
/**
* The channel where to send the embed.
* @param {TextChannel} channel - The channel object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setChannel(channel) {
this.channel = channel;
@@ -185,11 +185,11 @@ base/PaginationEmbed.js
/**
* Sets the settings for the message sent by the client.
- * @param {Message} [message=null] - The message object sent by the client, if there is any.
+ * @param {Message} message - The message object sent by the client.
* @param {string} [content='Preparing...'] - The custom message content while preparing the embed.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
- setClientMessage(message = null, content = null) {
+ setClientMessage(message, content = null) {
if (!content) content = 'Preparing...';
Object.assign(this.clientMessage, { message, content });
@@ -199,8 +199,8 @@ base/PaginationEmbed.js
/**
* Sets the emojis used for navigation buttons.
- * @param {NavigationButtons} [emojis={}] - An object containing customised emojis to use as navigation buttons.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {NavigationButtons} emojis - An object containing customised emojis to use as navigation buttons.
+ * @returns {PaginationEmbed}
*/
setEmojis(emojis) {
Object.assign(this.emojis, emojis);
@@ -210,10 +210,10 @@ base/PaginationEmbed.js
/**
* Sets to jump to a certain page upon calling PaginationEmbed.build().
- * @param {number|string} [param=1] - The page number to jump to. As String: 'back', 'forward'
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number|string} param - The page number to jump to. As String: 'back', 'forward'
+ * @returns {PaginationEmbed}
*/
- setPage(param = 1) {
+ setPage(param) {
const isString = typeof param === 'string';
if (!(!isNaN(param) || isString)) throw new Error('setPage() only accepts number/string type.');
@@ -229,10 +229,10 @@ base/PaginationEmbed.js
/**
* Sets the time for awaiting a user action before timeout in ms.
- * @param {number} [timeout=30000] Timeout value in ms.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number} timeout Timeout value in ms.
+ * @returns {PaginationEmbed}
*/
- setTimeout(timeout = 30000) {
+ setTimeout(timeout) {
if (typeof timeout !== 'number') throw new Error('setTimeout() only accepts number type.');
this.timeout = timeout;
@@ -242,10 +242,10 @@ base/PaginationEmbed.js
/**
* Sets whether page number indicator on client's message is shown or not.
- * @param {boolean} [boolean=true] - Show page indicator?
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {boolean} boolean - Show page indicator?
+ * @returns {PaginationEmbed}
*/
- showPageIndicator(boolean = true) {
+ showPageIndicator(boolean) {
if (typeof boolean !== 'boolean') throw new Error('showPageIndicator() only accepts boolean type.');
this.pageIndicator = boolean;
@@ -261,7 +261,7 @@ base/PaginationEmbed.js
async _verify(pages) {
this
.setChannel(this.channel)
- .setAuthorisedUser(this.authorisedUser)
+ .setAuthorizedUser(this.authorizedUser)
.setClientMessage(this.clientMessage.message, this.clientMessage.content)
.setArray(this.array)
.showPageIndicator(this.pageIndicator)
@@ -337,8 +337,8 @@ base/PaginationEmbed.js
async _awaitResponse() {
const emojis = Object.values(this.emojis);
const filter = (r, u) => {
- if (this.authorisedUser)
- return u.id === this.authorisedUser.id && emojis.includes(r.emoji.name);
+ if (this.authorizedUser)
+ return u.id === this.authorizedUser.id && emojis.includes(r.emoji.name);
return !u.bot && emojis.includes(r.emoji.name);
};
@@ -432,7 +432,7 @@ base/PaginationEmbed.js
diff --git a/docs/global.html b/docs/global.html
index 23000ba..3f7e34b 100644
--- a/docs/global.html
+++ b/docs/global.html
@@ -22,7 +22,7 @@
@@ -1487,7 +1487,7 @@ Properties:
- authorisedUser
+ authorizedUser
@@ -1517,7 +1517,7 @@ Properties:
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -1820,7 +1820,7 @@ Type:
diff --git a/docs/index.html b/docs/index.html
index 80eb8c4..c53f893 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -22,7 +22,7 @@
@@ -51,20 +51,21 @@ Home
Classes
Returns:
--
@@ -4589,7 +4461,7 @@
Returns:
Returns:
-setTitle(title) → {Embeds}
+setTitle(title) → {PaginationEmbed}
@@ -4615,7 +4487,7 @@setTitleSource:
Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4744,7 +4612,7 @@ Returns:
Returns:
- setURL(url) → {Embeds}
+ setURL(url) → {PaginationEmbed}
@@ -4770,7 +4638,7 @@ setURLSource:
Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4899,7 +4763,7 @@ Returns:
Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -4996,12 +4860,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -5025,23 +4885,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- true
-
-
Show page indicator?
@@ -5067,10 +4911,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -5106,7 +4946,7 @@ Returns:
diff --git a/docs/Embeds.js.html b/docs/Embeds.js.html
index 637f285..ba6e1c4 100644
--- a/docs/Embeds.js.html
+++ b/docs/Embeds.js.html
@@ -22,7 +22,7 @@
@@ -111,6 +111,7 @@ Embeds.js
/**
* The thumbnail of all embeds.
+ * @type {string}
*/
this.thumbnail = options.thumbnail || null;
@@ -135,7 +136,7 @@ Embeds.js
/**
* Embed in the current page.
- * @returns {MessageEmbed} - An instance of MessageEmbed.
+ * @type {MessageEmbed}
*/
get currentEmbed() {
return this.array[this.page - 1];
@@ -144,7 +145,7 @@ Embeds.js
/**
* Adds a blank field to the fields of all embeds.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addBlankField(inline = false) {
const arr = this.array;
@@ -160,7 +161,7 @@ Embeds.js
* @param {string} name - The name of the field.
* @param {string} value - The value of the field.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addField(name, value, inline = false) {
if (!name && !value) return this;
@@ -179,12 +180,12 @@ Embeds.js
* @example
*
* // Object as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -208,12 +209,12 @@ Embeds.js
* @example
*
* // Methods as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -269,7 +270,7 @@ Embeds.js
/**
* Sets the array of embeds to paginate.
* @param {Array} array - An array of embeds to paginate.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -290,7 +291,7 @@ Embeds.js
* @param {StringResolvable} name - The name of the author.
* @param {string} [iconURL=null] - The icon URL of the author.
* @param {string} [url=null] - The URL of the author.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setAuthor(name, iconURL = null, url = null) {
if (!name) return this;
@@ -306,7 +307,7 @@ Embeds.js
/**
* Sets the color of all embeds.
* @param {ColorResolvable} color - The color of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setColor(color) {
if (!color) return this;
@@ -322,7 +323,7 @@ Embeds.js
/**
* Sets the description of all embeds.
* @param {string} description - The description of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setDescription(description) {
if (!description) return this;
@@ -339,7 +340,7 @@ Embeds.js
* Sets the footer of all embeds.
* @param {string} text - The footer text.
* @param {string} [iconURL=null] - URL for the footer's icon.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setFooter(text, iconURL = null) {
if (!text) return this;
@@ -355,7 +356,7 @@ Embeds.js
/**
* Sets the image of all embeds.
* @param {string} image - The image of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setImage(image) {
if (!image) return this;
@@ -371,7 +372,7 @@ Embeds.js
/**
* Sets the thumbnail of all embeds.
* @param {string} thumbnail - The thumbnail of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setThumbnail(thumbnail) {
if (!thumbnail) return this;
@@ -386,7 +387,7 @@ Embeds.js
/**
* Sets the timestamp of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTimestamp() {
const arr = this.array;
@@ -400,7 +401,7 @@ Embeds.js
/**
* Sets the title of all embeds.
* @param {string} title - The title of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTitle(title) {
if (!title) return this;
@@ -416,7 +417,7 @@ Embeds.js
/**
* Sets the URL of all embeds.
* @param {string} url - The URL of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setURL(url) {
if (!url) return this;
@@ -455,7 +456,7 @@ Embeds.js
diff --git a/docs/FieldsEmbed.html b/docs/FieldsEmbed.html
index 948c77a..e3a7000 100644
--- a/docs/FieldsEmbed.html
+++ b/docs/FieldsEmbed.html
@@ -22,7 +22,7 @@
@@ -304,7 +304,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -326,7 +326,7 @@ authori
authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -538,7 +538,7 @@ Type:
-elementList
+elementList :Array.<*>
@@ -594,6 +594,16 @@ elementLis
+ Type:
+
+
+
@@ -1063,9 +1073,9 @@ (async) buildExamples
- // Object as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed({
authorisedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
+ // Object as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed({
authorizedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
- // Methods as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed()
.setAuthorisedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
+ // Methods as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed()
.setAuthorizedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
@@ -1089,7 +1099,7 @@ Examples
- formatField(name, value, inlineopt) → {FieldsEmbed}
+ formatField(name, value, inlineopt) → {PaginationEmbed}
@@ -1308,10 +1318,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -1320,7 +1326,7 @@ Returns:
Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1494,7 +1496,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1517,7 +1519,7 @@ setA
setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1577,12 +1579,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1606,23 +1604,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1648,10 +1630,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1808,10 +1786,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1834,7 +1808,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1948,8 +1922,6 @@ Parameters:
- <optional>
-
@@ -1960,12 +1932,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -2027,10 +1997,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2053,7 +2019,7 @@ Returns:
- setElementsPerPage(numberopt) → {FieldsEmbed}
+ setElementsPerPage(number) → {PaginationEmbed}
@@ -2131,12 +2097,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2160,24 +2122,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 10
-
-
-
Maximum number of elements to be displayed per page.
@@ -2202,10 +2148,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -2214,7 +2156,7 @@ Returns:
Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -2311,12 +2253,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2340,23 +2278,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -2382,10 +2304,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2408,7 +2326,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -2491,12 +2409,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2523,24 +2437,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 1
-
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -2565,10 +2463,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2591,7 +2485,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -2674,12 +2568,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2703,23 +2593,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2745,10 +2619,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2771,7 +2641,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2854,12 +2724,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2883,24 +2749,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2925,10 +2775,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2964,7 +2810,7 @@ Returns:
diff --git a/docs/FieldsEmbed.js.html b/docs/FieldsEmbed.js.html
index 5d36097..9bad270 100644
--- a/docs/FieldsEmbed.js.html
+++ b/docs/FieldsEmbed.js.html
@@ -22,7 +22,7 @@
@@ -81,7 +81,7 @@ FieldsEmbed.js
/**
* Elements in the current page.
- * @returns {Array.<*>} - An array for a page.
+ * @type {Array.<*>}
*/
get elementList() {
const begin = (this.page - 1) * this.elementsPerPage;
@@ -96,11 +96,11 @@ FieldsEmbed.js
* @example
*
* // Object as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -126,11 +126,11 @@ FieldsEmbed.js
* @example
*
* // Methods as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -185,7 +185,7 @@ FieldsEmbed.js
* @param {string} name - Name of the field.
* @param {Function} value - Value of the field. Function for Array.prototype.map().join('\n').
* @param {boolean} [inline=true] - Whether the field is inline with other field or not.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @returns {PaginationEmbed}
*/
formatField(name, value, inline = true) {
this.fields.push({ name, value, inline });
@@ -195,10 +195,10 @@ FieldsEmbed.js
/**
* Sets the maximum number of elements to be displayed per page.
- * @param {number} [number=10] - Maximum number of elements to be displayed per page.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @param {number} number - Maximum number of elements to be displayed per page.
+ * @returns {PaginationEmbed}
*/
- setElementsPerPage(number = 10) {
+ setElementsPerPage(number) {
if (typeof number !== 'number') throw new Error('setElementsPerPage() only accepts number type.');
this.elementsPerPage = number;
@@ -266,7 +266,7 @@ FieldsEmbed.js
diff --git a/docs/PaginationEmbed.html b/docs/PaginationEmbed.html
index 58d735a..994485d 100644
--- a/docs/PaginationEmbed.html
+++ b/docs/PaginationEmbed.html
@@ -22,7 +22,7 @@
@@ -299,7 +299,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -350,7 +350,7 @@ authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -951,10 +951,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -977,7 +973,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1029,7 +1025,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1055,12 +1051,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1084,23 +1076,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1126,10 +1102,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1281,10 +1253,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1307,7 +1275,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1416,8 +1384,6 @@ Parameters:
- <optional>
-
@@ -1428,12 +1394,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -1495,10 +1459,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1521,7 +1481,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -1599,12 +1559,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1628,23 +1584,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -1670,10 +1610,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1696,7 +1632,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -1774,12 +1710,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1806,23 +1738,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -1848,10 +1764,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1874,7 +1786,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -1952,12 +1864,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1981,23 +1889,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2023,10 +1915,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2049,7 +1937,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2127,12 +2015,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2156,24 +2040,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2198,10 +2066,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2237,7 +2101,7 @@ Returns:
diff --git a/docs/base_PaginationEmbed.js.html b/docs/base_PaginationEmbed.js.html
index c40af28..e74e322 100644
--- a/docs/base_PaginationEmbed.js.html
+++ b/docs/base_PaginationEmbed.js.html
@@ -22,7 +22,7 @@
@@ -63,7 +63,7 @@ base/PaginationEmbed.js
/**
* Options for the constructor.
* @typedef {Object} PaginationEmbedOptions
- * @property {User} [authorisedUser=null] - The authorised user to navigate the pages.
+ * @property {User} [authorizedUser=null] - The authorized user to navigate the pages.
* @property {TextChannel} channel - The channel where to send the embed.
* @property {ClientMessageOptions} [clientMessage=null] - Settings for the message sent by the client.
* @property {Array.<*>} array - An array of elements to paginate.
@@ -82,10 +82,10 @@ base/PaginationEmbed.js
super(options);
/**
- * The authorised user to navigate the pages.
+ * The authorized user to navigate the pages.
* @type {User}
*/
- this.authorisedUser = options.authorisedUser || null;
+ this.authorizedUser = options.authorizedUser || null;
/**
* The channel where to send the embed.
@@ -149,7 +149,7 @@ base/PaginationEmbed.js
/**
* Sets the array of elements to paginate.
* @param {Array} array - An array of elements to paginate.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -162,12 +162,12 @@ base/PaginationEmbed.js
}
/**
- * Set the authorised person to navigate the pages.
- * @param {User} [user=null] - The user object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * Set the authorized person to navigate the pages.
+ * @param {User} user - The user object.
+ * @returns {PaginationEmbed}
*/
- setAuthorisedUser(user = null) {
- this.authorisedUser = user;
+ setAuthorizedUser(user) {
+ this.authorizedUser = user;
return this;
}
@@ -175,7 +175,7 @@ base/PaginationEmbed.js
/**
* The channel where to send the embed.
* @param {TextChannel} channel - The channel object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setChannel(channel) {
this.channel = channel;
@@ -185,11 +185,11 @@ base/PaginationEmbed.js
/**
* Sets the settings for the message sent by the client.
- * @param {Message} [message=null] - The message object sent by the client, if there is any.
+ * @param {Message} message - The message object sent by the client.
* @param {string} [content='Preparing...'] - The custom message content while preparing the embed.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
- setClientMessage(message = null, content = null) {
+ setClientMessage(message, content = null) {
if (!content) content = 'Preparing...';
Object.assign(this.clientMessage, { message, content });
@@ -199,8 +199,8 @@ base/PaginationEmbed.js
/**
* Sets the emojis used for navigation buttons.
- * @param {NavigationButtons} [emojis={}] - An object containing customised emojis to use as navigation buttons.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {NavigationButtons} emojis - An object containing customised emojis to use as navigation buttons.
+ * @returns {PaginationEmbed}
*/
setEmojis(emojis) {
Object.assign(this.emojis, emojis);
@@ -210,10 +210,10 @@ base/PaginationEmbed.js
/**
* Sets to jump to a certain page upon calling PaginationEmbed.build().
- * @param {number|string} [param=1] - The page number to jump to. As String: 'back', 'forward'
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number|string} param - The page number to jump to. As String: 'back', 'forward'
+ * @returns {PaginationEmbed}
*/
- setPage(param = 1) {
+ setPage(param) {
const isString = typeof param === 'string';
if (!(!isNaN(param) || isString)) throw new Error('setPage() only accepts number/string type.');
@@ -229,10 +229,10 @@ base/PaginationEmbed.js
/**
* Sets the time for awaiting a user action before timeout in ms.
- * @param {number} [timeout=30000] Timeout value in ms.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number} timeout Timeout value in ms.
+ * @returns {PaginationEmbed}
*/
- setTimeout(timeout = 30000) {
+ setTimeout(timeout) {
if (typeof timeout !== 'number') throw new Error('setTimeout() only accepts number type.');
this.timeout = timeout;
@@ -242,10 +242,10 @@ base/PaginationEmbed.js
/**
* Sets whether page number indicator on client's message is shown or not.
- * @param {boolean} [boolean=true] - Show page indicator?
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {boolean} boolean - Show page indicator?
+ * @returns {PaginationEmbed}
*/
- showPageIndicator(boolean = true) {
+ showPageIndicator(boolean) {
if (typeof boolean !== 'boolean') throw new Error('showPageIndicator() only accepts boolean type.');
this.pageIndicator = boolean;
@@ -261,7 +261,7 @@ base/PaginationEmbed.js
async _verify(pages) {
this
.setChannel(this.channel)
- .setAuthorisedUser(this.authorisedUser)
+ .setAuthorizedUser(this.authorizedUser)
.setClientMessage(this.clientMessage.message, this.clientMessage.content)
.setArray(this.array)
.showPageIndicator(this.pageIndicator)
@@ -337,8 +337,8 @@ base/PaginationEmbed.js
async _awaitResponse() {
const emojis = Object.values(this.emojis);
const filter = (r, u) => {
- if (this.authorisedUser)
- return u.id === this.authorisedUser.id && emojis.includes(r.emoji.name);
+ if (this.authorizedUser)
+ return u.id === this.authorizedUser.id && emojis.includes(r.emoji.name);
return !u.bot && emojis.includes(r.emoji.name);
};
@@ -432,7 +432,7 @@ base/PaginationEmbed.js
diff --git a/docs/global.html b/docs/global.html
index 23000ba..3f7e34b 100644
--- a/docs/global.html
+++ b/docs/global.html
@@ -22,7 +22,7 @@
@@ -1487,7 +1487,7 @@ Properties:
- authorisedUser
+ authorizedUser
@@ -1517,7 +1517,7 @@ Properties:
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -1820,7 +1820,7 @@ Type:
diff --git a/docs/index.html b/docs/index.html
index 80eb8c4..c53f893 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -22,7 +22,7 @@
@@ -51,20 +51,21 @@ Home
Classes
Returns:
Returns:
-setURL(url) → {Embeds}
+setURL(url) → {PaginationEmbed}
@@ -4770,7 +4638,7 @@setURLSource:
Parameters:
Returns:
-
- - Instance of Embeds
-
-
@@ -4899,7 +4763,7 @@ Returns:
Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -4996,12 +4860,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -5025,23 +4885,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- true
-
-
Show page indicator?
@@ -5067,10 +4911,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -5106,7 +4946,7 @@ Returns:
diff --git a/docs/Embeds.js.html b/docs/Embeds.js.html
index 637f285..ba6e1c4 100644
--- a/docs/Embeds.js.html
+++ b/docs/Embeds.js.html
@@ -22,7 +22,7 @@
@@ -111,6 +111,7 @@ Embeds.js
/**
* The thumbnail of all embeds.
+ * @type {string}
*/
this.thumbnail = options.thumbnail || null;
@@ -135,7 +136,7 @@ Embeds.js
/**
* Embed in the current page.
- * @returns {MessageEmbed} - An instance of MessageEmbed.
+ * @type {MessageEmbed}
*/
get currentEmbed() {
return this.array[this.page - 1];
@@ -144,7 +145,7 @@ Embeds.js
/**
* Adds a blank field to the fields of all embeds.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addBlankField(inline = false) {
const arr = this.array;
@@ -160,7 +161,7 @@ Embeds.js
* @param {string} name - The name of the field.
* @param {string} value - The value of the field.
* @param {boolean} [inline=false] - Whether the field is inline or not to the other fields.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
addField(name, value, inline = false) {
if (!name && !value) return this;
@@ -179,12 +180,12 @@ Embeds.js
* @example
*
* // Object as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -208,12 +209,12 @@ Embeds.js
* @example
*
* // Methods as constructor.
- * const Embeds = require('discord-paginationembed').Embeds;
+ * const { Embeds } = require('discord-paginationembed');
* const { MessageEmbed } = require('discord.js');
*
* // Under message event.
* new Embeds()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -269,7 +270,7 @@ Embeds.js
/**
* Sets the array of embeds to paginate.
* @param {Array} array - An array of embeds to paginate.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -290,7 +291,7 @@ Embeds.js
* @param {StringResolvable} name - The name of the author.
* @param {string} [iconURL=null] - The icon URL of the author.
* @param {string} [url=null] - The URL of the author.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setAuthor(name, iconURL = null, url = null) {
if (!name) return this;
@@ -306,7 +307,7 @@ Embeds.js
/**
* Sets the color of all embeds.
* @param {ColorResolvable} color - The color of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setColor(color) {
if (!color) return this;
@@ -322,7 +323,7 @@ Embeds.js
/**
* Sets the description of all embeds.
* @param {string} description - The description of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setDescription(description) {
if (!description) return this;
@@ -339,7 +340,7 @@ Embeds.js
* Sets the footer of all embeds.
* @param {string} text - The footer text.
* @param {string} [iconURL=null] - URL for the footer's icon.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setFooter(text, iconURL = null) {
if (!text) return this;
@@ -355,7 +356,7 @@ Embeds.js
/**
* Sets the image of all embeds.
* @param {string} image - The image of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setImage(image) {
if (!image) return this;
@@ -371,7 +372,7 @@ Embeds.js
/**
* Sets the thumbnail of all embeds.
* @param {string} thumbnail - The thumbnail of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setThumbnail(thumbnail) {
if (!thumbnail) return this;
@@ -386,7 +387,7 @@ Embeds.js
/**
* Sets the timestamp of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTimestamp() {
const arr = this.array;
@@ -400,7 +401,7 @@ Embeds.js
/**
* Sets the title of all embeds.
* @param {string} title - The title of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setTitle(title) {
if (!title) return this;
@@ -416,7 +417,7 @@ Embeds.js
/**
* Sets the URL of all embeds.
* @param {string} url - The URL of all embeds.
- * @returns {Embeds} - Instance of Embeds
+ * @returns {PaginationEmbed}
*/
setURL(url) {
if (!url) return this;
@@ -455,7 +456,7 @@ Embeds.js
diff --git a/docs/FieldsEmbed.html b/docs/FieldsEmbed.html
index 948c77a..e3a7000 100644
--- a/docs/FieldsEmbed.html
+++ b/docs/FieldsEmbed.html
@@ -22,7 +22,7 @@
@@ -304,7 +304,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -326,7 +326,7 @@ authori
authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -538,7 +538,7 @@ Type:
-elementList
+elementList :Array.<*>
@@ -594,6 +594,16 @@ elementLis
+ Type:
+
+
+
@@ -1063,9 +1073,9 @@ (async) buildExamples
- // Object as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed({
authorisedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
+ // Object as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed({
authorizedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
- // Methods as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed()
.setAuthorisedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
+ // Methods as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed()
.setAuthorizedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
@@ -1089,7 +1099,7 @@ Examples
- formatField(name, value, inlineopt) → {FieldsEmbed}
+ formatField(name, value, inlineopt) → {PaginationEmbed}
@@ -1308,10 +1318,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -1320,7 +1326,7 @@ Returns:
Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1494,7 +1496,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1517,7 +1519,7 @@ setA
setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1577,12 +1579,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1606,23 +1604,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1648,10 +1630,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1808,10 +1786,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1834,7 +1808,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1948,8 +1922,6 @@ Parameters:
- <optional>
-
@@ -1960,12 +1932,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -2027,10 +1997,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2053,7 +2019,7 @@ Returns:
- setElementsPerPage(numberopt) → {FieldsEmbed}
+ setElementsPerPage(number) → {PaginationEmbed}
@@ -2131,12 +2097,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2160,24 +2122,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 10
-
-
-
Maximum number of elements to be displayed per page.
@@ -2202,10 +2148,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -2214,7 +2156,7 @@ Returns:
Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -2311,12 +2253,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2340,23 +2278,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -2382,10 +2304,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2408,7 +2326,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -2491,12 +2409,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2523,24 +2437,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 1
-
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -2565,10 +2463,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2591,7 +2485,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -2674,12 +2568,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2703,23 +2593,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2745,10 +2619,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2771,7 +2641,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2854,12 +2724,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2883,24 +2749,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2925,10 +2775,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2964,7 +2810,7 @@ Returns:
diff --git a/docs/FieldsEmbed.js.html b/docs/FieldsEmbed.js.html
index 5d36097..9bad270 100644
--- a/docs/FieldsEmbed.js.html
+++ b/docs/FieldsEmbed.js.html
@@ -22,7 +22,7 @@
@@ -81,7 +81,7 @@ FieldsEmbed.js
/**
* Elements in the current page.
- * @returns {Array.<*>} - An array for a page.
+ * @type {Array.<*>}
*/
get elementList() {
const begin = (this.page - 1) * this.elementsPerPage;
@@ -96,11 +96,11 @@ FieldsEmbed.js
* @example
*
* // Object as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -126,11 +126,11 @@ FieldsEmbed.js
* @example
*
* // Methods as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -185,7 +185,7 @@ FieldsEmbed.js
* @param {string} name - Name of the field.
* @param {Function} value - Value of the field. Function for Array.prototype.map().join('\n').
* @param {boolean} [inline=true] - Whether the field is inline with other field or not.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @returns {PaginationEmbed}
*/
formatField(name, value, inline = true) {
this.fields.push({ name, value, inline });
@@ -195,10 +195,10 @@ FieldsEmbed.js
/**
* Sets the maximum number of elements to be displayed per page.
- * @param {number} [number=10] - Maximum number of elements to be displayed per page.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @param {number} number - Maximum number of elements to be displayed per page.
+ * @returns {PaginationEmbed}
*/
- setElementsPerPage(number = 10) {
+ setElementsPerPage(number) {
if (typeof number !== 'number') throw new Error('setElementsPerPage() only accepts number type.');
this.elementsPerPage = number;
@@ -266,7 +266,7 @@ FieldsEmbed.js
diff --git a/docs/PaginationEmbed.html b/docs/PaginationEmbed.html
index 58d735a..994485d 100644
--- a/docs/PaginationEmbed.html
+++ b/docs/PaginationEmbed.html
@@ -22,7 +22,7 @@
@@ -299,7 +299,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -350,7 +350,7 @@ authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -951,10 +951,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -977,7 +973,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1029,7 +1025,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1055,12 +1051,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1084,23 +1076,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1126,10 +1102,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1281,10 +1253,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1307,7 +1275,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1416,8 +1384,6 @@ Parameters:
- <optional>
-
@@ -1428,12 +1394,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -1495,10 +1459,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1521,7 +1481,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -1599,12 +1559,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1628,23 +1584,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -1670,10 +1610,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1696,7 +1632,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -1774,12 +1710,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1806,23 +1738,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -1848,10 +1764,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1874,7 +1786,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -1952,12 +1864,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1981,23 +1889,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2023,10 +1915,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2049,7 +1937,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2127,12 +2015,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2156,24 +2040,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2198,10 +2066,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2237,7 +2101,7 @@ Returns:
diff --git a/docs/base_PaginationEmbed.js.html b/docs/base_PaginationEmbed.js.html
index c40af28..e74e322 100644
--- a/docs/base_PaginationEmbed.js.html
+++ b/docs/base_PaginationEmbed.js.html
@@ -22,7 +22,7 @@
@@ -63,7 +63,7 @@ base/PaginationEmbed.js
/**
* Options for the constructor.
* @typedef {Object} PaginationEmbedOptions
- * @property {User} [authorisedUser=null] - The authorised user to navigate the pages.
+ * @property {User} [authorizedUser=null] - The authorized user to navigate the pages.
* @property {TextChannel} channel - The channel where to send the embed.
* @property {ClientMessageOptions} [clientMessage=null] - Settings for the message sent by the client.
* @property {Array.<*>} array - An array of elements to paginate.
@@ -82,10 +82,10 @@ base/PaginationEmbed.js
super(options);
/**
- * The authorised user to navigate the pages.
+ * The authorized user to navigate the pages.
* @type {User}
*/
- this.authorisedUser = options.authorisedUser || null;
+ this.authorizedUser = options.authorizedUser || null;
/**
* The channel where to send the embed.
@@ -149,7 +149,7 @@ base/PaginationEmbed.js
/**
* Sets the array of elements to paginate.
* @param {Array} array - An array of elements to paginate.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -162,12 +162,12 @@ base/PaginationEmbed.js
}
/**
- * Set the authorised person to navigate the pages.
- * @param {User} [user=null] - The user object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * Set the authorized person to navigate the pages.
+ * @param {User} user - The user object.
+ * @returns {PaginationEmbed}
*/
- setAuthorisedUser(user = null) {
- this.authorisedUser = user;
+ setAuthorizedUser(user) {
+ this.authorizedUser = user;
return this;
}
@@ -175,7 +175,7 @@ base/PaginationEmbed.js
/**
* The channel where to send the embed.
* @param {TextChannel} channel - The channel object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setChannel(channel) {
this.channel = channel;
@@ -185,11 +185,11 @@ base/PaginationEmbed.js
/**
* Sets the settings for the message sent by the client.
- * @param {Message} [message=null] - The message object sent by the client, if there is any.
+ * @param {Message} message - The message object sent by the client.
* @param {string} [content='Preparing...'] - The custom message content while preparing the embed.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
- setClientMessage(message = null, content = null) {
+ setClientMessage(message, content = null) {
if (!content) content = 'Preparing...';
Object.assign(this.clientMessage, { message, content });
@@ -199,8 +199,8 @@ base/PaginationEmbed.js
/**
* Sets the emojis used for navigation buttons.
- * @param {NavigationButtons} [emojis={}] - An object containing customised emojis to use as navigation buttons.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {NavigationButtons} emojis - An object containing customised emojis to use as navigation buttons.
+ * @returns {PaginationEmbed}
*/
setEmojis(emojis) {
Object.assign(this.emojis, emojis);
@@ -210,10 +210,10 @@ base/PaginationEmbed.js
/**
* Sets to jump to a certain page upon calling PaginationEmbed.build().
- * @param {number|string} [param=1] - The page number to jump to. As String: 'back', 'forward'
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number|string} param - The page number to jump to. As String: 'back', 'forward'
+ * @returns {PaginationEmbed}
*/
- setPage(param = 1) {
+ setPage(param) {
const isString = typeof param === 'string';
if (!(!isNaN(param) || isString)) throw new Error('setPage() only accepts number/string type.');
@@ -229,10 +229,10 @@ base/PaginationEmbed.js
/**
* Sets the time for awaiting a user action before timeout in ms.
- * @param {number} [timeout=30000] Timeout value in ms.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number} timeout Timeout value in ms.
+ * @returns {PaginationEmbed}
*/
- setTimeout(timeout = 30000) {
+ setTimeout(timeout) {
if (typeof timeout !== 'number') throw new Error('setTimeout() only accepts number type.');
this.timeout = timeout;
@@ -242,10 +242,10 @@ base/PaginationEmbed.js
/**
* Sets whether page number indicator on client's message is shown or not.
- * @param {boolean} [boolean=true] - Show page indicator?
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {boolean} boolean - Show page indicator?
+ * @returns {PaginationEmbed}
*/
- showPageIndicator(boolean = true) {
+ showPageIndicator(boolean) {
if (typeof boolean !== 'boolean') throw new Error('showPageIndicator() only accepts boolean type.');
this.pageIndicator = boolean;
@@ -261,7 +261,7 @@ base/PaginationEmbed.js
async _verify(pages) {
this
.setChannel(this.channel)
- .setAuthorisedUser(this.authorisedUser)
+ .setAuthorizedUser(this.authorizedUser)
.setClientMessage(this.clientMessage.message, this.clientMessage.content)
.setArray(this.array)
.showPageIndicator(this.pageIndicator)
@@ -337,8 +337,8 @@ base/PaginationEmbed.js
async _awaitResponse() {
const emojis = Object.values(this.emojis);
const filter = (r, u) => {
- if (this.authorisedUser)
- return u.id === this.authorisedUser.id && emojis.includes(r.emoji.name);
+ if (this.authorizedUser)
+ return u.id === this.authorizedUser.id && emojis.includes(r.emoji.name);
return !u.bot && emojis.includes(r.emoji.name);
};
@@ -432,7 +432,7 @@ base/PaginationEmbed.js
diff --git a/docs/global.html b/docs/global.html
index 23000ba..3f7e34b 100644
--- a/docs/global.html
+++ b/docs/global.html
@@ -22,7 +22,7 @@
@@ -1487,7 +1487,7 @@ Properties:
- authorisedUser
+ authorizedUser
@@ -1517,7 +1517,7 @@ Properties:
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -1820,7 +1820,7 @@ Type:
diff --git a/docs/index.html b/docs/index.html
index 80eb8c4..c53f893 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -22,7 +22,7 @@
@@ -51,20 +51,21 @@ Home
Classes
Returns:
Returns:
-showPageIndicator(booleanopt) → {PaginationEmbed}
+showPageIndicator(boolean) → {PaginationEmbed}
@@ -4996,12 +4860,8 @@Parameters:
Parameters:
-- - - - -
true
-
- Parameters:
Returns:
--
@@ -5106,7 +4946,7 @@
Returns:
diff --git a/docs/Embeds.js.html b/docs/Embeds.js.html index 637f285..ba6e1c4 100644 --- a/docs/Embeds.js.html +++ b/docs/Embeds.js.html @@ -22,7 +22,7 @@
Embeds.js
/** * The thumbnail of all embeds. + * @type {string} */ this.thumbnail = options.thumbnail || null; @@ -135,7 +136,7 @@Embeds.js
/** * Embed in the current page. - * @returns {MessageEmbed} - An instance of MessageEmbed. + * @type {MessageEmbed} */ get currentEmbed() { return this.array[this.page - 1]; @@ -144,7 +145,7 @@Embeds.js
/** * Adds a blank field to the fields of all embeds. * @param {boolean} [inline=false] - Whether the field is inline or not to the other fields. - * @returns {Embeds} - Instance of Embeds + * @returns {PaginationEmbed} */ addBlankField(inline = false) { const arr = this.array; @@ -160,7 +161,7 @@Embeds.js
* @param {string} name - The name of the field. * @param {string} value - The value of the field. * @param {boolean} [inline=false] - Whether the field is inline or not to the other fields. - * @returns {Embeds} - Instance of Embeds + * @returns {PaginationEmbed} */ addField(name, value, inline = false) { if (!name && !value) return this; @@ -179,12 +180,12 @@Embeds.js
* @example * * // Object as constructor. - * const Embeds = require('discord-paginationembed').Embeds; + * const { Embeds } = require('discord-paginationembed'); * const { MessageEmbed } = require('discord.js'); * * // Under message event. * new Embeds({ - * authorisedUser: message.author, + * authorizedUser: message.author, * channel: message.channel, * clientMessage: { content: 'Preparing the embed...' }, * array: [ @@ -208,12 +209,12 @@Embeds.js
* @example * * // Methods as constructor. - * const Embeds = require('discord-paginationembed').Embeds; + * const { Embeds } = require('discord-paginationembed'); * const { MessageEmbed } = require('discord.js'); * * // Under message event. * new Embeds() - * .setAuthorisedUser(message.author) + * .setAuthorizedUser(message.author) * .setChannel(message.channel) * .setClientMessage(null, 'Preparing the embed...') * .setArray([ @@ -269,7 +270,7 @@Embeds.js
/** * Sets the array of embeds to paginate. * @param {Array} array - An array of embeds to paginate. - * @returns {Embeds} - Instance of Embeds + * @returns {PaginationEmbed} */ setArray(array) { const isValidArray = Array.isArray(array) && Boolean(array.length); @@ -290,7 +291,7 @@Embeds.js
* @param {StringResolvable} name - The name of the author. * @param {string} [iconURL=null] - The icon URL of the author. * @param {string} [url=null] - The URL of the author. - * @returns {Embeds} - Instance of Embeds + * @returns {PaginationEmbed} */ setAuthor(name, iconURL = null, url = null) { if (!name) return this; @@ -306,7 +307,7 @@Embeds.js
/** * Sets the color of all embeds. * @param {ColorResolvable} color - The color of all embeds. - * @returns {Embeds} - Instance of Embeds + * @returns {PaginationEmbed} */ setColor(color) { if (!color) return this; @@ -322,7 +323,7 @@Embeds.js
/** * Sets the description of all embeds. * @param {string} description - The description of all embeds. - * @returns {Embeds} - Instance of Embeds + * @returns {PaginationEmbed} */ setDescription(description) { if (!description) return this; @@ -339,7 +340,7 @@Embeds.js
* Sets the footer of all embeds. * @param {string} text - The footer text. * @param {string} [iconURL=null] - URL for the footer's icon. - * @returns {Embeds} - Instance of Embeds + * @returns {PaginationEmbed} */ setFooter(text, iconURL = null) { if (!text) return this; @@ -355,7 +356,7 @@Embeds.js
/** * Sets the image of all embeds. * @param {string} image - The image of all embeds. - * @returns {Embeds} - Instance of Embeds + * @returns {PaginationEmbed} */ setImage(image) { if (!image) return this; @@ -371,7 +372,7 @@Embeds.js
/** * Sets the thumbnail of all embeds. * @param {string} thumbnail - The thumbnail of all embeds. - * @returns {Embeds} - Instance of Embeds + * @returns {PaginationEmbed} */ setThumbnail(thumbnail) { if (!thumbnail) return this; @@ -386,7 +387,7 @@Embeds.js
/** * Sets the timestamp of all embeds. - * @returns {Embeds} - Instance of Embeds + * @returns {PaginationEmbed} */ setTimestamp() { const arr = this.array; @@ -400,7 +401,7 @@Embeds.js
/** * Sets the title of all embeds. * @param {string} title - The title of all embeds. - * @returns {Embeds} - Instance of Embeds + * @returns {PaginationEmbed} */ setTitle(title) { if (!title) return this; @@ -416,7 +417,7 @@Embeds.js
/** * Sets the URL of all embeds. * @param {string} url - The URL of all embeds. - * @returns {Embeds} - Instance of Embeds + * @returns {PaginationEmbed} */ setURL(url) { if (!url) return this; @@ -455,7 +456,7 @@Embeds.js
diff --git a/docs/FieldsEmbed.html b/docs/FieldsEmbed.html index 948c77a..e3a7000 100644 --- a/docs/FieldsEmbed.html +++ b/docs/FieldsEmbed.html @@ -22,7 +22,7 @@
Type:
-authorisedUser :User
+authorizedUser :User
@@ -326,7 +326,7 @@authori
authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -538,7 +538,7 @@ Type:
-elementList
+elementList :Array.<*>
@@ -594,6 +594,16 @@ elementLis
+ Type:
+
+
+
@@ -1063,9 +1073,9 @@ (async) buildExamples
- // Object as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed({
authorisedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
+ // Object as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed({
authorizedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
- // Methods as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed()
.setAuthorisedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
+ // Methods as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed()
.setAuthorizedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
@@ -1089,7 +1099,7 @@ Examples
- formatField(name, value, inlineopt) → {FieldsEmbed}
+ formatField(name, value, inlineopt) → {PaginationEmbed}
@@ -1308,10 +1318,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -1320,7 +1326,7 @@ Returns:
Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1494,7 +1496,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1517,7 +1519,7 @@ setA
setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1577,12 +1579,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1606,23 +1604,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1648,10 +1630,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1808,10 +1786,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1834,7 +1808,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1948,8 +1922,6 @@ Parameters:
- <optional>
-
@@ -1960,12 +1932,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -2027,10 +1997,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2053,7 +2019,7 @@ Returns:
- setElementsPerPage(numberopt) → {FieldsEmbed}
+ setElementsPerPage(number) → {PaginationEmbed}
@@ -2131,12 +2097,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2160,24 +2122,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 10
-
-
-
Maximum number of elements to be displayed per page.
@@ -2202,10 +2148,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -2214,7 +2156,7 @@ Returns:
Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -2311,12 +2253,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2340,23 +2278,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -2382,10 +2304,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2408,7 +2326,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -2491,12 +2409,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2523,24 +2437,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 1
-
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -2565,10 +2463,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2591,7 +2485,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -2674,12 +2568,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2703,23 +2593,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2745,10 +2619,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2771,7 +2641,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2854,12 +2724,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2883,24 +2749,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2925,10 +2775,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2964,7 +2810,7 @@ Returns:
diff --git a/docs/FieldsEmbed.js.html b/docs/FieldsEmbed.js.html
index 5d36097..9bad270 100644
--- a/docs/FieldsEmbed.js.html
+++ b/docs/FieldsEmbed.js.html
@@ -22,7 +22,7 @@
@@ -81,7 +81,7 @@ FieldsEmbed.js
/**
* Elements in the current page.
- * @returns {Array.<*>} - An array for a page.
+ * @type {Array.<*>}
*/
get elementList() {
const begin = (this.page - 1) * this.elementsPerPage;
@@ -96,11 +96,11 @@ FieldsEmbed.js
* @example
*
* // Object as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -126,11 +126,11 @@ FieldsEmbed.js
* @example
*
* // Methods as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -185,7 +185,7 @@ FieldsEmbed.js
* @param {string} name - Name of the field.
* @param {Function} value - Value of the field. Function for Array.prototype.map().join('\n').
* @param {boolean} [inline=true] - Whether the field is inline with other field or not.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @returns {PaginationEmbed}
*/
formatField(name, value, inline = true) {
this.fields.push({ name, value, inline });
@@ -195,10 +195,10 @@ FieldsEmbed.js
/**
* Sets the maximum number of elements to be displayed per page.
- * @param {number} [number=10] - Maximum number of elements to be displayed per page.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @param {number} number - Maximum number of elements to be displayed per page.
+ * @returns {PaginationEmbed}
*/
- setElementsPerPage(number = 10) {
+ setElementsPerPage(number) {
if (typeof number !== 'number') throw new Error('setElementsPerPage() only accepts number type.');
this.elementsPerPage = number;
@@ -266,7 +266,7 @@ FieldsEmbed.js
diff --git a/docs/PaginationEmbed.html b/docs/PaginationEmbed.html
index 58d735a..994485d 100644
--- a/docs/PaginationEmbed.html
+++ b/docs/PaginationEmbed.html
@@ -22,7 +22,7 @@
@@ -299,7 +299,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -350,7 +350,7 @@ authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -951,10 +951,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -977,7 +973,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1029,7 +1025,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1055,12 +1051,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1084,23 +1076,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1126,10 +1102,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1281,10 +1253,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1307,7 +1275,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1416,8 +1384,6 @@ Parameters:
- <optional>
-
@@ -1428,12 +1394,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -1495,10 +1459,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1521,7 +1481,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -1599,12 +1559,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1628,23 +1584,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -1670,10 +1610,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1696,7 +1632,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -1774,12 +1710,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1806,23 +1738,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -1848,10 +1764,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1874,7 +1786,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -1952,12 +1864,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1981,23 +1889,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2023,10 +1915,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2049,7 +1937,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2127,12 +2015,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2156,24 +2040,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2198,10 +2066,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2237,7 +2101,7 @@ Returns:
diff --git a/docs/base_PaginationEmbed.js.html b/docs/base_PaginationEmbed.js.html
index c40af28..e74e322 100644
--- a/docs/base_PaginationEmbed.js.html
+++ b/docs/base_PaginationEmbed.js.html
@@ -22,7 +22,7 @@
@@ -63,7 +63,7 @@ base/PaginationEmbed.js
/**
* Options for the constructor.
* @typedef {Object} PaginationEmbedOptions
- * @property {User} [authorisedUser=null] - The authorised user to navigate the pages.
+ * @property {User} [authorizedUser=null] - The authorized user to navigate the pages.
* @property {TextChannel} channel - The channel where to send the embed.
* @property {ClientMessageOptions} [clientMessage=null] - Settings for the message sent by the client.
* @property {Array.<*>} array - An array of elements to paginate.
@@ -82,10 +82,10 @@ base/PaginationEmbed.js
super(options);
/**
- * The authorised user to navigate the pages.
+ * The authorized user to navigate the pages.
* @type {User}
*/
- this.authorisedUser = options.authorisedUser || null;
+ this.authorizedUser = options.authorizedUser || null;
/**
* The channel where to send the embed.
@@ -149,7 +149,7 @@ base/PaginationEmbed.js
/**
* Sets the array of elements to paginate.
* @param {Array} array - An array of elements to paginate.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -162,12 +162,12 @@ base/PaginationEmbed.js
}
/**
- * Set the authorised person to navigate the pages.
- * @param {User} [user=null] - The user object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * Set the authorized person to navigate the pages.
+ * @param {User} user - The user object.
+ * @returns {PaginationEmbed}
*/
- setAuthorisedUser(user = null) {
- this.authorisedUser = user;
+ setAuthorizedUser(user) {
+ this.authorizedUser = user;
return this;
}
@@ -175,7 +175,7 @@ base/PaginationEmbed.js
/**
* The channel where to send the embed.
* @param {TextChannel} channel - The channel object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setChannel(channel) {
this.channel = channel;
@@ -185,11 +185,11 @@ base/PaginationEmbed.js
/**
* Sets the settings for the message sent by the client.
- * @param {Message} [message=null] - The message object sent by the client, if there is any.
+ * @param {Message} message - The message object sent by the client.
* @param {string} [content='Preparing...'] - The custom message content while preparing the embed.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
- setClientMessage(message = null, content = null) {
+ setClientMessage(message, content = null) {
if (!content) content = 'Preparing...';
Object.assign(this.clientMessage, { message, content });
@@ -199,8 +199,8 @@ base/PaginationEmbed.js
/**
* Sets the emojis used for navigation buttons.
- * @param {NavigationButtons} [emojis={}] - An object containing customised emojis to use as navigation buttons.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {NavigationButtons} emojis - An object containing customised emojis to use as navigation buttons.
+ * @returns {PaginationEmbed}
*/
setEmojis(emojis) {
Object.assign(this.emojis, emojis);
@@ -210,10 +210,10 @@ base/PaginationEmbed.js
/**
* Sets to jump to a certain page upon calling PaginationEmbed.build().
- * @param {number|string} [param=1] - The page number to jump to. As String: 'back', 'forward'
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number|string} param - The page number to jump to. As String: 'back', 'forward'
+ * @returns {PaginationEmbed}
*/
- setPage(param = 1) {
+ setPage(param) {
const isString = typeof param === 'string';
if (!(!isNaN(param) || isString)) throw new Error('setPage() only accepts number/string type.');
@@ -229,10 +229,10 @@ base/PaginationEmbed.js
/**
* Sets the time for awaiting a user action before timeout in ms.
- * @param {number} [timeout=30000] Timeout value in ms.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number} timeout Timeout value in ms.
+ * @returns {PaginationEmbed}
*/
- setTimeout(timeout = 30000) {
+ setTimeout(timeout) {
if (typeof timeout !== 'number') throw new Error('setTimeout() only accepts number type.');
this.timeout = timeout;
@@ -242,10 +242,10 @@ base/PaginationEmbed.js
/**
* Sets whether page number indicator on client's message is shown or not.
- * @param {boolean} [boolean=true] - Show page indicator?
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {boolean} boolean - Show page indicator?
+ * @returns {PaginationEmbed}
*/
- showPageIndicator(boolean = true) {
+ showPageIndicator(boolean) {
if (typeof boolean !== 'boolean') throw new Error('showPageIndicator() only accepts boolean type.');
this.pageIndicator = boolean;
@@ -261,7 +261,7 @@ base/PaginationEmbed.js
async _verify(pages) {
this
.setChannel(this.channel)
- .setAuthorisedUser(this.authorisedUser)
+ .setAuthorizedUser(this.authorizedUser)
.setClientMessage(this.clientMessage.message, this.clientMessage.content)
.setArray(this.array)
.showPageIndicator(this.pageIndicator)
@@ -337,8 +337,8 @@ base/PaginationEmbed.js
async _awaitResponse() {
const emojis = Object.values(this.emojis);
const filter = (r, u) => {
- if (this.authorisedUser)
- return u.id === this.authorisedUser.id && emojis.includes(r.emoji.name);
+ if (this.authorizedUser)
+ return u.id === this.authorizedUser.id && emojis.includes(r.emoji.name);
return !u.bot && emojis.includes(r.emoji.name);
};
@@ -432,7 +432,7 @@ base/PaginationEmbed.js
diff --git a/docs/global.html b/docs/global.html
index 23000ba..3f7e34b 100644
--- a/docs/global.html
+++ b/docs/global.html
@@ -22,7 +22,7 @@
@@ -1487,7 +1487,7 @@ Properties:
- authorisedUser
+ authorizedUser
@@ -1517,7 +1517,7 @@ Properties:
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -1820,7 +1820,7 @@ Type:
diff --git a/docs/index.html b/docs/index.html
index 80eb8c4..c53f893 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -22,7 +22,7 @@
@@ -51,20 +51,21 @@ Home
Classes
Type:
-elementList
+elementList :Array.<*>
@@ -594,6 +594,16 @@elementLis
+ Type:
+
+
+
@@ -1063,9 +1073,9 @@ (async) buildExamples
- // Object as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed({
authorisedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
+ // Object as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed({
authorizedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
- // Methods as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed()
.setAuthorisedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
+ // Methods as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed()
.setAuthorizedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
@@ -1089,7 +1099,7 @@ Examples
- formatField(name, value, inlineopt) → {FieldsEmbed}
+ formatField(name, value, inlineopt) → {PaginationEmbed}
@@ -1308,10 +1318,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -1320,7 +1326,7 @@ Returns:
Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1494,7 +1496,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1517,7 +1519,7 @@ setA
setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1577,12 +1579,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1606,23 +1604,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1648,10 +1630,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1808,10 +1786,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1834,7 +1808,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1948,8 +1922,6 @@ Parameters:
- <optional>
-
@@ -1960,12 +1932,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -2027,10 +1997,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2053,7 +2019,7 @@ Returns:
- setElementsPerPage(numberopt) → {FieldsEmbed}
+ setElementsPerPage(number) → {PaginationEmbed}
@@ -2131,12 +2097,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2160,24 +2122,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 10
-
-
-
Maximum number of elements to be displayed per page.
@@ -2202,10 +2148,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -2214,7 +2156,7 @@ Returns:
Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -2311,12 +2253,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2340,23 +2278,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -2382,10 +2304,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2408,7 +2326,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -2491,12 +2409,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2523,24 +2437,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 1
-
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -2565,10 +2463,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2591,7 +2485,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -2674,12 +2568,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2703,23 +2593,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2745,10 +2619,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2771,7 +2641,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2854,12 +2724,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2883,24 +2749,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2925,10 +2775,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2964,7 +2810,7 @@ Returns:
diff --git a/docs/FieldsEmbed.js.html b/docs/FieldsEmbed.js.html
index 5d36097..9bad270 100644
--- a/docs/FieldsEmbed.js.html
+++ b/docs/FieldsEmbed.js.html
@@ -22,7 +22,7 @@
@@ -81,7 +81,7 @@ FieldsEmbed.js
/**
* Elements in the current page.
- * @returns {Array.<*>} - An array for a page.
+ * @type {Array.<*>}
*/
get elementList() {
const begin = (this.page - 1) * this.elementsPerPage;
@@ -96,11 +96,11 @@ FieldsEmbed.js
* @example
*
* // Object as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -126,11 +126,11 @@ FieldsEmbed.js
* @example
*
* // Methods as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -185,7 +185,7 @@ FieldsEmbed.js
* @param {string} name - Name of the field.
* @param {Function} value - Value of the field. Function for Array.prototype.map().join('\n').
* @param {boolean} [inline=true] - Whether the field is inline with other field or not.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @returns {PaginationEmbed}
*/
formatField(name, value, inline = true) {
this.fields.push({ name, value, inline });
@@ -195,10 +195,10 @@ FieldsEmbed.js
/**
* Sets the maximum number of elements to be displayed per page.
- * @param {number} [number=10] - Maximum number of elements to be displayed per page.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @param {number} number - Maximum number of elements to be displayed per page.
+ * @returns {PaginationEmbed}
*/
- setElementsPerPage(number = 10) {
+ setElementsPerPage(number) {
if (typeof number !== 'number') throw new Error('setElementsPerPage() only accepts number type.');
this.elementsPerPage = number;
@@ -266,7 +266,7 @@ FieldsEmbed.js
diff --git a/docs/PaginationEmbed.html b/docs/PaginationEmbed.html
index 58d735a..994485d 100644
--- a/docs/PaginationEmbed.html
+++ b/docs/PaginationEmbed.html
@@ -22,7 +22,7 @@
@@ -299,7 +299,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -350,7 +350,7 @@ authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -951,10 +951,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -977,7 +973,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1029,7 +1025,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1055,12 +1051,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1084,23 +1076,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1126,10 +1102,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1281,10 +1253,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1307,7 +1275,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1416,8 +1384,6 @@ Parameters:
- <optional>
-
@@ -1428,12 +1394,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -1495,10 +1459,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1521,7 +1481,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -1599,12 +1559,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1628,23 +1584,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -1670,10 +1610,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1696,7 +1632,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -1774,12 +1710,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1806,23 +1738,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -1848,10 +1764,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1874,7 +1786,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -1952,12 +1864,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1981,23 +1889,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2023,10 +1915,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2049,7 +1937,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2127,12 +2015,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2156,24 +2040,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2198,10 +2066,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2237,7 +2101,7 @@ Returns:
diff --git a/docs/base_PaginationEmbed.js.html b/docs/base_PaginationEmbed.js.html
index c40af28..e74e322 100644
--- a/docs/base_PaginationEmbed.js.html
+++ b/docs/base_PaginationEmbed.js.html
@@ -22,7 +22,7 @@
@@ -63,7 +63,7 @@ base/PaginationEmbed.js
/**
* Options for the constructor.
* @typedef {Object} PaginationEmbedOptions
- * @property {User} [authorisedUser=null] - The authorised user to navigate the pages.
+ * @property {User} [authorizedUser=null] - The authorized user to navigate the pages.
* @property {TextChannel} channel - The channel where to send the embed.
* @property {ClientMessageOptions} [clientMessage=null] - Settings for the message sent by the client.
* @property {Array.<*>} array - An array of elements to paginate.
@@ -82,10 +82,10 @@ base/PaginationEmbed.js
super(options);
/**
- * The authorised user to navigate the pages.
+ * The authorized user to navigate the pages.
* @type {User}
*/
- this.authorisedUser = options.authorisedUser || null;
+ this.authorizedUser = options.authorizedUser || null;
/**
* The channel where to send the embed.
@@ -149,7 +149,7 @@ base/PaginationEmbed.js
/**
* Sets the array of elements to paginate.
* @param {Array} array - An array of elements to paginate.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -162,12 +162,12 @@ base/PaginationEmbed.js
}
/**
- * Set the authorised person to navigate the pages.
- * @param {User} [user=null] - The user object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * Set the authorized person to navigate the pages.
+ * @param {User} user - The user object.
+ * @returns {PaginationEmbed}
*/
- setAuthorisedUser(user = null) {
- this.authorisedUser = user;
+ setAuthorizedUser(user) {
+ this.authorizedUser = user;
return this;
}
@@ -175,7 +175,7 @@ base/PaginationEmbed.js
/**
* The channel where to send the embed.
* @param {TextChannel} channel - The channel object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setChannel(channel) {
this.channel = channel;
@@ -185,11 +185,11 @@ base/PaginationEmbed.js
/**
* Sets the settings for the message sent by the client.
- * @param {Message} [message=null] - The message object sent by the client, if there is any.
+ * @param {Message} message - The message object sent by the client.
* @param {string} [content='Preparing...'] - The custom message content while preparing the embed.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
- setClientMessage(message = null, content = null) {
+ setClientMessage(message, content = null) {
if (!content) content = 'Preparing...';
Object.assign(this.clientMessage, { message, content });
@@ -199,8 +199,8 @@ base/PaginationEmbed.js
/**
* Sets the emojis used for navigation buttons.
- * @param {NavigationButtons} [emojis={}] - An object containing customised emojis to use as navigation buttons.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {NavigationButtons} emojis - An object containing customised emojis to use as navigation buttons.
+ * @returns {PaginationEmbed}
*/
setEmojis(emojis) {
Object.assign(this.emojis, emojis);
@@ -210,10 +210,10 @@ base/PaginationEmbed.js
/**
* Sets to jump to a certain page upon calling PaginationEmbed.build().
- * @param {number|string} [param=1] - The page number to jump to. As String: 'back', 'forward'
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number|string} param - The page number to jump to. As String: 'back', 'forward'
+ * @returns {PaginationEmbed}
*/
- setPage(param = 1) {
+ setPage(param) {
const isString = typeof param === 'string';
if (!(!isNaN(param) || isString)) throw new Error('setPage() only accepts number/string type.');
@@ -229,10 +229,10 @@ base/PaginationEmbed.js
/**
* Sets the time for awaiting a user action before timeout in ms.
- * @param {number} [timeout=30000] Timeout value in ms.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number} timeout Timeout value in ms.
+ * @returns {PaginationEmbed}
*/
- setTimeout(timeout = 30000) {
+ setTimeout(timeout) {
if (typeof timeout !== 'number') throw new Error('setTimeout() only accepts number type.');
this.timeout = timeout;
@@ -242,10 +242,10 @@ base/PaginationEmbed.js
/**
* Sets whether page number indicator on client's message is shown or not.
- * @param {boolean} [boolean=true] - Show page indicator?
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {boolean} boolean - Show page indicator?
+ * @returns {PaginationEmbed}
*/
- showPageIndicator(boolean = true) {
+ showPageIndicator(boolean) {
if (typeof boolean !== 'boolean') throw new Error('showPageIndicator() only accepts boolean type.');
this.pageIndicator = boolean;
@@ -261,7 +261,7 @@ base/PaginationEmbed.js
async _verify(pages) {
this
.setChannel(this.channel)
- .setAuthorisedUser(this.authorisedUser)
+ .setAuthorizedUser(this.authorizedUser)
.setClientMessage(this.clientMessage.message, this.clientMessage.content)
.setArray(this.array)
.showPageIndicator(this.pageIndicator)
@@ -337,8 +337,8 @@ base/PaginationEmbed.js
async _awaitResponse() {
const emojis = Object.values(this.emojis);
const filter = (r, u) => {
- if (this.authorisedUser)
- return u.id === this.authorisedUser.id && emojis.includes(r.emoji.name);
+ if (this.authorizedUser)
+ return u.id === this.authorizedUser.id && emojis.includes(r.emoji.name);
return !u.bot && emojis.includes(r.emoji.name);
};
@@ -432,7 +432,7 @@ base/PaginationEmbed.js
diff --git a/docs/global.html b/docs/global.html
index 23000ba..3f7e34b 100644
--- a/docs/global.html
+++ b/docs/global.html
@@ -22,7 +22,7 @@
@@ -1487,7 +1487,7 @@ Properties:
- authorisedUser
+ authorizedUser
@@ -1517,7 +1517,7 @@ Properties:
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -1820,7 +1820,7 @@ Type:
diff --git a/docs/index.html b/docs/index.html
index 80eb8c4..c53f893 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -22,7 +22,7 @@
@@ -51,20 +51,21 @@ Home
Classes
// Object as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed({
authorisedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
+ // Object as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed({
authorizedUser: message.author,
channel: message.channel,
clientMessage: { content: 'Preparing the embed...' },
array: [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
],
elementsPerPage: 1,
pageIndicator: false,
fields: [
{ name: 'ID', value: el => el.id },
{ name: 'Name', value: el => el.name }
],
page: 2,
timeout: 69000,
emojis: {
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
}
}).build();
- // Methods as constructor.
const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
// Under message event.
new FieldsEmbed()
.setAuthorisedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
+ // Methods as constructor.
const { FieldsEmbed } = require('discord-paginationembed');
// Under message event.
new FieldsEmbed()
.setAuthorizedUser(message.author)
.setChannel(message.channel)
.setClientMessage(null, 'Preparing the embed...')
.setArray([
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Jane Doe' }
])
.setElementsPerPage(1)
.setPageIndicator(false)
.formatField('ID', el => el.id)
.formatField('Name', el => el.name)
.setPage(2)
.setTimeout(69000)
.setEmojis({
back: '◀',
jump: '↗',
forward: '▶',
delete: '🗑'
})
.build();
@@ -1089,7 +1099,7 @@ Examples
-formatField(name, value, inlineopt) → {FieldsEmbed}
+formatField(name, value, inlineopt) → {PaginationEmbed}
@@ -1308,10 +1318,6 @@Parameters:
Returns:
--
@@ -1320,7 +1326,7 @@
Returns:
Parameters:
Returns:
--
@@ -1494,7 +1496,7 @@
Returns:
-setAuthorisedUser(useropt) → {PaginationEmbed}
+setAuthorizedUser(user) → {PaginationEmbed}
@@ -1517,7 +1519,7 @@setA
setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1577,12 +1579,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1606,23 +1604,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1648,10 +1630,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1808,10 +1786,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1834,7 +1808,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1948,8 +1922,6 @@ Parameters:
- <optional>
-
@@ -1960,12 +1932,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -2027,10 +1997,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2053,7 +2019,7 @@ Returns:
- setElementsPerPage(numberopt) → {FieldsEmbed}
+ setElementsPerPage(number) → {PaginationEmbed}
@@ -2131,12 +2097,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2160,24 +2122,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 10
-
-
-
Maximum number of elements to be displayed per page.
@@ -2202,10 +2148,6 @@ Parameters:
Returns:
-
- - Instance of FieldsEmbed
-
-
@@ -2214,7 +2156,7 @@ Returns:
Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -2311,12 +2253,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2340,23 +2278,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -2382,10 +2304,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2408,7 +2326,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -2491,12 +2409,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2523,24 +2437,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- 1
-
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -2565,10 +2463,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2591,7 +2485,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -2674,12 +2568,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2703,23 +2593,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2745,10 +2619,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2771,7 +2641,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2854,12 +2724,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2883,24 +2749,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2925,10 +2775,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2964,7 +2810,7 @@ Returns:
diff --git a/docs/FieldsEmbed.js.html b/docs/FieldsEmbed.js.html
index 5d36097..9bad270 100644
--- a/docs/FieldsEmbed.js.html
+++ b/docs/FieldsEmbed.js.html
@@ -22,7 +22,7 @@
@@ -81,7 +81,7 @@ FieldsEmbed.js
/**
* Elements in the current page.
- * @returns {Array.<*>} - An array for a page.
+ * @type {Array.<*>}
*/
get elementList() {
const begin = (this.page - 1) * this.elementsPerPage;
@@ -96,11 +96,11 @@ FieldsEmbed.js
* @example
*
* // Object as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed({
- * authorisedUser: message.author,
+ * authorizedUser: message.author,
* channel: message.channel,
* clientMessage: { content: 'Preparing the embed...' },
* array: [
@@ -126,11 +126,11 @@ FieldsEmbed.js
* @example
*
* // Methods as constructor.
- * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed;
+ * const { FieldsEmbed } = require('discord-paginationembed');
*
* // Under message event.
* new FieldsEmbed()
- * .setAuthorisedUser(message.author)
+ * .setAuthorizedUser(message.author)
* .setChannel(message.channel)
* .setClientMessage(null, 'Preparing the embed...')
* .setArray([
@@ -185,7 +185,7 @@ FieldsEmbed.js
* @param {string} name - Name of the field.
* @param {Function} value - Value of the field. Function for Array.prototype.map().join('\n').
* @param {boolean} [inline=true] - Whether the field is inline with other field or not.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @returns {PaginationEmbed}
*/
formatField(name, value, inline = true) {
this.fields.push({ name, value, inline });
@@ -195,10 +195,10 @@ FieldsEmbed.js
/**
* Sets the maximum number of elements to be displayed per page.
- * @param {number} [number=10] - Maximum number of elements to be displayed per page.
- * @returns {FieldsEmbed} - Instance of FieldsEmbed
+ * @param {number} number - Maximum number of elements to be displayed per page.
+ * @returns {PaginationEmbed}
*/
- setElementsPerPage(number = 10) {
+ setElementsPerPage(number) {
if (typeof number !== 'number') throw new Error('setElementsPerPage() only accepts number type.');
this.elementsPerPage = number;
@@ -266,7 +266,7 @@ FieldsEmbed.js
diff --git a/docs/PaginationEmbed.html b/docs/PaginationEmbed.html
index 58d735a..994485d 100644
--- a/docs/PaginationEmbed.html
+++ b/docs/PaginationEmbed.html
@@ -22,7 +22,7 @@
@@ -299,7 +299,7 @@ Type:
-authorisedUser :User
+authorizedUser :User
@@ -350,7 +350,7 @@ authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -951,10 +951,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -977,7 +973,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1029,7 +1025,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1055,12 +1051,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1084,23 +1076,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1126,10 +1102,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1281,10 +1253,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1307,7 +1275,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1416,8 +1384,6 @@ Parameters:
- <optional>
-
@@ -1428,12 +1394,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -1495,10 +1459,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1521,7 +1481,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -1599,12 +1559,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1628,23 +1584,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -1670,10 +1610,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1696,7 +1632,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -1774,12 +1710,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1806,23 +1738,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -1848,10 +1764,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1874,7 +1786,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -1952,12 +1864,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1981,23 +1889,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2023,10 +1915,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2049,7 +1937,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2127,12 +2015,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2156,24 +2040,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2198,10 +2066,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2237,7 +2101,7 @@ Returns:
diff --git a/docs/base_PaginationEmbed.js.html b/docs/base_PaginationEmbed.js.html
index c40af28..e74e322 100644
--- a/docs/base_PaginationEmbed.js.html
+++ b/docs/base_PaginationEmbed.js.html
@@ -22,7 +22,7 @@
@@ -63,7 +63,7 @@ base/PaginationEmbed.js
/**
* Options for the constructor.
* @typedef {Object} PaginationEmbedOptions
- * @property {User} [authorisedUser=null] - The authorised user to navigate the pages.
+ * @property {User} [authorizedUser=null] - The authorized user to navigate the pages.
* @property {TextChannel} channel - The channel where to send the embed.
* @property {ClientMessageOptions} [clientMessage=null] - Settings for the message sent by the client.
* @property {Array.<*>} array - An array of elements to paginate.
@@ -82,10 +82,10 @@ base/PaginationEmbed.js
super(options);
/**
- * The authorised user to navigate the pages.
+ * The authorized user to navigate the pages.
* @type {User}
*/
- this.authorisedUser = options.authorisedUser || null;
+ this.authorizedUser = options.authorizedUser || null;
/**
* The channel where to send the embed.
@@ -149,7 +149,7 @@ base/PaginationEmbed.js
/**
* Sets the array of elements to paginate.
* @param {Array} array - An array of elements to paginate.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -162,12 +162,12 @@ base/PaginationEmbed.js
}
/**
- * Set the authorised person to navigate the pages.
- * @param {User} [user=null] - The user object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * Set the authorized person to navigate the pages.
+ * @param {User} user - The user object.
+ * @returns {PaginationEmbed}
*/
- setAuthorisedUser(user = null) {
- this.authorisedUser = user;
+ setAuthorizedUser(user) {
+ this.authorizedUser = user;
return this;
}
@@ -175,7 +175,7 @@ base/PaginationEmbed.js
/**
* The channel where to send the embed.
* @param {TextChannel} channel - The channel object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setChannel(channel) {
this.channel = channel;
@@ -185,11 +185,11 @@ base/PaginationEmbed.js
/**
* Sets the settings for the message sent by the client.
- * @param {Message} [message=null] - The message object sent by the client, if there is any.
+ * @param {Message} message - The message object sent by the client.
* @param {string} [content='Preparing...'] - The custom message content while preparing the embed.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
- setClientMessage(message = null, content = null) {
+ setClientMessage(message, content = null) {
if (!content) content = 'Preparing...';
Object.assign(this.clientMessage, { message, content });
@@ -199,8 +199,8 @@ base/PaginationEmbed.js
/**
* Sets the emojis used for navigation buttons.
- * @param {NavigationButtons} [emojis={}] - An object containing customised emojis to use as navigation buttons.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {NavigationButtons} emojis - An object containing customised emojis to use as navigation buttons.
+ * @returns {PaginationEmbed}
*/
setEmojis(emojis) {
Object.assign(this.emojis, emojis);
@@ -210,10 +210,10 @@ base/PaginationEmbed.js
/**
* Sets to jump to a certain page upon calling PaginationEmbed.build().
- * @param {number|string} [param=1] - The page number to jump to. As String: 'back', 'forward'
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number|string} param - The page number to jump to. As String: 'back', 'forward'
+ * @returns {PaginationEmbed}
*/
- setPage(param = 1) {
+ setPage(param) {
const isString = typeof param === 'string';
if (!(!isNaN(param) || isString)) throw new Error('setPage() only accepts number/string type.');
@@ -229,10 +229,10 @@ base/PaginationEmbed.js
/**
* Sets the time for awaiting a user action before timeout in ms.
- * @param {number} [timeout=30000] Timeout value in ms.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number} timeout Timeout value in ms.
+ * @returns {PaginationEmbed}
*/
- setTimeout(timeout = 30000) {
+ setTimeout(timeout) {
if (typeof timeout !== 'number') throw new Error('setTimeout() only accepts number type.');
this.timeout = timeout;
@@ -242,10 +242,10 @@ base/PaginationEmbed.js
/**
* Sets whether page number indicator on client's message is shown or not.
- * @param {boolean} [boolean=true] - Show page indicator?
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {boolean} boolean - Show page indicator?
+ * @returns {PaginationEmbed}
*/
- showPageIndicator(boolean = true) {
+ showPageIndicator(boolean) {
if (typeof boolean !== 'boolean') throw new Error('showPageIndicator() only accepts boolean type.');
this.pageIndicator = boolean;
@@ -261,7 +261,7 @@ base/PaginationEmbed.js
async _verify(pages) {
this
.setChannel(this.channel)
- .setAuthorisedUser(this.authorisedUser)
+ .setAuthorizedUser(this.authorizedUser)
.setClientMessage(this.clientMessage.message, this.clientMessage.content)
.setArray(this.array)
.showPageIndicator(this.pageIndicator)
@@ -337,8 +337,8 @@ base/PaginationEmbed.js
async _awaitResponse() {
const emojis = Object.values(this.emojis);
const filter = (r, u) => {
- if (this.authorisedUser)
- return u.id === this.authorisedUser.id && emojis.includes(r.emoji.name);
+ if (this.authorizedUser)
+ return u.id === this.authorizedUser.id && emojis.includes(r.emoji.name);
return !u.bot && emojis.includes(r.emoji.name);
};
@@ -432,7 +432,7 @@ base/PaginationEmbed.js
diff --git a/docs/global.html b/docs/global.html
index 23000ba..3f7e34b 100644
--- a/docs/global.html
+++ b/docs/global.html
@@ -22,7 +22,7 @@
@@ -1487,7 +1487,7 @@ Properties:
- authorisedUser
+ authorizedUser
@@ -1517,7 +1517,7 @@ Properties:
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -1820,7 +1820,7 @@ Type:
diff --git a/docs/index.html b/docs/index.html
index 80eb8c4..c53f893 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -22,7 +22,7 @@
@@ -51,20 +51,21 @@ Home
Classes
Parameters:
Parameters:
-- - - - -
null
-
- Parameters:
Returns:
--
@@ -1808,10 +1786,6 @@
Parameters:
Returns:
--
@@ -1834,7 +1808,7 @@
Returns:
-setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1948,8 +1922,6 @@Parameters:
- @@ -1960,12 +1932,10 @@
Parameters:
null
-
Parameters:
Returns:
--
@@ -2053,7 +2019,7 @@
Returns:
-setElementsPerPage(numberopt) → {FieldsEmbed}
+setElementsPerPage(number) → {PaginationEmbed}
@@ -2131,12 +2097,8 @@Parameters:
Parameters:
-- - - - - -
10
-
- Parameters:
Returns:
--
@@ -2214,7 +2156,7 @@
Returns:
Returns:
-setEmojis(emojisopt) → {PaginationEmbed}
+setEmojis(emojis) → {PaginationEmbed}
@@ -2311,12 +2253,8 @@Parameters:
Parameters:
-- - - - -
{}
-
- Parameters:
Returns:
--
@@ -2408,7 +2326,7 @@
Returns:
-setPage(paramopt) → {PaginationEmbed}
+setPage(param) → {PaginationEmbed}
@@ -2491,12 +2409,8 @@Parameters:
Parameters:
-- - - - - -
1
-
- Parameters:
Returns:
--
@@ -2591,7 +2485,7 @@
Returns:
-setTimeout(timeoutopt) → {PaginationEmbed}
+setTimeout(timeout) → {PaginationEmbed}
@@ -2674,12 +2568,8 @@Parameters:
Parameters:
-- - - - -
30000
-
- Parameters:
Returns:
--
@@ -2771,7 +2641,7 @@
Returns:
-showPageIndicator(booleanopt) → {PaginationEmbed}
+showPageIndicator(boolean) → {PaginationEmbed}
@@ -2854,12 +2724,8 @@Parameters:
Parameters:
-- - - - - -
true
-
- Parameters:
Returns:
--
@@ -2964,7 +2810,7 @@
Returns:
diff --git a/docs/FieldsEmbed.js.html b/docs/FieldsEmbed.js.html index 5d36097..9bad270 100644 --- a/docs/FieldsEmbed.js.html +++ b/docs/FieldsEmbed.js.html @@ -22,7 +22,7 @@
FieldsEmbed.js
/** * Elements in the current page. - * @returns {Array.<*>} - An array for a page. + * @type {Array.<*>} */ get elementList() { const begin = (this.page - 1) * this.elementsPerPage; @@ -96,11 +96,11 @@FieldsEmbed.js
* @example * * // Object as constructor. - * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed; + * const { FieldsEmbed } = require('discord-paginationembed'); * * // Under message event. * new FieldsEmbed({ - * authorisedUser: message.author, + * authorizedUser: message.author, * channel: message.channel, * clientMessage: { content: 'Preparing the embed...' }, * array: [ @@ -126,11 +126,11 @@FieldsEmbed.js
* @example * * // Methods as constructor. - * const FieldsEmbed = require('discord-paginationembed').FieldsEmbed; + * const { FieldsEmbed } = require('discord-paginationembed'); * * // Under message event. * new FieldsEmbed() - * .setAuthorisedUser(message.author) + * .setAuthorizedUser(message.author) * .setChannel(message.channel) * .setClientMessage(null, 'Preparing the embed...') * .setArray([ @@ -185,7 +185,7 @@FieldsEmbed.js
* @param {string} name - Name of the field. * @param {Function} value - Value of the field. Function for Array.prototype.map().join('\n'). * @param {boolean} [inline=true] - Whether the field is inline with other field or not. - * @returns {FieldsEmbed} - Instance of FieldsEmbed + * @returns {PaginationEmbed} */ formatField(name, value, inline = true) { this.fields.push({ name, value, inline }); @@ -195,10 +195,10 @@FieldsEmbed.js
/** * Sets the maximum number of elements to be displayed per page. - * @param {number} [number=10] - Maximum number of elements to be displayed per page. - * @returns {FieldsEmbed} - Instance of FieldsEmbed + * @param {number} number - Maximum number of elements to be displayed per page. + * @returns {PaginationEmbed} */ - setElementsPerPage(number = 10) { + setElementsPerPage(number) { if (typeof number !== 'number') throw new Error('setElementsPerPage() only accepts number type.'); this.elementsPerPage = number; @@ -266,7 +266,7 @@FieldsEmbed.js
diff --git a/docs/PaginationEmbed.html b/docs/PaginationEmbed.html index 58d735a..994485d 100644 --- a/docs/PaginationEmbed.html +++ b/docs/PaginationEmbed.html @@ -22,7 +22,7 @@
Type:
-authorisedUser :User
+authorizedUser :User
@@ -350,7 +350,7 @@authori
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -951,10 +951,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -977,7 +973,7 @@ Returns:
- setAuthorisedUser(useropt) → {PaginationEmbed}
+ setAuthorizedUser(user) → {PaginationEmbed}
@@ -1029,7 +1025,7 @@ setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1055,12 +1051,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1084,23 +1076,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1126,10 +1102,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1281,10 +1253,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1307,7 +1275,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1416,8 +1384,6 @@ Parameters:
- <optional>
-
@@ -1428,12 +1394,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -1495,10 +1459,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1521,7 +1481,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -1599,12 +1559,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1628,23 +1584,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -1670,10 +1610,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1696,7 +1632,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -1774,12 +1710,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1806,23 +1738,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -1848,10 +1764,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1874,7 +1786,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -1952,12 +1864,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1981,23 +1889,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2023,10 +1915,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2049,7 +1937,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2127,12 +2015,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2156,24 +2040,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2198,10 +2066,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2237,7 +2101,7 @@ Returns:
diff --git a/docs/base_PaginationEmbed.js.html b/docs/base_PaginationEmbed.js.html
index c40af28..e74e322 100644
--- a/docs/base_PaginationEmbed.js.html
+++ b/docs/base_PaginationEmbed.js.html
@@ -22,7 +22,7 @@
@@ -63,7 +63,7 @@ base/PaginationEmbed.js
/**
* Options for the constructor.
* @typedef {Object} PaginationEmbedOptions
- * @property {User} [authorisedUser=null] - The authorised user to navigate the pages.
+ * @property {User} [authorizedUser=null] - The authorized user to navigate the pages.
* @property {TextChannel} channel - The channel where to send the embed.
* @property {ClientMessageOptions} [clientMessage=null] - Settings for the message sent by the client.
* @property {Array.<*>} array - An array of elements to paginate.
@@ -82,10 +82,10 @@ base/PaginationEmbed.js
super(options);
/**
- * The authorised user to navigate the pages.
+ * The authorized user to navigate the pages.
* @type {User}
*/
- this.authorisedUser = options.authorisedUser || null;
+ this.authorizedUser = options.authorizedUser || null;
/**
* The channel where to send the embed.
@@ -149,7 +149,7 @@ base/PaginationEmbed.js
/**
* Sets the array of elements to paginate.
* @param {Array} array - An array of elements to paginate.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -162,12 +162,12 @@ base/PaginationEmbed.js
}
/**
- * Set the authorised person to navigate the pages.
- * @param {User} [user=null] - The user object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * Set the authorized person to navigate the pages.
+ * @param {User} user - The user object.
+ * @returns {PaginationEmbed}
*/
- setAuthorisedUser(user = null) {
- this.authorisedUser = user;
+ setAuthorizedUser(user) {
+ this.authorizedUser = user;
return this;
}
@@ -175,7 +175,7 @@ base/PaginationEmbed.js
/**
* The channel where to send the embed.
* @param {TextChannel} channel - The channel object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setChannel(channel) {
this.channel = channel;
@@ -185,11 +185,11 @@ base/PaginationEmbed.js
/**
* Sets the settings for the message sent by the client.
- * @param {Message} [message=null] - The message object sent by the client, if there is any.
+ * @param {Message} message - The message object sent by the client.
* @param {string} [content='Preparing...'] - The custom message content while preparing the embed.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
- setClientMessage(message = null, content = null) {
+ setClientMessage(message, content = null) {
if (!content) content = 'Preparing...';
Object.assign(this.clientMessage, { message, content });
@@ -199,8 +199,8 @@ base/PaginationEmbed.js
/**
* Sets the emojis used for navigation buttons.
- * @param {NavigationButtons} [emojis={}] - An object containing customised emojis to use as navigation buttons.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {NavigationButtons} emojis - An object containing customised emojis to use as navigation buttons.
+ * @returns {PaginationEmbed}
*/
setEmojis(emojis) {
Object.assign(this.emojis, emojis);
@@ -210,10 +210,10 @@ base/PaginationEmbed.js
/**
* Sets to jump to a certain page upon calling PaginationEmbed.build().
- * @param {number|string} [param=1] - The page number to jump to. As String: 'back', 'forward'
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number|string} param - The page number to jump to. As String: 'back', 'forward'
+ * @returns {PaginationEmbed}
*/
- setPage(param = 1) {
+ setPage(param) {
const isString = typeof param === 'string';
if (!(!isNaN(param) || isString)) throw new Error('setPage() only accepts number/string type.');
@@ -229,10 +229,10 @@ base/PaginationEmbed.js
/**
* Sets the time for awaiting a user action before timeout in ms.
- * @param {number} [timeout=30000] Timeout value in ms.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number} timeout Timeout value in ms.
+ * @returns {PaginationEmbed}
*/
- setTimeout(timeout = 30000) {
+ setTimeout(timeout) {
if (typeof timeout !== 'number') throw new Error('setTimeout() only accepts number type.');
this.timeout = timeout;
@@ -242,10 +242,10 @@ base/PaginationEmbed.js
/**
* Sets whether page number indicator on client's message is shown or not.
- * @param {boolean} [boolean=true] - Show page indicator?
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {boolean} boolean - Show page indicator?
+ * @returns {PaginationEmbed}
*/
- showPageIndicator(boolean = true) {
+ showPageIndicator(boolean) {
if (typeof boolean !== 'boolean') throw new Error('showPageIndicator() only accepts boolean type.');
this.pageIndicator = boolean;
@@ -261,7 +261,7 @@ base/PaginationEmbed.js
async _verify(pages) {
this
.setChannel(this.channel)
- .setAuthorisedUser(this.authorisedUser)
+ .setAuthorizedUser(this.authorizedUser)
.setClientMessage(this.clientMessage.message, this.clientMessage.content)
.setArray(this.array)
.showPageIndicator(this.pageIndicator)
@@ -337,8 +337,8 @@ base/PaginationEmbed.js
async _awaitResponse() {
const emojis = Object.values(this.emojis);
const filter = (r, u) => {
- if (this.authorisedUser)
- return u.id === this.authorisedUser.id && emojis.includes(r.emoji.name);
+ if (this.authorizedUser)
+ return u.id === this.authorizedUser.id && emojis.includes(r.emoji.name);
return !u.bot && emojis.includes(r.emoji.name);
};
@@ -432,7 +432,7 @@ base/PaginationEmbed.js
diff --git a/docs/global.html b/docs/global.html
index 23000ba..3f7e34b 100644
--- a/docs/global.html
+++ b/docs/global.html
@@ -22,7 +22,7 @@
@@ -1487,7 +1487,7 @@ Properties:
- authorisedUser
+ authorizedUser
@@ -1517,7 +1517,7 @@ Properties:
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -1820,7 +1820,7 @@ Type:
diff --git a/docs/index.html b/docs/index.html
index 80eb8c4..c53f893 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -22,7 +22,7 @@
@@ -51,20 +51,21 @@ Home
Classes
Returns:
-setAuthorisedUser(useropt) → {PaginationEmbed}
+setAuthorizedUser(user) → {PaginationEmbed}
@@ -1029,7 +1025,7 @@setA
- Set the authorised person to navigate the pages.
+ Set the authorized person to navigate the pages.
@@ -1055,12 +1051,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1084,23 +1076,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- null
-
-
The user object.
@@ -1126,10 +1102,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1281,10 +1253,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1307,7 +1275,7 @@ Returns:
- setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+ setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1416,8 +1384,6 @@ Parameters:
- <optional>
-
@@ -1428,12 +1394,10 @@ Parameters:
- null
-
- The message object sent by the client, if there is any.
+ The message object sent by the client.
@@ -1495,10 +1459,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1521,7 +1481,7 @@ Returns:
- setEmojis(emojisopt) → {PaginationEmbed}
+ setEmojis(emojis) → {PaginationEmbed}
@@ -1599,12 +1559,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1628,23 +1584,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- {}
-
-
An object containing customised emojis to use as navigation buttons.
@@ -1670,10 +1610,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1696,7 +1632,7 @@ Returns:
- setPage(paramopt) → {PaginationEmbed}
+ setPage(param) → {PaginationEmbed}
@@ -1774,12 +1710,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1806,23 +1738,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 1
-
-
The page number to jump to. As String: 'back', 'forward'
@@ -1848,10 +1764,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -1874,7 +1786,7 @@ Returns:
- setTimeout(timeoutopt) → {PaginationEmbed}
+ setTimeout(timeout) → {PaginationEmbed}
@@ -1952,12 +1864,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -1981,23 +1889,7 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- 30000
-
-
Timeout value in ms.
@@ -2023,10 +1915,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2049,7 +1937,7 @@ Returns:
- showPageIndicator(booleanopt) → {PaginationEmbed}
+ showPageIndicator(boolean) → {PaginationEmbed}
@@ -2127,12 +2015,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2156,24 +2040,8 @@ Parameters:
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
Show page indicator?
@@ -2198,10 +2066,6 @@ Parameters:
Returns:
-
- - Instance of PaginationEmbed
-
-
@@ -2237,7 +2101,7 @@ Returns:
diff --git a/docs/base_PaginationEmbed.js.html b/docs/base_PaginationEmbed.js.html
index c40af28..e74e322 100644
--- a/docs/base_PaginationEmbed.js.html
+++ b/docs/base_PaginationEmbed.js.html
@@ -22,7 +22,7 @@
@@ -63,7 +63,7 @@ base/PaginationEmbed.js
/**
* Options for the constructor.
* @typedef {Object} PaginationEmbedOptions
- * @property {User} [authorisedUser=null] - The authorised user to navigate the pages.
+ * @property {User} [authorizedUser=null] - The authorized user to navigate the pages.
* @property {TextChannel} channel - The channel where to send the embed.
* @property {ClientMessageOptions} [clientMessage=null] - Settings for the message sent by the client.
* @property {Array.<*>} array - An array of elements to paginate.
@@ -82,10 +82,10 @@ base/PaginationEmbed.js
super(options);
/**
- * The authorised user to navigate the pages.
+ * The authorized user to navigate the pages.
* @type {User}
*/
- this.authorisedUser = options.authorisedUser || null;
+ this.authorizedUser = options.authorizedUser || null;
/**
* The channel where to send the embed.
@@ -149,7 +149,7 @@ base/PaginationEmbed.js
/**
* Sets the array of elements to paginate.
* @param {Array} array - An array of elements to paginate.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setArray(array) {
const isValidArray = Array.isArray(array) && Boolean(array.length);
@@ -162,12 +162,12 @@ base/PaginationEmbed.js
}
/**
- * Set the authorised person to navigate the pages.
- * @param {User} [user=null] - The user object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * Set the authorized person to navigate the pages.
+ * @param {User} user - The user object.
+ * @returns {PaginationEmbed}
*/
- setAuthorisedUser(user = null) {
- this.authorisedUser = user;
+ setAuthorizedUser(user) {
+ this.authorizedUser = user;
return this;
}
@@ -175,7 +175,7 @@ base/PaginationEmbed.js
/**
* The channel where to send the embed.
* @param {TextChannel} channel - The channel object.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
setChannel(channel) {
this.channel = channel;
@@ -185,11 +185,11 @@ base/PaginationEmbed.js
/**
* Sets the settings for the message sent by the client.
- * @param {Message} [message=null] - The message object sent by the client, if there is any.
+ * @param {Message} message - The message object sent by the client.
* @param {string} [content='Preparing...'] - The custom message content while preparing the embed.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @returns {PaginationEmbed}
*/
- setClientMessage(message = null, content = null) {
+ setClientMessage(message, content = null) {
if (!content) content = 'Preparing...';
Object.assign(this.clientMessage, { message, content });
@@ -199,8 +199,8 @@ base/PaginationEmbed.js
/**
* Sets the emojis used for navigation buttons.
- * @param {NavigationButtons} [emojis={}] - An object containing customised emojis to use as navigation buttons.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {NavigationButtons} emojis - An object containing customised emojis to use as navigation buttons.
+ * @returns {PaginationEmbed}
*/
setEmojis(emojis) {
Object.assign(this.emojis, emojis);
@@ -210,10 +210,10 @@ base/PaginationEmbed.js
/**
* Sets to jump to a certain page upon calling PaginationEmbed.build().
- * @param {number|string} [param=1] - The page number to jump to. As String: 'back', 'forward'
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number|string} param - The page number to jump to. As String: 'back', 'forward'
+ * @returns {PaginationEmbed}
*/
- setPage(param = 1) {
+ setPage(param) {
const isString = typeof param === 'string';
if (!(!isNaN(param) || isString)) throw new Error('setPage() only accepts number/string type.');
@@ -229,10 +229,10 @@ base/PaginationEmbed.js
/**
* Sets the time for awaiting a user action before timeout in ms.
- * @param {number} [timeout=30000] Timeout value in ms.
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {number} timeout Timeout value in ms.
+ * @returns {PaginationEmbed}
*/
- setTimeout(timeout = 30000) {
+ setTimeout(timeout) {
if (typeof timeout !== 'number') throw new Error('setTimeout() only accepts number type.');
this.timeout = timeout;
@@ -242,10 +242,10 @@ base/PaginationEmbed.js
/**
* Sets whether page number indicator on client's message is shown or not.
- * @param {boolean} [boolean=true] - Show page indicator?
- * @returns {PaginationEmbed} - Instance of PaginationEmbed
+ * @param {boolean} boolean - Show page indicator?
+ * @returns {PaginationEmbed}
*/
- showPageIndicator(boolean = true) {
+ showPageIndicator(boolean) {
if (typeof boolean !== 'boolean') throw new Error('showPageIndicator() only accepts boolean type.');
this.pageIndicator = boolean;
@@ -261,7 +261,7 @@ base/PaginationEmbed.js
async _verify(pages) {
this
.setChannel(this.channel)
- .setAuthorisedUser(this.authorisedUser)
+ .setAuthorizedUser(this.authorizedUser)
.setClientMessage(this.clientMessage.message, this.clientMessage.content)
.setArray(this.array)
.showPageIndicator(this.pageIndicator)
@@ -337,8 +337,8 @@ base/PaginationEmbed.js
async _awaitResponse() {
const emojis = Object.values(this.emojis);
const filter = (r, u) => {
- if (this.authorisedUser)
- return u.id === this.authorisedUser.id && emojis.includes(r.emoji.name);
+ if (this.authorizedUser)
+ return u.id === this.authorizedUser.id && emojis.includes(r.emoji.name);
return !u.bot && emojis.includes(r.emoji.name);
};
@@ -432,7 +432,7 @@ base/PaginationEmbed.js
diff --git a/docs/global.html b/docs/global.html
index 23000ba..3f7e34b 100644
--- a/docs/global.html
+++ b/docs/global.html
@@ -22,7 +22,7 @@
@@ -1487,7 +1487,7 @@ Properties:
- authorisedUser
+ authorizedUser
@@ -1517,7 +1517,7 @@ Properties:
- The authorised user to navigate the pages.
+ The authorized user to navigate the pages.
@@ -1820,7 +1820,7 @@ Type:
diff --git a/docs/index.html b/docs/index.html
index 80eb8c4..c53f893 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -22,7 +22,7 @@
@@ -51,20 +51,21 @@ Home
Classes
- - - - -
null
-
- Parameters:
Returns:
--
@@ -1307,7 +1275,7 @@
Returns:
-setClientMessage(messageopt, contentopt) → {PaginationEmbed}
+setClientMessage(message, contentopt) → {PaginationEmbed}
@@ -1416,8 +1384,6 @@Parameters:
- @@ -1428,12 +1394,10 @@
Parameters:
null
-
Parameters:
Returns:
--
@@ -1521,7 +1481,7 @@
Returns:
-setEmojis(emojisopt) → {PaginationEmbed}
+setEmojis(emojis) → {PaginationEmbed}
@@ -1599,12 +1559,8 @@Parameters:
Parameters:
-- - - - -
{}
-
- Parameters:
Returns:
--
@@ -1696,7 +1632,7 @@
Returns:
-setPage(paramopt) → {PaginationEmbed}
+setPage(param) → {PaginationEmbed}
@@ -1774,12 +1710,8 @@Parameters:
Parameters:
-- - - - -
1
-
- Parameters:
Returns:
--
@@ -1874,7 +1786,7 @@
Returns:
-setTimeout(timeoutopt) → {PaginationEmbed}
+setTimeout(timeout) → {PaginationEmbed}
@@ -1952,12 +1864,8 @@Parameters:
Parameters:
-- - - - -
30000
-
- Parameters:
Returns:
--
@@ -2049,7 +1937,7 @@
Returns:
-showPageIndicator(booleanopt) → {PaginationEmbed}
+showPageIndicator(boolean) → {PaginationEmbed}
@@ -2127,12 +2015,8 @@Parameters:
Parameters:
-- - - - - -
true
-
- Parameters:
Returns:
--
@@ -2237,7 +2101,7 @@
Returns:
diff --git a/docs/base_PaginationEmbed.js.html b/docs/base_PaginationEmbed.js.html index c40af28..e74e322 100644 --- a/docs/base_PaginationEmbed.js.html +++ b/docs/base_PaginationEmbed.js.html @@ -22,7 +22,7 @@
base/PaginationEmbed.js
/** * Options for the constructor. * @typedef {Object} PaginationEmbedOptions - * @property {User} [authorisedUser=null] - The authorised user to navigate the pages. + * @property {User} [authorizedUser=null] - The authorized user to navigate the pages. * @property {TextChannel} channel - The channel where to send the embed. * @property {ClientMessageOptions} [clientMessage=null] - Settings for the message sent by the client. * @property {Array.<*>} array - An array of elements to paginate. @@ -82,10 +82,10 @@base/PaginationEmbed.js
super(options); /** - * The authorised user to navigate the pages. + * The authorized user to navigate the pages. * @type {User} */ - this.authorisedUser = options.authorisedUser || null; + this.authorizedUser = options.authorizedUser || null; /** * The channel where to send the embed. @@ -149,7 +149,7 @@base/PaginationEmbed.js
/** * Sets the array of elements to paginate. * @param {Array} array - An array of elements to paginate. - * @returns {PaginationEmbed} - Instance of PaginationEmbed + * @returns {PaginationEmbed} */ setArray(array) { const isValidArray = Array.isArray(array) && Boolean(array.length); @@ -162,12 +162,12 @@base/PaginationEmbed.js
} /** - * Set the authorised person to navigate the pages. - * @param {User} [user=null] - The user object. - * @returns {PaginationEmbed} - Instance of PaginationEmbed + * Set the authorized person to navigate the pages. + * @param {User} user - The user object. + * @returns {PaginationEmbed} */ - setAuthorisedUser(user = null) { - this.authorisedUser = user; + setAuthorizedUser(user) { + this.authorizedUser = user; return this; } @@ -175,7 +175,7 @@base/PaginationEmbed.js
/** * The channel where to send the embed. * @param {TextChannel} channel - The channel object. - * @returns {PaginationEmbed} - Instance of PaginationEmbed + * @returns {PaginationEmbed} */ setChannel(channel) { this.channel = channel; @@ -185,11 +185,11 @@base/PaginationEmbed.js
/** * Sets the settings for the message sent by the client. - * @param {Message} [message=null] - The message object sent by the client, if there is any. + * @param {Message} message - The message object sent by the client. * @param {string} [content='Preparing...'] - The custom message content while preparing the embed. - * @returns {PaginationEmbed} - Instance of PaginationEmbed + * @returns {PaginationEmbed} */ - setClientMessage(message = null, content = null) { + setClientMessage(message, content = null) { if (!content) content = 'Preparing...'; Object.assign(this.clientMessage, { message, content }); @@ -199,8 +199,8 @@base/PaginationEmbed.js
/** * Sets the emojis used for navigation buttons. - * @param {NavigationButtons} [emojis={}] - An object containing customised emojis to use as navigation buttons. - * @returns {PaginationEmbed} - Instance of PaginationEmbed + * @param {NavigationButtons} emojis - An object containing customised emojis to use as navigation buttons. + * @returns {PaginationEmbed} */ setEmojis(emojis) { Object.assign(this.emojis, emojis); @@ -210,10 +210,10 @@base/PaginationEmbed.js
/** * Sets to jump to a certain page upon calling PaginationEmbed.build(). - * @param {number|string} [param=1] - The page number to jump to. As String: 'back', 'forward' - * @returns {PaginationEmbed} - Instance of PaginationEmbed + * @param {number|string} param - The page number to jump to. As String: 'back', 'forward' + * @returns {PaginationEmbed} */ - setPage(param = 1) { + setPage(param) { const isString = typeof param === 'string'; if (!(!isNaN(param) || isString)) throw new Error('setPage() only accepts number/string type.'); @@ -229,10 +229,10 @@base/PaginationEmbed.js
/** * Sets the time for awaiting a user action before timeout in ms. - * @param {number} [timeout=30000] Timeout value in ms. - * @returns {PaginationEmbed} - Instance of PaginationEmbed + * @param {number} timeout Timeout value in ms. + * @returns {PaginationEmbed} */ - setTimeout(timeout = 30000) { + setTimeout(timeout) { if (typeof timeout !== 'number') throw new Error('setTimeout() only accepts number type.'); this.timeout = timeout; @@ -242,10 +242,10 @@base/PaginationEmbed.js
/** * Sets whether page number indicator on client's message is shown or not. - * @param {boolean} [boolean=true] - Show page indicator? - * @returns {PaginationEmbed} - Instance of PaginationEmbed + * @param {boolean} boolean - Show page indicator? + * @returns {PaginationEmbed} */ - showPageIndicator(boolean = true) { + showPageIndicator(boolean) { if (typeof boolean !== 'boolean') throw new Error('showPageIndicator() only accepts boolean type.'); this.pageIndicator = boolean; @@ -261,7 +261,7 @@base/PaginationEmbed.js
async _verify(pages) { this .setChannel(this.channel) - .setAuthorisedUser(this.authorisedUser) + .setAuthorizedUser(this.authorizedUser) .setClientMessage(this.clientMessage.message, this.clientMessage.content) .setArray(this.array) .showPageIndicator(this.pageIndicator) @@ -337,8 +337,8 @@base/PaginationEmbed.js
async _awaitResponse() { const emojis = Object.values(this.emojis); const filter = (r, u) => { - if (this.authorisedUser) - return u.id === this.authorisedUser.id && emojis.includes(r.emoji.name); + if (this.authorizedUser) + return u.id === this.authorizedUser.id && emojis.includes(r.emoji.name); return !u.bot && emojis.includes(r.emoji.name); }; @@ -432,7 +432,7 @@base/PaginationEmbed.js
diff --git a/docs/global.html b/docs/global.html index 23000ba..3f7e34b 100644 --- a/docs/global.html +++ b/docs/global.html @@ -22,7 +22,7 @@
Properties:
authorisedUser
authorizedUser
Properties:
Type:
diff --git a/docs/index.html b/docs/index.html index 80eb8c4..c53f893 100644 --- a/docs/index.html +++ b/docs/index.html @@ -22,7 +22,7 @@