Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package io.github.freya022.botcommands.api.components
import io.github.freya022.botcommands.api.ReceiverConsumer
import io.github.freya022.botcommands.api.components.builder.button.EphemeralButtonBuilder
import io.github.freya022.botcommands.api.components.builder.button.PersistentButtonBuilder
import io.github.freya022.botcommands.api.components.builder.group.ComponentGroupBuilder
import io.github.freya022.botcommands.api.components.builder.group.EphemeralComponentGroupBuilder
import io.github.freya022.botcommands.api.components.builder.group.PersistentComponentGroupBuilder
import io.github.freya022.botcommands.api.components.builder.select.ephemeral.EphemeralEntitySelectBuilder
import io.github.freya022.botcommands.api.components.builder.select.ephemeral.EphemeralStringSelectBuilder
import io.github.freya022.botcommands.api.components.builder.select.persistent.PersistentEntitySelectBuilder
import io.github.freya022.botcommands.api.components.builder.select.persistent.PersistentStringSelectBuilder
import io.github.freya022.botcommands.api.core.BContext
import io.github.freya022.botcommands.api.core.config.BComponentsConfig
import io.github.freya022.botcommands.api.core.service.ConditionalServiceChecker
import io.github.freya022.botcommands.api.core.service.annotations.BService
import io.github.freya022.botcommands.api.core.service.annotations.ConditionalService
import io.github.freya022.botcommands.api.utils.ButtonContent
import io.github.freya022.botcommands.internal.components.controller.ComponentController
import io.github.freya022.botcommands.internal.utils.reference
import io.github.freya022.botcommands.internal.utils.requireUser
import io.github.freya022.botcommands.internal.utils.throwUser
import io.github.oshai.kotlinlogging.KotlinLogging
import kotlinx.coroutines.runBlocking
import net.dv8tion.jda.api.entities.emoji.Emoji
import net.dv8tion.jda.api.interactions.components.ActionComponent
import net.dv8tion.jda.api.interactions.components.buttons.ButtonStyle
import net.dv8tion.jda.api.interactions.components.selections.EntitySelectMenu.SelectTarget
/**
* This class lets you create smart components such as buttons, select menus, and groups.
*
* Every component can either be persistent or ephemeral, all components can be configured to:
* - Be used once
* - Have timeouts
* - Have handlers
* - Have constraints (checks before the button can be used)
*
* Except component groups which can only have its timeout configured.
*
* ### Persistent components
* - Kept after restart
* - Handlers are methods; they can have arguments passed to them
* - Timeouts are also methods, additionally, they will be rescheduled when the bot restarts
*
* ### Ephemeral components
* - Are deleted once the bot restarts
* - Handlers are closures, they can capture objects, but you [shouldn't capture JDA entities](https://jda.wiki/using-jda/troubleshooting/#cannot-get-reference-as-it-has-already-been-garbage-collected)
* - Timeouts are also closures, but are not rescheduled when restarting
*
* ### Component groups
* - If deleted, all contained components are deleted
* - If one of the contained components is deleted, then all of its subsequent groups are also deleted
*
* ### Java example
* ```java
* @Command
* public class SlashButton extends ApplicationCommand {
* private static final String BUTTON_LISTENER_NAME = "SlashButton: persistentButton"; //ClassName: theButtonPurpose
*
* private final Components componentsService;
*
* public SlashButton(Components componentsService) {
* this.componentsService = componentsService;
* }
*
* @JDASlashCommand(name = "button", description = "Try out the new buttons!")
* public void onSlashButton(GuildSlashEvent event) {
* final List