diff --git a/build.gradle.kts b/build.gradle.kts index 6c698e9..100c3a8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,7 +6,7 @@ plugins { } group = "io.github.zabuzard.discordplays" -version = "2.1-SNAPSHOT" +version = "2.2-SNAPSHOT" repositories { mavenCentral() diff --git a/src/main/kotlin/io/github/zabuzard/discordplays/discord/commands/CommandRegister.kt b/src/main/kotlin/io/github/zabuzard/discordplays/discord/commands/CommandRegister.kt index 45661a9..d9f1dbe 100644 --- a/src/main/kotlin/io/github/zabuzard/discordplays/discord/commands/CommandRegister.kt +++ b/src/main/kotlin/io/github/zabuzard/discordplays/discord/commands/CommandRegister.kt @@ -3,29 +3,25 @@ package io.github.zabuzard.discordplays.discord.commands import dev.kord.common.entity.Permission import dev.kord.common.entity.Permissions import dev.kord.core.Kord -import dev.kord.core.behavior.createApplicationCommands -import dev.kord.rest.builder.interaction.GuildMultiApplicationCommandBuilder +import dev.kord.rest.builder.interaction.GlobalMultiApplicationCommandBuilder import dev.kord.rest.builder.interaction.boolean import dev.kord.rest.builder.interaction.string import dev.kord.rest.builder.interaction.subCommand import dev.kord.rest.builder.interaction.user import kotlinx.coroutines.flow.collect -import kotlinx.coroutines.flow.toList import kotlinx.coroutines.launch import org.apache.logging.log4j.Level fun Kord.registerCommands() { launch { - guilds.toList().forEach { - it.createApplicationCommands { - hostCommands() - ownerCommands() - }.collect() - } + createGlobalApplicationCommands { + hostCommands() + ownerCommands() + }.collect() } } -private fun GuildMultiApplicationCommandBuilder.hostCommands() { +private fun GlobalMultiApplicationCommandBuilder.hostCommands() { input(HOST_COMMAND_NAME, "commands for streaming the event in your community") { defaultMemberPermissions = Permissions(Permission.ModerateMembers) @@ -42,7 +38,7 @@ private fun GuildMultiApplicationCommandBuilder.hostCommands() { } } -private fun GuildMultiApplicationCommandBuilder.ownerCommands() { +private fun GlobalMultiApplicationCommandBuilder.ownerCommands() { input(COMMAND_NAME, "commands for managing the event") { defaultMemberPermissions = Permissions(Permission.Administrator)