Class PagesBuilder

Hierarchy

  • EmbedBuilder

    Hierarchy

    • PagesBuilder

Constructors

  • Parameters

    • interaction: ChatInputCommandInteraction<CacheType>

    Returns PagesBuilder

Properties

autoResetTimeout: boolean = true
buildMethod: "reply" | "editReply" | "followUp"
collector: InteractionCollector<SelectMenuInteraction<CacheType> | ButtonInteraction<CacheType>>
components: ActionRowBuilder<MessageActionRowComponentBuilder>[] = []

Components

currentPage: number = 1
data: APIEmbed
defaultButtons: ActionRowBuilder<MessageActionRowComponentBuilder>[] = []
endColor: ColorResolvable = 'Grey'
endMethod: "none" | "delete" | "edit" | EndMethod | "remove_components" | "remove_embeds" = EndMethod.EDIT
files: (Stream | Attachment | BufferResolvable | AttachmentPayload | JSONEncodable<APIAttachment> | AttachmentBuilder)[] = []
interaction: ChatInputCommandInteraction<CacheType>

Common

listenTimeout: number = ...

Listen

listenUsers: string[]
loop: boolean = true
message: Message<boolean>
messageComponent?: MessageComponentInteraction<CacheType>
pages: Page[] = []

Pages

paginationFormat: string = '%c / %m'
timeout: Timeout
triggers: TriggersMap = ...

Triggers

Accessors

  • get appendedComponents(): ActionRowBuilder<MessageActionRowComponentBuilder>[]
  • Returns ActionRowBuilder<MessageActionRowComponentBuilder>[]

Methods

  • Method for adding components to available row

    Parameters

    • components: AllowArray<MessageActionRowComponentBuilder | ActionRowBuilder<MessageActionRowComponentBuilder>>

    Returns PagesBuilder

  • Appends fields to the embed

    Remarks

    This method accepts either an array of fields or a variable number of field parameters. The maximum amount of fields that can be added is 25.

    Example

    Using an array

    const fields: APIEmbedField[] = ...;
    const embed = new EmbedBuilder()
    .addFields(fields);

    Example

    Using rest parameters (variadic)

    const embed = new EmbedBuilder()
    .addFields(
    { name: 'Field 1', value: 'Value 1' },
    { name: 'Field 2', value: 'Value 2' },
    );

    Parameters

    • Rest ...fields: RestOrArray<APIEmbedField>

      The fields to add

    Returns PagesBuilder

  • Method for adding files to the end

    Parameters

    • files: Stream | Attachment | BufferResolvable | AttachmentPayload | JSONEncodable<APIAttachment> | AttachmentBuilder | (Stream | Attachment | BufferResolvable | AttachmentPayload | JSONEncodable<APIAttachment> | AttachmentBuilder)[]

    Returns PagesBuilder

  • Build method

    Parameters

    • options: Pick<InteractionReplyOptions, "ephemeral"> = {}

    Returns Promise<void | APIMessage | Message<boolean>>

  • Method for invoking quick actions

    Parameters

    • action: string

    Returns void

  • Method for getting the page

    Parameters

    • pageNumber: number = ...

    Returns Promise<EmbedBuilder[]>

  • Rerender current page

    Returns Promise<any>

  • Sets the author of this embed

    Parameters

    • options: null | EmbedAuthorOptions

      The options for the author

    Returns PagesBuilder

  • Method for setting the timer to automatically reset when switching between pages

    Parameters

    • status: boolean = true

    Returns PagesBuilder

  • Parameters

    • color: null | ColorResolvable

    Returns PagesBuilder

  • Method for setting default buttons

    Example

    builder.setDefaultButtons(['first', {
    stop: new ButtonComponent()
    .setLabel('Stop')
    .setStyle('PRIMARY')
    }]);

    Parameters

    Returns PagesBuilder

  • Sets the description of this embed

    Parameters

    • description: null | string

      The description

    Returns PagesBuilder

  • Sets the embed's fields

    Remarks

    This method is an alias for EmbedBuilder.spliceFields. More specifically, it splices the entire array of fields, replacing them with the provided fields.

    You can set a maximum of 25 fields.

    Parameters

    • Rest ...fields: RestOrArray<APIEmbedField>

      The fields to set

    Returns PagesBuilder

  • Method for initial files setup

    Parameters

    • files: Stream | Attachment | BufferResolvable | AttachmentPayload | JSONEncodable<APIAttachment> | AttachmentBuilder | (Stream | Attachment | BufferResolvable | AttachmentPayload | JSONEncodable<APIAttachment> | AttachmentBuilder)[]

    Returns PagesBuilder

  • Sets the footer of this embed

    Parameters

    • options: null | EmbedFooterOptions

      The options for the footer

    Returns PagesBuilder

  • Sets the image of this embed

    Parameters

    • url: null | string

      The URL of the image

    Returns PagesBuilder

  • Method for setting the method of working with a message when you finish listening for reactions

    Parameters

    • method: "none" | "delete" | "edit" | EndMethod | "remove_components" | "remove_embeds"

    Returns PagesBuilder

  • Method for opening a specific page

    Parameters

    • pageNumber: number

    Returns Promise<Promise<Message<boolean>> | Promise<InteractionResponse<boolean>>>

  • Method for initial pages setup

    Example

    builder.setPages(
    new Embed()
    .setTitle('Hello World!')
    );

    builder.setPages([
    new Embed()
    .setTitle('Hello World!'),
    () => (
    new Embed()
    .setTitle('Function page')
    )
    ]);

    Parameters

    Returns PagesBuilder

  • Method for setting the pagination format

    Example

    %c - Current page %m - Max page

    builder.setPaginationFormat('Current page: %c, Max: %m');
    

    Parameters

    • format: string = '%c / %m'

    Returns PagesBuilder

  • Sets the thumbnail of this embed

    Parameters

    • url: null | string

      The URL of the thumbnail

    Returns PagesBuilder

  • Sets the timestamp of this embed

    Parameters

    • Optional timestamp: null | number | Date

      The timestamp or date

    Returns PagesBuilder

  • Sets the title of this embed

    Parameters

    • title: null | string

      The title

    Returns PagesBuilder

  • Sets the URL of this embed

    Parameters

    • url: null | string

      The URL

    Returns PagesBuilder

  • Removes, replaces, or inserts fields in the embed.

    Remarks

    This method behaves similarly to Array.prototype.splice. The maximum amount of fields that can be added is 25.

    It's useful for modifying and adjusting order of the already-existing fields of an embed.

    Example

    Remove the first field

    embed.spliceFields(0, 1);
    

    Example

    Remove the first n fields

    const n = 4
    embed.spliceFields(0, n);

    Example

    Remove the last field

    embed.spliceFields(-1, 1);
    

    Parameters

    • index: number

      The index to start at

    • deleteCount: number

      The number of fields to remove

    • Rest ...fields: APIEmbedField[]

      The replacing field objects

    Returns PagesBuilder

  • Method for early stopping listening

    Returns void

  • Transforms the embed to a plain object

    Returns APIEmbed

  • Method for update existing components

    Example

    const button = new ButtonComponent()
    .setCustomId('test')
    .setLabel('Test button')
    .setStyle('PRIMARY');

    builder.addComponents(button);

    button.setLabel('Primary button');

    builder.updateComponents(button);

    builder.rerender();

    Parameters

    • rows: AllowArray<ActionRowBuilder<MessageActionRowComponentBuilder>>

    Returns PagesBuilder

  • Parameters

    • other: APIEmbed | JSONEncodable<APIEmbed>

    Returns EmbedBuilder

Generated using TypeDoc