diff --git a/rest/src/main/kotlin/builder/interaction/OptionsBuilder.kt b/rest/src/main/kotlin/builder/interaction/OptionsBuilder.kt index 936843c03ca4..3991bd16cc69 100644 --- a/rest/src/main/kotlin/builder/interaction/OptionsBuilder.kt +++ b/rest/src/main/kotlin/builder/interaction/OptionsBuilder.kt @@ -19,7 +19,7 @@ import kotlin.contracts.contract sealed class OptionsBuilder( var name: String, var description: String, - var type: ApplicationCommandOptionType, + val type: ApplicationCommandOptionType, ) : RequestBuilder { internal var _default: OptionalBoolean = OptionalBoolean.Missing @@ -28,9 +28,13 @@ sealed class OptionsBuilder( internal var _required: OptionalBoolean = OptionalBoolean.Missing var required: Boolean? by ::_required.delegate() - override fun toRequest(): ApplicationCommandOption { - return ApplicationCommandOption(type, name, description, _default, _required) - } + override fun toRequest() = ApplicationCommandOption( + type, + name, + description, + _default, + _required + ) } @KordDsl @@ -38,7 +42,7 @@ sealed class OptionsBuilder( sealed class BaseChoiceBuilder( name: String, description: String, - type: ApplicationCommandOptionType, + type: ApplicationCommandOptionType ) : OptionsBuilder(name, description, type) { private var _choices: Optional>> = Optional.Missing() @@ -46,17 +50,14 @@ sealed class BaseChoiceBuilder( abstract fun choice(name: String, value: T) - override fun toRequest(): ApplicationCommandOption { - return ApplicationCommandOption( - type, - name, - description, - choices = _choices, - required = _required, - default = _default - ) - } - + override fun toRequest() = ApplicationCommandOption( + type, + name, + description, + choices = _choices, + required = _required, + default = _default + ) } @KordDsl @@ -116,12 +117,12 @@ sealed class BaseCommandOptionBuilder( private var _options: Optional> = Optional.Missing() var options by ::_options.delegate() - override fun toRequest(): ApplicationCommandOption { - return ApplicationCommandOption(type, - name, - description, - options = _options.mapList { it.toRequest() }) - } + override fun toRequest() = ApplicationCommandOption( + type, + name, + description, + options = _options.mapList { it.toRequest() } + ) } @KordDsl @@ -181,7 +182,6 @@ class SubCommandBuilder(name: String, description: String) : options!!.add(MentionableBuilder(name, description).apply(builder)) } - } @KordDsl