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

io.github.freya022.botcommands.internal.parameters.MethodParameterMixin.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.parameters

import io.github.freya022.botcommands.api.parameters.MethodParameter
import io.github.freya022.botcommands.internal.utils.ReflectionMetadata.isNullable
import io.github.freya022.botcommands.internal.utils.findDeclarationName
import kotlin.reflect.KParameter

internal interface MethodParameterMixin : MethodParameter {
    /**
     * This is needed because autocomplete borrows the parameters and options of its slash command
     * But autocomplete execution needs the parameters of the autocomplete handler
     */
    val executableParameter: KParameter
        get() = kParameter
}

internal abstract class AbstractMethodParameter internal constructor(final override val kParameter: KParameter) : MethodParameterMixin {
    final override val name = kParameter.findDeclarationName()
    final override val isNullable = kParameter.isNullable
    final override val isOptional = kParameter.isOptional
    final override val type = kParameter.type
    final override val index = kParameter.index
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy