Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Embeds

A pagination mode that uses an array of MessageEmbed to paginate.

extends

PaginationEmbed

Hierarchy

Index

Properties

author

author: object

The author of all embeds.

Type declaration

  • Optional iconURL?: string
  • name: string
  • Optional url?: string

color

color: number

The color of all embeds.

description

description: string

The description of all embeds.

fields

fields: EmbedField[]

The fields of all embeds.

footer

footer: object

The footer of all embeds.

Type declaration

  • Optional iconURL?: string
  • text: string

image

image: string

The image of all embeds.

thumbnail

thumbnail: string

The thumbnail of all embeds.

timestamp

timestamp: number

The timestamp of all embeds.

title

title: string

The title of all embeds.

url

url: string

The URL of all embeds.

Accessors

currentEmbed

  • get currentEmbed(): MessageEmbed

Methods

addField

  • addField(name: string, value: StringResolvable, inline?: boolean): this
  • Adds a field to the fields of all embeds.

    Parameters

    • name: string

      The name of the field.

    • value: StringResolvable

      The value of the field.

    • Default value inline: boolean = false

      Whether the field is inline to the other fields.

    Returns this

addFields

  • addFields(...fields: EmbedFieldData[] | EmbedFieldData[][]): void
  • Parameters

    • Rest ...fields: EmbedFieldData[] | EmbedFieldData[][]

    Returns void

attachFiles

  • attachFiles(files: (string | FileOptions | MessageAttachment)[]): this
  • Files to attach to all embeds.

    Parameters

    • files: (string | FileOptions | MessageAttachment)[]

      Files to attach.

    Returns this

build

  • build(): Promise<void>
  • Build the Pagination Embeds.

    Example

      const { Embeds } = require('discord-paginationembed');
      const { MessageEmbed } = require('discord.js');
    
      // Under message event.
      const embeds = [];
    
      for (let i = 0; i < 5; ++i)
       embeds.push(new MessageEmbed().addField('Page', i + 1));
    
      new Embeds()
       .setAuthorizedUsers([message.author.id])
       .setChannel(message.channel)
       .setClientAssets({ prompt: 'Yo {{user}} wat peige?!?!?' })
       .setArray(embeds)
       .setPageIndicator(false)
       .setPage(1)
       .setTimeout(69000)
       .setNavigationEmojis({
         back: '◀',
         jump: '↗',
         forward: '▶',
         delete: '🗑'
       })
       .setFunctionEmojis({
         '⬆': (_, instance) => {
           for (const embed of instance.array)
             embed.fields[0].value++;
           },
         '⬇': (_, instance) => {
            for (const embed of instance.array)
              embed.fields[0].value--;
           }
       })
       .setDescription('This is one of my embeds with this message!')
       .setColor(0xFF00AE)
       .setTimestamp()
       .build();```

    Returns Promise<void>

setArray

  • setArray(array: MessageEmbed[]): this

setAuthor

  • setAuthor(name: string, iconURL?: string, url?: string): this
  • Set the author of all embeds.

    Parameters

    • name: string

      The name of the author.

    • Optional iconURL: string

      The icon URL of the author.

    • Optional url: string

      The URL of the author.

    Returns this

setColor

  • setColor(color: ColorResolvable): this
  • Sets the color of all embeds.

    Parameters

    • color: ColorResolvable

      The color of all embeds.

    Returns this

setDescription

  • setDescription(description: StringResolvable): this
  • Sets the description of all embeds.

    Parameters

    • description: StringResolvable

      The description of all embeds.

    Returns this

setFooter

  • setFooter(text: StringResolvable, iconURL?: string): this
  • Sets the footer of all embeds.

    Parameters

    • text: StringResolvable

      The footer text.

    • Optional iconURL: string

      URL for the footer's icon.

    Returns this

setImage

  • setImage(url: string): this
  • Sets the image of all embeds.

    Parameters

    • url: string

      The image of all embeds.

    Returns this

setThumbnail

  • setThumbnail(url: string): this
  • Sets the thumbnail of all embeds.

    Parameters

    • url: string

      The thumbnail of all embeds.

    Returns this

setTimestamp

  • setTimestamp(timestamp?: Date | number): this
  • Sets the timestamp of all embeds.

    Parameters

    • Optional timestamp: Date | number

      The timestamp or date.

    Returns this

setTitle

  • setTitle(title: StringResolvable): this
  • Sets the title of all embeds.

    Parameters

    • title: StringResolvable

      The title of all embeds.

    Returns this

setURL

  • setURL(url: string): this
  • Sets the URL of all embeds.

    Parameters

    • url: string

      The URL of all embeds.

    Returns this

spliceFields

  • spliceFields(index: number, deleteCount: number, name?: StringResolvable, value?: StringResolvable, inline?: boolean): this
  • Removes, replaces, and inserts fields in all embeds (max 25).

    Parameters

    • index: number

      The index to start at.

    • deleteCount: number

      The number of fields to remove.

    • Optional name: StringResolvable

      The name of the field.

    • Optional value: StringResolvable

      The value of the field.

    • Optional inline: boolean

      Set the field to display inline.

    Returns this

toJSON

  • toJSON(): object[]
  • Transforms all embeds to plain objects.

    Returns object[]

Generated using TypeDoc