mirror of
https://github.com/devproje/px32-bot.git
synced 2024-11-26 02:33:05 +00:00
feat: add choices
This commit is contained in:
parent
a48e25b33e
commit
5a13eb5376
2 changed files with 9 additions and 2 deletions
|
@ -2,7 +2,7 @@ kotlin.code.style=official
|
||||||
org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8
|
org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8
|
||||||
|
|
||||||
group=net.projecttl
|
group=net.projecttl
|
||||||
version=1.0.0-beta.2
|
version=1.0.0-beta.3
|
||||||
|
|
||||||
ktor_version=2.3.12
|
ktor_version=2.3.12
|
||||||
log4j_version=2.23.1
|
log4j_version=2.23.1
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package net.projecttl.p.x32.api.command
|
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.OptionType
|
||||||
import net.dv8tion.jda.api.interactions.commands.build.CommandData
|
import net.dv8tion.jda.api.interactions.commands.build.CommandData
|
||||||
import net.dv8tion.jda.api.interactions.commands.build.OptionData
|
import net.dv8tion.jda.api.interactions.commands.build.OptionData
|
||||||
|
@ -122,7 +123,13 @@ class OptionObj {
|
||||||
var required: Boolean = false
|
var required: Boolean = false
|
||||||
var autoComplete: Boolean = false
|
var autoComplete: Boolean = false
|
||||||
|
|
||||||
|
var choices = mutableListOf<Command.Choice>()
|
||||||
|
|
||||||
fun build(): OptionData {
|
fun build(): OptionData {
|
||||||
return OptionData(type, name, description, required, autoComplete)
|
return OptionData(type, name, description, required, autoComplete).apply {
|
||||||
|
this@OptionObj.choices.forEach {
|
||||||
|
addChoices(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue