io.github.freya022.botcommands.internal.components.builder.EphemeralActionableComponentImpl.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.internal.components.builder
import io.github.freya022.botcommands.api.ReceiverConsumer
import io.github.freya022.botcommands.api.components.builder.EphemeralHandlerBuilder
import io.github.freya022.botcommands.api.components.builder.IEphemeralActionableComponent
import io.github.freya022.botcommands.api.core.BContext
import io.github.freya022.botcommands.internal.components.handler.EphemeralHandler
import net.dv8tion.jda.api.events.interaction.component.GenericComponentInteractionCreateEvent
internal class EphemeralActionableComponentImpl, E : GenericComponentInteractionCreateEvent> internal constructor(
context: BContext,
instanceRetriever: InstanceRetriever
) : AbstractActionableComponent(context, instanceRetriever),
IEphemeralActionableComponent {
override var handler: EphemeralHandler<*>? = null
private set
override fun bindTo(handler: suspend (E) -> Unit, block: ReceiverConsumer>): T = instance.also {
this.handler = EphemeralHandlerBuilder(handler).apply(block).build()
}
}