io.github.freya022.botcommands.api.commands.application.builder.ApplicationCommandBuilder.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.api.commands.application.builder
import io.github.freya022.botcommands.api.commands.application.context.annotations.JDAMessageCommand
import io.github.freya022.botcommands.api.commands.application.context.annotations.JDAUserCommand
import io.github.freya022.botcommands.api.commands.application.slash.ApplicationGeneratedValueSupplier
import io.github.freya022.botcommands.api.commands.application.slash.annotations.JDASlashCommand
import io.github.freya022.botcommands.api.commands.application.slash.builder.mixins.ITopLevelApplicationCommandBuilder
import io.github.freya022.botcommands.api.commands.builder.ExecutableCommandBuilder
import io.github.freya022.botcommands.api.core.BContext
import kotlin.reflect.KFunction
abstract class ApplicationCommandBuilder> internal constructor(
context: BContext,
name: String,
function: KFunction
) : ExecutableCommandBuilder(context, name, function) {
abstract val topLevelBuilder: ITopLevelApplicationCommandBuilder
/**
* Specifies whether the application command is usable in NSFW channels.
* Note: NSFW commands need to be enabled by the user in order to appear in DMs
*
* **Default:** false
*
* See the [Age-Restricted Commands FAQ](https://support.discord.com/hc/en-us/articles/10123937946007) for more details.
*
* @return `true` if the command is restricted to NSFW channels
*
* @see JDASlashCommand.nsfw
* @see JDAUserCommand.nsfw
* @see JDAMessageCommand.nsfw
*/
var nsfw: Boolean = false
/**
* @param declaredName Name of the declared parameter in the [function]
*/
fun customOption(declaredName: String) {
selfAggregate(declaredName) {
customOption(declaredName)
}
}
/**
* @param declaredName Name of the declared parameter in the [function]
*/
fun generatedOption(declaredName: String, generatedValueSupplier: ApplicationGeneratedValueSupplier) {
selfAggregate(declaredName) {
generatedOption(declaredName, generatedValueSupplier)
}
}
}