io.github.freya022.botcommands.api.pagination.menu.buttonized.ButtonMenuBuilder.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of BotCommands Show documentation
Show all versions of BotCommands Show documentation
A Kotlin-first (and Java) framework that makes creating Discord bots a piece of cake, using the JDA library.
package io.github.freya022.botcommands.api.pagination.menu.buttonized
import io.github.freya022.botcommands.api.core.BContext
import io.github.freya022.botcommands.api.pagination.Paginators
import io.github.freya022.botcommands.api.pagination.menu.AbstractMenuBuilder
/**
* Builds a [ButtonMenu].
*
* @param E Type of the entries
*
* @see Paginators.buttonMenu
*/
class ButtonMenuBuilder internal constructor(
context: BContext,
entries: List,
val buttonContentSupplier: ButtonMenu.ButtonContentSupplier,
val callback: SuspendingChoiceCallback
) : AbstractMenuBuilder, ButtonMenu>(context, entries) {
var reusable: Boolean = ButtonMenu.Defaults.reusable
private set
/**
* Sets whether selecting an entry invalidates this menu.
*
* If `true`, the buttons will only be usable once,
* if `false`, the buttons can be clicked and callback ran multiple times.
*/
fun setReusable(reusable: Boolean): ButtonMenuBuilder = config {
this.reusable = reusable
}
override fun build(): ButtonMenu = ButtonMenu(context, this)
}