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
|
import net.dv8tion.jda.internal.interactions.CommandDataImpl
|
||||||
|
|
||||||
fun Command.toCommandData(): CommandDataImpl = CommandDataImpl(name, description).apply {
|
fun Command.toCommandData(): CommandDataImpl = CommandDataImpl(name, description).apply {
|
||||||
addOptions(options)
|
addOptions(this@toCommandData.options)
|
||||||
neededPermissions?.let { setDefaultPermissions(it) }
|
this@toCommandData.neededPermissions?.let { setDefaultPermissions(it) }
|
||||||
|
|
||||||
if (subcommands.isNotEmpty()) {
|
if (this@toCommandData.subcommands.isNotEmpty()) {
|
||||||
addSubcommands(subcommands.map { toSubcommandData() })
|
addSubcommands(this@toCommandData.subcommands.map { it.toSubcommandData() })
|
||||||
}
|
}
|
||||||
|
|
||||||
if (subcommandGroups.isNotEmpty()) {
|
if (this@toCommandData.subcommandGroups.isNotEmpty()) {
|
||||||
addSubcommandGroups(
|
addSubcommandGroups(
|
||||||
subcommandGroups.map { group ->
|
this@toCommandData.subcommandGroups.map { group ->
|
||||||
SubcommandGroupData(
|
SubcommandGroupData(
|
||||||
group.name,
|
group.name,
|
||||||
group.description
|
group.description
|
||||||
).addSubcommands(group.subcommands.map { toSubcommandData() })
|
).addSubcommands(group.subCommands.map { it.toSubcommandData() })
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user