Class BasePagination<T>Abstract

Base pagination class that works with collector and it's events.

Type Parameters

  • T extends ReplyMessageOptions | MessageOptions | InteractionReplyOptions

Hierarchy

Constructors

Properties

_messageOptions: T

Accessors

  • get afterSending(): null | AfterSending
  • Action that will be completed after the pagination was sent.

    Returns null | AfterSending

  • get buttons(): null | ButtonData[]
  • The buttons of this pagination. By default is an empty array.

    Returns null | ButtonData[]

  • get collector(): null | InteractionCollector<ButtonInteraction<CacheType>>
  • Collector that collects button interactions.

    Returns null | InteractionCollector<ButtonInteraction<CacheType>>

  • get collectorOptions(): null | CollectorOptions
  • Options for collecting button interactions.

    Returns null | CollectorOptions

  • get currentPage(): number
  • Current page number. Zero-based. By default is zero.

    Returns number

  • get embeds(): null | MessageEmbed[]
  • Embeds of this pagination. By default is an empty array.

    Returns null | MessageEmbed[]

  • get filterOptions(): null | FilterOptions
  • Options for filtering button interactions. By default singleUserAccess and noAccessReply are true. And noAccessReplyContent is "You're disallowed to use this very pagination!".

    Returns null | FilterOptions

  • get isActive(): boolean
  • Indicates whether this pagination sent or not. By default is false.

    Returns boolean

  • get messageOptions(): null | T
  • Options for sending out message.

    Returns null | T

  • get onStop(): null | OnStop
  • Action that will be completed after the pagination was stopped.

    Returns null | OnStop

  • get time(): null | number
  • How long the pagination will exist (in milliseconds). By default is zero.

    Returns null | number

Methods

  • Builds array of action rows and disables or enables every button.

    Returns

    Array of action rows.

    Parameters

    • disableButtons: boolean = false

      Disable or enable all buttons.

    Returns MessageActionRow<MessageButton, MessageActionRowComponentResolvable, APIActionRowComponent<APIMessageActionRowComponent>>[]

  • Method that handles collect event.

    Returns

    Updates pagination.

    Parameters

    • interaction: ButtonInteraction<CacheType>

      Interaction that the collector got.

    Returns Promise<void>

  • Disables button if needed for the specified page.

    Returns

    Updates button style.

    Parameters

    • button: MessageButton

      Button style.

    • page: number

      Page number.

    Returns Promise<void>

  • Forms collector.

    Returns

    Interaction Collector.

    Parameters

    • message: Message<boolean>

      Message that collector should stick to.

    • Optional user: User

      Used only if singleUserAccess is true. Needed only if only one user should be able to use pagination.

    Returns InteractionCollector<ButtonInteraction<CacheType>>

  • Forms filter for InteractionCollector.

    Returns

    Function that filters out interactions.

    Parameters

    • message: Message<boolean>

      Message that collector should stick to.

    • Optional user: User

      Needed only if one user should be able to use pagination and filterOptions onlyOneUser is true.

    Returns ((interaction: ButtonInteraction<CacheType>) => Promise<boolean>)

      • (interaction: ButtonInteraction<CacheType>): Promise<boolean>
      • Forms filter for InteractionCollector.

        Returns

        Function that filters out interactions.

        Parameters

        • interaction: ButtonInteraction<CacheType>

        Returns Promise<boolean>

  • Gets array of action rows for the page with specified number.

    Returns

    Array of action rows.

    Parameters

    • page: number

      Number of page.

    Returns Promise<MessageActionRow<MessageButton, MessageActionRowComponentResolvable, APIActionRowComponent<APIMessageActionRowComponent>>[]>

  • Gets page number from customId of button that was pressed.

    Returns

    Number of page.

    Parameters

    • customId: string

      CustomId of button that was pressed.

    Returns Promise<number>

  • Sets active state.

    Returns

    Active state.

    Parameters

    • active: boolean = true

      Whether to set pagination as active.

    Returns boolean

  • Sets collector of the pagination.

    Returns

    Collector that collects button interactions.

    Parameters

    • collector: InteractionCollector<ButtonInteraction<CacheType>>

      Collector that collects button interactions.

    Returns InteractionCollector<ButtonInteraction<CacheType>>

  • Sets current page number.

    Returns

    Number of the current page.

    Parameters

    • page: number = 0

      Number of the page.

    Returns number

  • Sets life-time of pagination.

    Returns

    Time in milliseconds.

    Parameters

    • time: number

      Time in milliseconds.

    Returns number

  • Setups data from another base pagination.

    Returns

    Parameters

    Returns void

  • Method that handles stop event.

    Returns

    Updates pagination.

    Parameters

    • reason: string

      Reason of collector's stop event.

    • message: Message<boolean> | Interaction<CacheType>

      Message that was sent or Interaction that was replied.

    Returns Promise<void>

  • Inserts embeds.

    Returns

    Pagination.

    Parameters

    • embeds: MessageEmbed | MessageEmbed[]

      Embed(-s) that is/are meant to be inserted.

    • Optional index: number

      Zero-based location in the array there the embed(-s) should be inserted.

    Returns BasePagination<T>

  • Removes embed(-s) by it's/theirs index(-es) in the array of embeds.

    Returns

    Pagination.

    Parameters

    • index: number

      Zero-based location in the array from which to start removing embeds.

    • count: number = 1

      Quantity of embeds to remove.

    Returns BasePagination<T>

  • Parameters

    • sendTo: unknown
    • Optional user: User

    Returns Promise<void>

  • Sets embed(-s). Overrides current embed(-s).

    Returns

    Pagination.

    Parameters

    • embeds: MessageEmbed | MessageEmbed[]

      Embed(-s) that is/are meant to be set.

    Returns BasePagination<T>

  • Sets options for sending out message.

    Returns

    Pagination.

    Parameters

    • options: T

      Options for sending out message.

    Returns BasePagination<T>

  • Sets pagination active phase duration.

    Returns

    Pagination.

    Parameters

    • time: number

      Time in milliseconds.

    • Optional bypassLibraryLimits: boolean

      Should the time bypass library limit or not.

    Returns BasePagination<T>

Generated using TypeDoc