All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.freya022.botcommands.internal.components.builder.EphemeralActionableComponentImpl.kt Maven / Gradle / Ivy

Go to download

A Kotlin-first (and Java) framework that makes creating Discord bots a piece of cake, using the JDA library.

There is a newer version: 3.0.0-alpha.18
Show newest version
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()
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy