From 5a13eb5376c2c9c63b29dca3f742825c1ce7b54c Mon Sep 17 00:00:00 2001 From: Project_IO Date: Mon, 14 Oct 2024 16:05:37 +0900 Subject: [PATCH] feat: add choices --- gradle.properties | 2 +- .../kotlin/net/projecttl/p/x32/api/command/CommandObj.kt | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index f74aeb2..334606e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ kotlin.code.style=official org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8 group=net.projecttl -version=1.0.0-beta.2 +version=1.0.0-beta.3 ktor_version=2.3.12 log4j_version=2.23.1 diff --git a/px32-bot-api/src/main/kotlin/net/projecttl/p/x32/api/command/CommandObj.kt b/px32-bot-api/src/main/kotlin/net/projecttl/p/x32/api/command/CommandObj.kt index ac5068d..9e953ee 100644 --- a/px32-bot-api/src/main/kotlin/net/projecttl/p/x32/api/command/CommandObj.kt +++ b/px32-bot-api/src/main/kotlin/net/projecttl/p/x32/api/command/CommandObj.kt @@ -1,5 +1,6 @@ package net.projecttl.p.x32.api.command +import net.dv8tion.jda.api.interactions.commands.Command import net.dv8tion.jda.api.interactions.commands.OptionType import net.dv8tion.jda.api.interactions.commands.build.CommandData import net.dv8tion.jda.api.interactions.commands.build.OptionData @@ -122,7 +123,13 @@ class OptionObj { var required: Boolean = false var autoComplete: Boolean = false + var choices = mutableListOf() + fun build(): OptionData { - return OptionData(type, name, description, required, autoComplete) + return OptionData(type, name, description, required, autoComplete).apply { + this@OptionObj.choices.forEach { + addChoices(it) + } + } } }