fix: changed to DeferredPublicMessageInteractionResponseBehavior

Signed-off-by: limited_dev <loginakkisativ@gmail.com>
This commit is contained in:
limited_dev 2023-04-07 15:30:24 +02:00
parent 6a1d580fe6
commit 9d34385fb1
10 changed files with 23 additions and 25 deletions

View file

@ -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<GuildChatInputCommandInteractionCreateEvent> {
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()

View file

@ -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<CommandOption>? = null) {
open suspend fun onSlashCommand(
interaction: GuildChatInputCommandInteraction,
deferred: DeferredEphemeralMessageInteractionResponseBehavior,
deferred: DeferredPublicMessageInteractionResponseBehavior,
args: Map<CommandOption, String>
) {
}

View file

@ -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<CommandOption, String>
) {
val guildId = interaction.guildId

View file

@ -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<CommandOption, String>
) {
val guildId = interaction.guildId

View file

@ -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<CommandOption, String>
) {
val guildId = interaction.guildId

View file

@ -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<CommandOption, String>
) {
val guildId = interaction.guildId

View file

@ -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<CommandOption, String>
) {
val guildId = interaction.guildId

View file

@ -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

View file

@ -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<CommandOption, String>
) {
MessageUtil.sendEmbedForInteraction(interaction, deferred, "Botendo v5", "ver." + BuildConstants.version)

View file

@ -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