From 9d34385fb167aa5b4284e0168044c60d63831a79 Mon Sep 17 00:00:00 2001 From: limited_dev Date: Fri, 7 Apr 2023 15:30:24 +0200 Subject: [PATCH] fix: changed to DeferredPublicMessageInteractionResponseBehavior Signed-off-by: limited_dev --- src/main/kotlin/de/limited_dev/botendo/Bot.kt | 8 +++----- .../botendo/commands/slash/component/SlashCommand.kt | 4 ++-- .../botendo/commands/slash/music/NowPlayingCommand.kt | 4 ++-- .../botendo/commands/slash/music/PlayCommand.kt | 4 ++-- .../botendo/commands/slash/music/QueueCommand.kt | 4 ++-- .../botendo/commands/slash/music/SkipCommand.kt | 4 ++-- .../botendo/commands/slash/music/StopCommand.kt | 4 ++-- .../commands/slash/music/component/MusicManager.kt | 6 +++--- .../botendo/commands/slash/util/InfoCommand.kt | 4 ++-- .../kotlin/de/limited_dev/botendo/util/MessageUtil.kt | 6 +++--- 10 files changed, 23 insertions(+), 25 deletions(-) diff --git a/src/main/kotlin/de/limited_dev/botendo/Bot.kt b/src/main/kotlin/de/limited_dev/botendo/Bot.kt index a9bc9cd..3e4863e 100644 --- a/src/main/kotlin/de/limited_dev/botendo/Bot.kt +++ b/src/main/kotlin/de/limited_dev/botendo/Bot.kt @@ -30,9 +30,6 @@ import dev.kord.core.event.interaction.GuildChatInputCommandInteractionCreateEve import dev.kord.core.on import dev.kord.gateway.Intent import dev.kord.gateway.PrivilegedIntent -import dev.kord.rest.builder.interaction.boolean -import dev.kord.rest.builder.interaction.integer -import dev.kord.rest.builder.interaction.string import dev.schlaubi.lavakord.LavaKord import dev.schlaubi.lavakord.kord.lavakord @@ -60,7 +57,7 @@ object Bot { //Register Command Listener kord.on { - val deferred = interaction.deferEphemeralResponse() + val deferred = interaction.deferPublicResponse() //val deferred = async { interaction.deferPublicResponse() } val command = interaction.command Logger.out("Command /${command.rootName} with ${command.options.size} Option${if (command.options.size == 1) "" else "s"}") @@ -95,6 +92,7 @@ object Bot { } //Register Slash Commands at Discord + /* kord.createGlobalApplicationCommands { for (sc in SlashCommandManager.commands) { this.input(sc.name, sc.description, builder = { @@ -124,7 +122,7 @@ object Bot { } }) } - } + } */ //Add LavaLink lava = kord.lavakord() diff --git a/src/main/kotlin/de/limited_dev/botendo/commands/slash/component/SlashCommand.kt b/src/main/kotlin/de/limited_dev/botendo/commands/slash/component/SlashCommand.kt index a3bba9a..a0367a1 100644 --- a/src/main/kotlin/de/limited_dev/botendo/commands/slash/component/SlashCommand.kt +++ b/src/main/kotlin/de/limited_dev/botendo/commands/slash/component/SlashCommand.kt @@ -20,14 +20,14 @@ package de.limited_dev.botendo.commands.slash.component import de.limited_dev.botendo.commands.slash.component.options.CommandOption -import dev.kord.core.behavior.interaction.response.DeferredEphemeralMessageInteractionResponseBehavior +import dev.kord.core.behavior.interaction.response.DeferredPublicMessageInteractionResponseBehavior import dev.kord.core.entity.interaction.GuildChatInputCommandInteraction abstract class SlashCommand(val name: String, val description: String, val options: List? = null) { open suspend fun onSlashCommand( interaction: GuildChatInputCommandInteraction, - deferred: DeferredEphemeralMessageInteractionResponseBehavior, + deferred: DeferredPublicMessageInteractionResponseBehavior, args: Map ) { } diff --git a/src/main/kotlin/de/limited_dev/botendo/commands/slash/music/NowPlayingCommand.kt b/src/main/kotlin/de/limited_dev/botendo/commands/slash/music/NowPlayingCommand.kt index c00369c..36e830e 100644 --- a/src/main/kotlin/de/limited_dev/botendo/commands/slash/music/NowPlayingCommand.kt +++ b/src/main/kotlin/de/limited_dev/botendo/commands/slash/music/NowPlayingCommand.kt @@ -25,14 +25,14 @@ import de.limited_dev.botendo.commands.slash.component.options.CommandOption import de.limited_dev.botendo.util.MessageUtil import de.limited_dev.botendo.util.TimeUtil import de.limited_dev.botendo.util.UrlUtil -import dev.kord.core.behavior.interaction.response.DeferredEphemeralMessageInteractionResponseBehavior +import dev.kord.core.behavior.interaction.response.DeferredPublicMessageInteractionResponseBehavior import dev.kord.core.entity.interaction.GuildChatInputCommandInteraction import dev.schlaubi.lavakord.audio.Link class NowPlayingCommand : SlashCommand("nowplaying", "Show what's currently playing", null) { override suspend fun onSlashCommand( interaction: GuildChatInputCommandInteraction, - deferred: DeferredEphemeralMessageInteractionResponseBehavior, + deferred: DeferredPublicMessageInteractionResponseBehavior, args: Map ) { val guildId = interaction.guildId diff --git a/src/main/kotlin/de/limited_dev/botendo/commands/slash/music/PlayCommand.kt b/src/main/kotlin/de/limited_dev/botendo/commands/slash/music/PlayCommand.kt index 3cde4ff..cc48ceb 100644 --- a/src/main/kotlin/de/limited_dev/botendo/commands/slash/music/PlayCommand.kt +++ b/src/main/kotlin/de/limited_dev/botendo/commands/slash/music/PlayCommand.kt @@ -25,7 +25,7 @@ import de.limited_dev.botendo.commands.slash.component.options.CommandOption import de.limited_dev.botendo.commands.slash.component.options.OptionType import de.limited_dev.botendo.commands.slash.music.component.MusicManager import de.limited_dev.botendo.util.MessageUtil -import dev.kord.core.behavior.interaction.response.DeferredEphemeralMessageInteractionResponseBehavior +import dev.kord.core.behavior.interaction.response.DeferredPublicMessageInteractionResponseBehavior import dev.kord.core.entity.interaction.GuildChatInputCommandInteraction import dev.schlaubi.lavakord.audio.Link @@ -36,7 +36,7 @@ class PlayCommand : SlashCommand( ) { override suspend fun onSlashCommand( interaction: GuildChatInputCommandInteraction, - deferred: DeferredEphemeralMessageInteractionResponseBehavior, + deferred: DeferredPublicMessageInteractionResponseBehavior, args: Map ) { val guildId = interaction.guildId diff --git a/src/main/kotlin/de/limited_dev/botendo/commands/slash/music/QueueCommand.kt b/src/main/kotlin/de/limited_dev/botendo/commands/slash/music/QueueCommand.kt index 3963fe5..e5f0404 100644 --- a/src/main/kotlin/de/limited_dev/botendo/commands/slash/music/QueueCommand.kt +++ b/src/main/kotlin/de/limited_dev/botendo/commands/slash/music/QueueCommand.kt @@ -25,14 +25,14 @@ import de.limited_dev.botendo.commands.slash.component.options.CommandOption import de.limited_dev.botendo.commands.slash.music.component.MusicManager import de.limited_dev.botendo.util.MessageUtil import de.limited_dev.botendo.util.TimeUtil -import dev.kord.core.behavior.interaction.response.DeferredEphemeralMessageInteractionResponseBehavior +import dev.kord.core.behavior.interaction.response.DeferredPublicMessageInteractionResponseBehavior import dev.kord.core.entity.interaction.GuildChatInputCommandInteraction import dev.schlaubi.lavakord.audio.Link class QueueCommand : SlashCommand("queue", "Show whats up next", null) { override suspend fun onSlashCommand( interaction: GuildChatInputCommandInteraction, - deferred: DeferredEphemeralMessageInteractionResponseBehavior, + deferred: DeferredPublicMessageInteractionResponseBehavior, args: Map ) { val guildId = interaction.guildId diff --git a/src/main/kotlin/de/limited_dev/botendo/commands/slash/music/SkipCommand.kt b/src/main/kotlin/de/limited_dev/botendo/commands/slash/music/SkipCommand.kt index e63fb2e..f74a2fd 100644 --- a/src/main/kotlin/de/limited_dev/botendo/commands/slash/music/SkipCommand.kt +++ b/src/main/kotlin/de/limited_dev/botendo/commands/slash/music/SkipCommand.kt @@ -26,14 +26,14 @@ import de.limited_dev.botendo.commands.slash.music.component.MusicManager import de.limited_dev.botendo.util.MessageUtil import de.limited_dev.botendo.util.TimeUtil import de.limited_dev.botendo.util.UrlUtil -import dev.kord.core.behavior.interaction.response.DeferredEphemeralMessageInteractionResponseBehavior +import dev.kord.core.behavior.interaction.response.DeferredPublicMessageInteractionResponseBehavior import dev.kord.core.entity.interaction.GuildChatInputCommandInteraction import dev.schlaubi.lavakord.audio.Link class SkipCommand : SlashCommand("skip", "Skip to the next song in queue", null) { override suspend fun onSlashCommand( interaction: GuildChatInputCommandInteraction, - deferred: DeferredEphemeralMessageInteractionResponseBehavior, + deferred: DeferredPublicMessageInteractionResponseBehavior, args: Map ) { val guildId = interaction.guildId diff --git a/src/main/kotlin/de/limited_dev/botendo/commands/slash/music/StopCommand.kt b/src/main/kotlin/de/limited_dev/botendo/commands/slash/music/StopCommand.kt index c060813..cd46ffb 100644 --- a/src/main/kotlin/de/limited_dev/botendo/commands/slash/music/StopCommand.kt +++ b/src/main/kotlin/de/limited_dev/botendo/commands/slash/music/StopCommand.kt @@ -24,14 +24,14 @@ import de.limited_dev.botendo.commands.slash.component.SlashCommand import de.limited_dev.botendo.commands.slash.component.options.CommandOption import de.limited_dev.botendo.commands.slash.music.component.MusicManager import de.limited_dev.botendo.util.MessageUtil -import dev.kord.core.behavior.interaction.response.DeferredEphemeralMessageInteractionResponseBehavior +import dev.kord.core.behavior.interaction.response.DeferredPublicMessageInteractionResponseBehavior import dev.kord.core.entity.interaction.GuildChatInputCommandInteraction import dev.schlaubi.lavakord.audio.Link class StopCommand : SlashCommand("stop", "Stop playing and start leavin'", null) { override suspend fun onSlashCommand( interaction: GuildChatInputCommandInteraction, - deferred: DeferredEphemeralMessageInteractionResponseBehavior, + deferred: DeferredPublicMessageInteractionResponseBehavior, args: Map ) { val guildId = interaction.guildId diff --git a/src/main/kotlin/de/limited_dev/botendo/commands/slash/music/component/MusicManager.kt b/src/main/kotlin/de/limited_dev/botendo/commands/slash/music/component/MusicManager.kt index 616e2ee..e916542 100644 --- a/src/main/kotlin/de/limited_dev/botendo/commands/slash/music/component/MusicManager.kt +++ b/src/main/kotlin/de/limited_dev/botendo/commands/slash/music/component/MusicManager.kt @@ -23,7 +23,7 @@ import de.limited_dev.botendo.util.MessageUtil import de.limited_dev.botendo.util.TimeUtil import de.limited_dev.botendo.util.UrlUtil import dev.kord.common.entity.Snowflake -import dev.kord.core.behavior.interaction.response.DeferredEphemeralMessageInteractionResponseBehavior +import dev.kord.core.behavior.interaction.response.DeferredPublicMessageInteractionResponseBehavior import dev.kord.core.entity.Guild import dev.kord.core.entity.interaction.GuildChatInputCommandInteraction import dev.schlaubi.lavakord.audio.Link @@ -43,7 +43,7 @@ object MusicManager { suspend fun addToQueue( interaction: GuildChatInputCommandInteraction, - deferred: DeferredEphemeralMessageInteractionResponseBehavior, + deferred: DeferredPublicMessageInteractionResponseBehavior, link: Link, search: String ) { @@ -52,7 +52,7 @@ object MusicManager { suspend fun addToQueue( interaction: GuildChatInputCommandInteraction, - deferred: DeferredEphemeralMessageInteractionResponseBehavior, + deferred: DeferredPublicMessageInteractionResponseBehavior, link: Link, search: String, silent: Boolean diff --git a/src/main/kotlin/de/limited_dev/botendo/commands/slash/util/InfoCommand.kt b/src/main/kotlin/de/limited_dev/botendo/commands/slash/util/InfoCommand.kt index bb46acb..7daa0fe 100644 --- a/src/main/kotlin/de/limited_dev/botendo/commands/slash/util/InfoCommand.kt +++ b/src/main/kotlin/de/limited_dev/botendo/commands/slash/util/InfoCommand.kt @@ -23,13 +23,13 @@ import de.limited_dev.botendo.build.BuildConstants import de.limited_dev.botendo.commands.slash.component.SlashCommand import de.limited_dev.botendo.commands.slash.component.options.CommandOption import de.limited_dev.botendo.util.MessageUtil -import dev.kord.core.behavior.interaction.response.DeferredEphemeralMessageInteractionResponseBehavior +import dev.kord.core.behavior.interaction.response.DeferredPublicMessageInteractionResponseBehavior import dev.kord.core.entity.interaction.GuildChatInputCommandInteraction class InfoCommand : SlashCommand("info", "Shows infos about the bot", null) { override suspend fun onSlashCommand( interaction: GuildChatInputCommandInteraction, - deferred: DeferredEphemeralMessageInteractionResponseBehavior, + deferred: DeferredPublicMessageInteractionResponseBehavior, args: Map ) { MessageUtil.sendEmbedForInteraction(interaction, deferred, "Botendo v5", "ver." + BuildConstants.version) diff --git a/src/main/kotlin/de/limited_dev/botendo/util/MessageUtil.kt b/src/main/kotlin/de/limited_dev/botendo/util/MessageUtil.kt index a24999a..67f732f 100644 --- a/src/main/kotlin/de/limited_dev/botendo/util/MessageUtil.kt +++ b/src/main/kotlin/de/limited_dev/botendo/util/MessageUtil.kt @@ -19,7 +19,7 @@ package de.limited_dev.botendo.util -import dev.kord.core.behavior.interaction.response.DeferredEphemeralMessageInteractionResponseBehavior +import dev.kord.core.behavior.interaction.response.DeferredPublicMessageInteractionResponseBehavior import dev.kord.core.behavior.interaction.response.respond import dev.kord.core.entity.interaction.GuildChatInputCommandInteraction import dev.kord.rest.builder.message.EmbedBuilder @@ -31,7 +31,7 @@ object MessageUtil { suspend fun sendEmbedForInteraction( interaction: GuildChatInputCommandInteraction, - deferred: DeferredEphemeralMessageInteractionResponseBehavior, + deferred: DeferredPublicMessageInteractionResponseBehavior, title: String, description: String ) { @@ -48,7 +48,7 @@ object MessageUtil { suspend fun sendEmbedForInteractionWithImage( interaction: GuildChatInputCommandInteraction, - deferred: DeferredEphemeralMessageInteractionResponseBehavior, + deferred: DeferredPublicMessageInteractionResponseBehavior, title: String, description: String, thumbnailUrl: String