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

io.github.freya022.botcommands.internal.components.timeout.options.TimeoutHandlerParameter.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.timeout.options

import io.github.freya022.botcommands.internal.components.timeout.TimeoutDescriptor
import io.github.freya022.botcommands.internal.core.options.builder.OptionAggregateBuilderImpl
import io.github.freya022.botcommands.internal.core.reflection.toAggregatorFunction
import io.github.freya022.botcommands.internal.options.CommandOptions
import io.github.freya022.botcommands.internal.options.transform
import io.github.freya022.botcommands.internal.parameters.AbstractMethodParameter
import io.github.freya022.botcommands.internal.parameters.AggregatedParameterMixin
import kotlin.reflect.KClass

internal class TimeoutHandlerParameter internal constructor(
    override val executable: TimeoutDescriptor<*>,
    aggregateBuilder: OptionAggregateBuilderImpl<*>,
    aggregatorFirstParamType: KClass<*>
) : AbstractMethodParameter(aggregateBuilder.parameter),
    AggregatedParameterMixin {

    override val aggregator = aggregateBuilder.aggregator.toAggregatorFunction(context, aggregatorFirstParamType)

    override val nestedAggregatedParameters = aggregateBuilder.optionAggregateBuilders.transform {
        TimeoutHandlerParameter(executable, it as OptionAggregateBuilderImpl<*>, aggregatorFirstParamType)
    }

    override val options = CommandOptions.transform(
        this,
        null,
        aggregateBuilder,
        optionFinalizer = ::TimeoutHandlerOption
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy