BasePaginator

abstract class BasePaginator(val pages: Pages, val chunkedPages: Int = 1, val owner: UserBehavior? = null, val timeoutSeconds: Long? = null, val keepEmbed: Boolean = true, val switchEmoji: ReactionEmoji = if (pages.groups.size == 2) EXPAND_EMOJI else SWITCH_EMOJI, val mutator: PageTransitionCallback? = null, locale: Locale? = null) : KordExKoinComponent

Abstract class intended for building paginators.

Note: This is going to be renamed - it's not ready for use yet!

Parameters

pages

How many "pages" should be displayed at once, from 1 to 9

owner

Optional paginator owner - setting this will prevent other users from interacting with the paginator

timeoutSeconds

How long (in seconds) to wait before destroying the paginator, if needed

keepEmbed

Set this to false to remove the paginator's message when it's destroyed

switchEmoji

The ReactionEmoji to use for group switching

locale

A Locale object for this pagination context, which defaults to the bot's default locale

Inheritors

Constructors

Link copied to clipboard
constructor(pages: Pages, chunkedPages: Int = 1, owner: UserBehavior? = null, timeoutSeconds: Long? = null, keepEmbed: Boolean = true, switchEmoji: ReactionEmoji = if (pages.groups.size == 2) EXPAND_EMOJI else SWITCH_EMOJI, mutator: PageTransitionCallback? = null, locale: Locale? = null)

Properties

Link copied to clipboard
open var active: Boolean

Whether this paginator is currently active and processing events.

Link copied to clipboard
open var allGroups: List<Key>

Set of all page groups.

Link copied to clipboard

Current instance of the bot.

Link copied to clipboard
open val chunkedPages: Int = 1
Link copied to clipboard

Currently-displayed page group.

Link copied to clipboard

Currently-displayed page index.

Link copied to clipboard

Currently-displayed page object.

Link copied to clipboard
open val keepEmbed: Boolean = true
Link copied to clipboard
val kord: Kord

Kord instance, backing the ExtensibleBot.

Link copied to clipboard
open val localeObj: Locale

Locale to use for translations.

Link copied to clipboard
Link copied to clipboard
open val owner: UserBehavior? = null
Link copied to clipboard
open val pages: Pages
Link copied to clipboard
open val switchEmoji: ReactionEmoji
Link copied to clipboard
val timeoutCallbacks: MutableList<suspend () -> Unit>

What to do after the paginator times out.

Link copied to clipboard
open val timeoutSeconds: Long? = null

Functions

Link copied to clipboard
open suspend fun MessageBuilder.applyPage()

Builder that generates an embed for the paginator's current context.

Link copied to clipboard
abstract suspend fun destroy()

Destroy this paginator, removing its buttons and deleting its message if required..

Link copied to clipboard
open fun getChunk(): List<Page>
Link copied to clipboard
open override fun getKoin(): Koin

Get the associated Koin instance.

Link copied to clipboard
abstract suspend fun goToPage(page: Int)

Switch to a specific page. Should not call send.

Link copied to clipboard
abstract suspend fun nextGroup()

Switch to the next group. Should not call send.

Link copied to clipboard
open suspend fun nextPage()

Convenience function to go to call goToPage with the next page number, if we're not at the last page.

Link copied to clipboard
open fun onTimeout(body: suspend () -> Unit): BasePaginator

Register a callback that is called after the paginator times out.

Link copied to clipboard
open suspend fun previousPage()

Convenience function to go to call goToPage with the previous page number, if we're not at the first page.

Link copied to clipboard
abstract suspend fun send()

Send the paginator, given the current context. If it's already sent, update it.

Link copied to clipboard
abstract suspend fun setup()

Should be called as part of send in order to create buttons and get other things set up.