Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package dev.kord.rest.builder.interaction
import dev.kord.common.Locale
import dev.kord.common.annotation.KordDsl
import dev.kord.common.entity.ApplicationCommandOption
import dev.kord.common.entity.ApplicationCommandOptionType
import dev.kord.common.entity.ChannelType
import dev.kord.common.entity.Choice
import dev.kord.common.entity.optional.*
import dev.kord.common.entity.optional.delegate.delegate
import dev.kord.rest.builder.RequestBuilder
import kotlinx.serialization.json.JsonPrimitive
import kotlin.contracts.InvocationKind
import kotlin.contracts.contract
@Suppress("PropertyName")
@KordDsl
public sealed class OptionsBuilder(
override var name: String,
override var description: String,
public val type: ApplicationCommandOptionType,
) : LocalizedNameCreateBuilder, LocalizedDescriptionCreateBuilder, RequestBuilder {
internal var _default: OptionalBoolean = OptionalBoolean.Missing
public var default: Boolean? by ::_default.delegate()
internal var _nameLocalizations: Optional?> = Optional.Missing()
override var nameLocalizations: MutableMap? by ::_nameLocalizations.delegate()
internal var _descriptionLocalizations: Optional?> = Optional.Missing()
override var descriptionLocalizations: MutableMap? by ::_descriptionLocalizations.delegate()
internal var _required: OptionalBoolean = OptionalBoolean.Missing
public var required: Boolean? by ::_required.delegate()
internal var _autocomplete: OptionalBoolean = OptionalBoolean.Missing
/**
* Setting this to `true` allows you to dynamically respond with your choices, depending on the user input.
*
* This disables all input validation, users can submit values before responding to the AutoComplete request.
*
* Enabling this also means that you cannot add any other option.
*/
public var autocomplete: Boolean? by ::_autocomplete.delegate()
override fun toRequest(): ApplicationCommandOption = ApplicationCommandOption(
type,
name,
_nameLocalizations,
description,
_descriptionLocalizations,
_default,
_required,
autocomplete = _autocomplete
)
}
@KordDsl
public sealed class BaseChoiceBuilder(
name: String,
description: String,
type: ApplicationCommandOptionType
) : OptionsBuilder(name, description, type) {
@Suppress("PropertyName")
internal var _choices: Optional> = Optional.Missing()
public var choices: MutableList? by ::_choices.delegate()
public abstract fun choice(name: String, value: T, nameLocalizations: Optional