This commit is contained in:
@@ -4,20 +4,20 @@ import net.dv8tion.jda.api.interactions.commands.build.SubcommandGroupData
|
||||
import net.dv8tion.jda.internal.interactions.CommandDataImpl
|
||||
|
||||
fun Command.toCommandData(): CommandDataImpl = CommandDataImpl(name, description).apply {
|
||||
addOptions(options)
|
||||
neededPermissions?.let { setDefaultPermissions(it) }
|
||||
addOptions(this@toCommandData.options)
|
||||
this@toCommandData.neededPermissions?.let { setDefaultPermissions(it) }
|
||||
|
||||
if (subcommands.isNotEmpty()) {
|
||||
addSubcommands(subcommands.map { toSubcommandData() })
|
||||
if (this@toCommandData.subcommands.isNotEmpty()) {
|
||||
addSubcommands(this@toCommandData.subcommands.map { it.toSubcommandData() })
|
||||
}
|
||||
|
||||
if (subcommandGroups.isNotEmpty()) {
|
||||
if (this@toCommandData.subcommandGroups.isNotEmpty()) {
|
||||
addSubcommandGroups(
|
||||
subcommandGroups.map { group ->
|
||||
this@toCommandData.subcommandGroups.map { group ->
|
||||
SubcommandGroupData(
|
||||
group.name,
|
||||
group.description
|
||||
).addSubcommands(group.subcommands.map { toSubcommandData() })
|
||||
).addSubcommands(group.subCommands.map { it.toSubcommandData() })
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user