fix: changed to DeferredPublicMessageInteractionResponseBehavior
Signed-off-by: limited_dev <loginakkisativ@gmail.com>
This commit is contained in:
parent
6a1d580fe6
commit
9d34385fb1
10 changed files with 23 additions and 25 deletions
|
@ -30,9 +30,6 @@ import dev.kord.core.event.interaction.GuildChatInputCommandInteractionCreateEve
|
||||||
import dev.kord.core.on
|
import dev.kord.core.on
|
||||||
import dev.kord.gateway.Intent
|
import dev.kord.gateway.Intent
|
||||||
import dev.kord.gateway.PrivilegedIntent
|
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.LavaKord
|
||||||
import dev.schlaubi.lavakord.kord.lavakord
|
import dev.schlaubi.lavakord.kord.lavakord
|
||||||
|
|
||||||
|
@ -60,7 +57,7 @@ object Bot {
|
||||||
|
|
||||||
//Register Command Listener
|
//Register Command Listener
|
||||||
kord.on<GuildChatInputCommandInteractionCreateEvent> {
|
kord.on<GuildChatInputCommandInteractionCreateEvent> {
|
||||||
val deferred = interaction.deferEphemeralResponse()
|
val deferred = interaction.deferPublicResponse()
|
||||||
//val deferred = async { interaction.deferPublicResponse() }
|
//val deferred = async { interaction.deferPublicResponse() }
|
||||||
val command = interaction.command
|
val command = interaction.command
|
||||||
Logger.out("Command /${command.rootName} with ${command.options.size} Option${if (command.options.size == 1) "" else "s"}")
|
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
|
//Register Slash Commands at Discord
|
||||||
|
/*
|
||||||
kord.createGlobalApplicationCommands {
|
kord.createGlobalApplicationCommands {
|
||||||
for (sc in SlashCommandManager.commands) {
|
for (sc in SlashCommandManager.commands) {
|
||||||
this.input(sc.name, sc.description, builder = {
|
this.input(sc.name, sc.description, builder = {
|
||||||
|
@ -124,7 +122,7 @@ object Bot {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
} */
|
||||||
|
|
||||||
//Add LavaLink
|
//Add LavaLink
|
||||||
lava = kord.lavakord()
|
lava = kord.lavakord()
|
||||||
|
|
|
@ -20,14 +20,14 @@
|
||||||
package de.limited_dev.botendo.commands.slash.component
|
package de.limited_dev.botendo.commands.slash.component
|
||||||
|
|
||||||
import de.limited_dev.botendo.commands.slash.component.options.CommandOption
|
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
|
import dev.kord.core.entity.interaction.GuildChatInputCommandInteraction
|
||||||
|
|
||||||
abstract class SlashCommand(val name: String, val description: String, val options: List<CommandOption>? = null) {
|
abstract class SlashCommand(val name: String, val description: String, val options: List<CommandOption>? = null) {
|
||||||
|
|
||||||
open suspend fun onSlashCommand(
|
open suspend fun onSlashCommand(
|
||||||
interaction: GuildChatInputCommandInteraction,
|
interaction: GuildChatInputCommandInteraction,
|
||||||
deferred: DeferredEphemeralMessageInteractionResponseBehavior,
|
deferred: DeferredPublicMessageInteractionResponseBehavior,
|
||||||
args: Map<CommandOption, String>
|
args: Map<CommandOption, String>
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.MessageUtil
|
||||||
import de.limited_dev.botendo.util.TimeUtil
|
import de.limited_dev.botendo.util.TimeUtil
|
||||||
import de.limited_dev.botendo.util.UrlUtil
|
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.kord.core.entity.interaction.GuildChatInputCommandInteraction
|
||||||
import dev.schlaubi.lavakord.audio.Link
|
import dev.schlaubi.lavakord.audio.Link
|
||||||
|
|
||||||
class NowPlayingCommand : SlashCommand("nowplaying", "Show what's currently playing", null) {
|
class NowPlayingCommand : SlashCommand("nowplaying", "Show what's currently playing", null) {
|
||||||
override suspend fun onSlashCommand(
|
override suspend fun onSlashCommand(
|
||||||
interaction: GuildChatInputCommandInteraction,
|
interaction: GuildChatInputCommandInteraction,
|
||||||
deferred: DeferredEphemeralMessageInteractionResponseBehavior,
|
deferred: DeferredPublicMessageInteractionResponseBehavior,
|
||||||
args: Map<CommandOption, String>
|
args: Map<CommandOption, String>
|
||||||
) {
|
) {
|
||||||
val guildId = interaction.guildId
|
val guildId = interaction.guildId
|
||||||
|
|
|
@ -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.component.options.OptionType
|
||||||
import de.limited_dev.botendo.commands.slash.music.component.MusicManager
|
import de.limited_dev.botendo.commands.slash.music.component.MusicManager
|
||||||
import de.limited_dev.botendo.util.MessageUtil
|
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.kord.core.entity.interaction.GuildChatInputCommandInteraction
|
||||||
import dev.schlaubi.lavakord.audio.Link
|
import dev.schlaubi.lavakord.audio.Link
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ class PlayCommand : SlashCommand(
|
||||||
) {
|
) {
|
||||||
override suspend fun onSlashCommand(
|
override suspend fun onSlashCommand(
|
||||||
interaction: GuildChatInputCommandInteraction,
|
interaction: GuildChatInputCommandInteraction,
|
||||||
deferred: DeferredEphemeralMessageInteractionResponseBehavior,
|
deferred: DeferredPublicMessageInteractionResponseBehavior,
|
||||||
args: Map<CommandOption, String>
|
args: Map<CommandOption, String>
|
||||||
) {
|
) {
|
||||||
val guildId = interaction.guildId
|
val guildId = interaction.guildId
|
||||||
|
|
|
@ -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.commands.slash.music.component.MusicManager
|
||||||
import de.limited_dev.botendo.util.MessageUtil
|
import de.limited_dev.botendo.util.MessageUtil
|
||||||
import de.limited_dev.botendo.util.TimeUtil
|
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.kord.core.entity.interaction.GuildChatInputCommandInteraction
|
||||||
import dev.schlaubi.lavakord.audio.Link
|
import dev.schlaubi.lavakord.audio.Link
|
||||||
|
|
||||||
class QueueCommand : SlashCommand("queue", "Show whats up next", null) {
|
class QueueCommand : SlashCommand("queue", "Show whats up next", null) {
|
||||||
override suspend fun onSlashCommand(
|
override suspend fun onSlashCommand(
|
||||||
interaction: GuildChatInputCommandInteraction,
|
interaction: GuildChatInputCommandInteraction,
|
||||||
deferred: DeferredEphemeralMessageInteractionResponseBehavior,
|
deferred: DeferredPublicMessageInteractionResponseBehavior,
|
||||||
args: Map<CommandOption, String>
|
args: Map<CommandOption, String>
|
||||||
) {
|
) {
|
||||||
val guildId = interaction.guildId
|
val guildId = interaction.guildId
|
||||||
|
|
|
@ -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.MessageUtil
|
||||||
import de.limited_dev.botendo.util.TimeUtil
|
import de.limited_dev.botendo.util.TimeUtil
|
||||||
import de.limited_dev.botendo.util.UrlUtil
|
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.kord.core.entity.interaction.GuildChatInputCommandInteraction
|
||||||
import dev.schlaubi.lavakord.audio.Link
|
import dev.schlaubi.lavakord.audio.Link
|
||||||
|
|
||||||
class SkipCommand : SlashCommand("skip", "Skip to the next song in queue", null) {
|
class SkipCommand : SlashCommand("skip", "Skip to the next song in queue", null) {
|
||||||
override suspend fun onSlashCommand(
|
override suspend fun onSlashCommand(
|
||||||
interaction: GuildChatInputCommandInteraction,
|
interaction: GuildChatInputCommandInteraction,
|
||||||
deferred: DeferredEphemeralMessageInteractionResponseBehavior,
|
deferred: DeferredPublicMessageInteractionResponseBehavior,
|
||||||
args: Map<CommandOption, String>
|
args: Map<CommandOption, String>
|
||||||
) {
|
) {
|
||||||
val guildId = interaction.guildId
|
val guildId = interaction.guildId
|
||||||
|
|
|
@ -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.component.options.CommandOption
|
||||||
import de.limited_dev.botendo.commands.slash.music.component.MusicManager
|
import de.limited_dev.botendo.commands.slash.music.component.MusicManager
|
||||||
import de.limited_dev.botendo.util.MessageUtil
|
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.kord.core.entity.interaction.GuildChatInputCommandInteraction
|
||||||
import dev.schlaubi.lavakord.audio.Link
|
import dev.schlaubi.lavakord.audio.Link
|
||||||
|
|
||||||
class StopCommand : SlashCommand("stop", "Stop playing and start leavin'", null) {
|
class StopCommand : SlashCommand("stop", "Stop playing and start leavin'", null) {
|
||||||
override suspend fun onSlashCommand(
|
override suspend fun onSlashCommand(
|
||||||
interaction: GuildChatInputCommandInteraction,
|
interaction: GuildChatInputCommandInteraction,
|
||||||
deferred: DeferredEphemeralMessageInteractionResponseBehavior,
|
deferred: DeferredPublicMessageInteractionResponseBehavior,
|
||||||
args: Map<CommandOption, String>
|
args: Map<CommandOption, String>
|
||||||
) {
|
) {
|
||||||
val guildId = interaction.guildId
|
val guildId = interaction.guildId
|
||||||
|
|
|
@ -23,7 +23,7 @@ import de.limited_dev.botendo.util.MessageUtil
|
||||||
import de.limited_dev.botendo.util.TimeUtil
|
import de.limited_dev.botendo.util.TimeUtil
|
||||||
import de.limited_dev.botendo.util.UrlUtil
|
import de.limited_dev.botendo.util.UrlUtil
|
||||||
import dev.kord.common.entity.Snowflake
|
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.Guild
|
||||||
import dev.kord.core.entity.interaction.GuildChatInputCommandInteraction
|
import dev.kord.core.entity.interaction.GuildChatInputCommandInteraction
|
||||||
import dev.schlaubi.lavakord.audio.Link
|
import dev.schlaubi.lavakord.audio.Link
|
||||||
|
@ -43,7 +43,7 @@ object MusicManager {
|
||||||
|
|
||||||
suspend fun addToQueue(
|
suspend fun addToQueue(
|
||||||
interaction: GuildChatInputCommandInteraction,
|
interaction: GuildChatInputCommandInteraction,
|
||||||
deferred: DeferredEphemeralMessageInteractionResponseBehavior,
|
deferred: DeferredPublicMessageInteractionResponseBehavior,
|
||||||
link: Link,
|
link: Link,
|
||||||
search: String
|
search: String
|
||||||
) {
|
) {
|
||||||
|
@ -52,7 +52,7 @@ object MusicManager {
|
||||||
|
|
||||||
suspend fun addToQueue(
|
suspend fun addToQueue(
|
||||||
interaction: GuildChatInputCommandInteraction,
|
interaction: GuildChatInputCommandInteraction,
|
||||||
deferred: DeferredEphemeralMessageInteractionResponseBehavior,
|
deferred: DeferredPublicMessageInteractionResponseBehavior,
|
||||||
link: Link,
|
link: Link,
|
||||||
search: String,
|
search: String,
|
||||||
silent: Boolean
|
silent: Boolean
|
||||||
|
|
|
@ -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.SlashCommand
|
||||||
import de.limited_dev.botendo.commands.slash.component.options.CommandOption
|
import de.limited_dev.botendo.commands.slash.component.options.CommandOption
|
||||||
import de.limited_dev.botendo.util.MessageUtil
|
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.kord.core.entity.interaction.GuildChatInputCommandInteraction
|
||||||
|
|
||||||
class InfoCommand : SlashCommand("info", "Shows infos about the bot", null) {
|
class InfoCommand : SlashCommand("info", "Shows infos about the bot", null) {
|
||||||
override suspend fun onSlashCommand(
|
override suspend fun onSlashCommand(
|
||||||
interaction: GuildChatInputCommandInteraction,
|
interaction: GuildChatInputCommandInteraction,
|
||||||
deferred: DeferredEphemeralMessageInteractionResponseBehavior,
|
deferred: DeferredPublicMessageInteractionResponseBehavior,
|
||||||
args: Map<CommandOption, String>
|
args: Map<CommandOption, String>
|
||||||
) {
|
) {
|
||||||
MessageUtil.sendEmbedForInteraction(interaction, deferred, "Botendo v5", "ver." + BuildConstants.version)
|
MessageUtil.sendEmbedForInteraction(interaction, deferred, "Botendo v5", "ver." + BuildConstants.version)
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
package de.limited_dev.botendo.util
|
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.behavior.interaction.response.respond
|
||||||
import dev.kord.core.entity.interaction.GuildChatInputCommandInteraction
|
import dev.kord.core.entity.interaction.GuildChatInputCommandInteraction
|
||||||
import dev.kord.rest.builder.message.EmbedBuilder
|
import dev.kord.rest.builder.message.EmbedBuilder
|
||||||
|
@ -31,7 +31,7 @@ object MessageUtil {
|
||||||
|
|
||||||
suspend fun sendEmbedForInteraction(
|
suspend fun sendEmbedForInteraction(
|
||||||
interaction: GuildChatInputCommandInteraction,
|
interaction: GuildChatInputCommandInteraction,
|
||||||
deferred: DeferredEphemeralMessageInteractionResponseBehavior,
|
deferred: DeferredPublicMessageInteractionResponseBehavior,
|
||||||
title: String,
|
title: String,
|
||||||
description: String
|
description: String
|
||||||
) {
|
) {
|
||||||
|
@ -48,7 +48,7 @@ object MessageUtil {
|
||||||
|
|
||||||
suspend fun sendEmbedForInteractionWithImage(
|
suspend fun sendEmbedForInteractionWithImage(
|
||||||
interaction: GuildChatInputCommandInteraction,
|
interaction: GuildChatInputCommandInteraction,
|
||||||
deferred: DeferredEphemeralMessageInteractionResponseBehavior,
|
deferred: DeferredPublicMessageInteractionResponseBehavior,
|
||||||
title: String,
|
title: String,
|
||||||
description: String,
|
description: String,
|
||||||
thumbnailUrl: String
|
thumbnailUrl: String
|
||||||
|
|
Loading…
Reference in a new issue