huruhuru - v0.0.1
    Preparing search index...

    Function paginate

    • Create and register a paginated message.

      Type Parameters

      • T extends SectionBuilder | { toString(): string }

      Parameters

      • ctx: CommandContext

        CommandContext wrapping an interaction or message

      • items: T[]

        Items to paginate. Each item may be a SectionBuilder or any object with toString()

      • OptionaltopSection: T | null

        Optional header SectionBuilder or an object with toString() used as the top section

      • currentPage: number = 1

        1-based page to open initially (default: 1)

      • pageSize: number = 10

        Items per page (default: 10)

      • Optionalheader: string

        Optional header text displayed above sections

      Returns Promise<MessagePagination>

      A MessagePagination instance that can be used to control the pagination programmatically

      // Simple usage
      const items = ["one", "two", "three", "four"];
      // Without a top section
      await paginate(ctx, items, null, 1, 2, "My Paginated Message");
      // With a top section
      await paginate(ctx, items, "Items:", 1, 2, "My Paginated Message");