diff --git a/.idea/modules.xml b/.idea/modules.xml
index 9ff74293cc..d162fe8631 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -4,14 +4,10 @@
-
-
-
-
\ No newline at end of file
diff --git a/Writerside/v.list b/Writerside/v.list
index 559335bc0e..289a20792e 100644
--- a/Writerside/v.list
+++ b/Writerside/v.list
@@ -2,5 +2,5 @@
-
+
diff --git a/extra-modules/extra-mappings/src/main/kotlin/com/kotlindiscord/kord/extensions/modules/extra/mappings/MappingsExtension.kt b/extra-modules/extra-mappings/src/main/kotlin/com/kotlindiscord/kord/extensions/modules/extra/mappings/MappingsExtension.kt
index b652fb0254..c1c529e316 100644
--- a/extra-modules/extra-mappings/src/main/kotlin/com/kotlindiscord/kord/extensions/modules/extra/mappings/MappingsExtension.kt
+++ b/extra-modules/extra-mappings/src/main/kotlin/com/kotlindiscord/kord/extensions/modules/extra/mappings/MappingsExtension.kt
@@ -28,7 +28,6 @@ import com.kotlindiscord.kord.extensions.pagination.pages.Page
import com.kotlindiscord.kord.extensions.pagination.pages.Pages
import com.kotlindiscord.kord.extensions.plugins.extra.MappingsPlugin
import com.kotlindiscord.kord.extensions.sentry.BreadcrumbType
-import com.kotlindiscord.kord.extensions.types.respond
import dev.kord.core.event.interaction.ChatInputCommandInteractionCreateEvent
import io.github.oshai.kotlinlogging.KotlinLogging
import kotlinx.coroutines.DelicateCoroutinesApi
diff --git a/extra-modules/extra-phishing/src/main/kotlin/com/kotlindiscord/kord/extensions/modules/extra/phishing/PhishingExtension.kt b/extra-modules/extra-phishing/src/main/kotlin/com/kotlindiscord/kord/extensions/modules/extra/phishing/PhishingExtension.kt
index eef0732a39..038d8edb7d 100644
--- a/extra-modules/extra-phishing/src/main/kotlin/com/kotlindiscord/kord/extensions/modules/extra/phishing/PhishingExtension.kt
+++ b/extra-modules/extra-phishing/src/main/kotlin/com/kotlindiscord/kord/extensions/modules/extra/phishing/PhishingExtension.kt
@@ -18,7 +18,6 @@ import com.kotlindiscord.kord.extensions.extensions.Extension
import com.kotlindiscord.kord.extensions.extensions.ephemeralMessageCommand
import com.kotlindiscord.kord.extensions.extensions.ephemeralSlashCommand
import com.kotlindiscord.kord.extensions.extensions.event
-import com.kotlindiscord.kord.extensions.types.respond
import com.kotlindiscord.kord.extensions.utils.dm
import com.kotlindiscord.kord.extensions.utils.getJumpUrl
import com.kotlindiscord.kord.extensions.utils.tagOrUsername
diff --git a/extra-modules/extra-pluralkit/src/main/kotlin/com/kotlindiscord/kord/extensions/modules/extra/pluralkit/PKExtension.kt b/extra-modules/extra-pluralkit/src/main/kotlin/com/kotlindiscord/kord/extensions/modules/extra/pluralkit/PKExtension.kt
index 27e4776142..6155ef2e76 100644
--- a/extra-modules/extra-pluralkit/src/main/kotlin/com/kotlindiscord/kord/extensions/modules/extra/pluralkit/PKExtension.kt
+++ b/extra-modules/extra-pluralkit/src/main/kotlin/com/kotlindiscord/kord/extensions/modules/extra/pluralkit/PKExtension.kt
@@ -31,7 +31,6 @@ import com.kotlindiscord.kord.extensions.modules.extra.pluralkit.storage.PKGuild
import com.kotlindiscord.kord.extensions.modules.extra.pluralkit.utils.LRUHashMap
import com.kotlindiscord.kord.extensions.storage.StorageType
import com.kotlindiscord.kord.extensions.storage.StorageUnit
-import com.kotlindiscord.kord.extensions.types.respond
import com.kotlindiscord.kord.extensions.utils.scheduling.Scheduler
import com.kotlindiscord.kord.extensions.utils.scheduling.Task
import dev.kord.common.entity.Permission
diff --git a/gradle.properties b/gradle.properties
index 0c480781f8..9d5a1f4e88 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -4,7 +4,7 @@ kotlin.incremental = true
ksp.incremental = false
# Must be updated for Writerside in v.list
-projectVersion = 1.5.11-SNAPSHOT
+projectVersion = 1.6.0-SNAPSHOT
#dokka will run out of memory with the default meta space
org.gradle.jvmargs=-XX:MaxMetaspaceSize=1024m
diff --git a/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/annotations/AlwaysPublicResponse.kt b/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/annotations/AlwaysPublicResponse.kt
new file mode 100644
index 0000000000..8b8b20bafa
--- /dev/null
+++ b/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/annotations/AlwaysPublicResponse.kt
@@ -0,0 +1,16 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+
+package com.kotlindiscord.kord.extensions.annotations
+
+/** Marks a function that always results in public interaction responses. **/
+@RequiresOptIn(
+ message = "This function will always result in a public interaction response, even if used within an " +
+ "ephemeral interaction.",
+ level = RequiresOptIn.Level.WARNING
+)
+@Target(AnnotationTarget.FUNCTION)
+public annotation class AlwaysPublicResponse
diff --git a/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/annotations/UnexpectedBehaviour.kt b/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/annotations/UnexpectedBehaviour.kt
new file mode 100644
index 0000000000..5772285024
--- /dev/null
+++ b/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/annotations/UnexpectedBehaviour.kt
@@ -0,0 +1,16 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+
+package com.kotlindiscord.kord.extensions.annotations
+
+/** Marks a function that may result in unexpected behaviour, and ask the developer to check the docs. **/
+@RequiresOptIn(
+ message = "Calling this function may result in unexpected behaviour. Please ensure you read its documentation " +
+ "comment before continuing.",
+ level = RequiresOptIn.Level.WARNING
+)
+@Target(AnnotationTarget.FUNCTION)
+public annotation class UnexpectedBehaviour
diff --git a/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/commands/application/message/EphemeralMessageCommand.kt b/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/commands/application/message/EphemeralMessageCommand.kt
index 2059661433..5705891da6 100644
--- a/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/commands/application/message/EphemeralMessageCommand.kt
+++ b/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/commands/application/message/EphemeralMessageCommand.kt
@@ -18,7 +18,6 @@ import com.kotlindiscord.kord.extensions.commands.events.EphemeralMessageCommand
import com.kotlindiscord.kord.extensions.components.forms.ModalForm
import com.kotlindiscord.kord.extensions.extensions.Extension
import com.kotlindiscord.kord.extensions.types.FailureReason
-import com.kotlindiscord.kord.extensions.types.respond
import com.kotlindiscord.kord.extensions.utils.MutableStringKeyedMap
import com.kotlindiscord.kord.extensions.utils.getLocale
import dev.kord.common.annotation.KordUnsafe
diff --git a/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/commands/application/message/PublicMessageCommand.kt b/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/commands/application/message/PublicMessageCommand.kt
index 9fa390bace..96b4b7f672 100644
--- a/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/commands/application/message/PublicMessageCommand.kt
+++ b/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/commands/application/message/PublicMessageCommand.kt
@@ -18,7 +18,6 @@ import com.kotlindiscord.kord.extensions.commands.events.PublicMessageCommandSuc
import com.kotlindiscord.kord.extensions.components.forms.ModalForm
import com.kotlindiscord.kord.extensions.extensions.Extension
import com.kotlindiscord.kord.extensions.types.FailureReason
-import com.kotlindiscord.kord.extensions.types.respond
import com.kotlindiscord.kord.extensions.utils.MutableStringKeyedMap
import com.kotlindiscord.kord.extensions.utils.getLocale
import dev.kord.common.annotation.KordUnsafe
diff --git a/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/commands/application/slash/EphemeralSlashCommand.kt b/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/commands/application/slash/EphemeralSlashCommand.kt
index 962afb2865..d43b5fd8ba 100644
--- a/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/commands/application/slash/EphemeralSlashCommand.kt
+++ b/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/commands/application/slash/EphemeralSlashCommand.kt
@@ -17,7 +17,6 @@ import com.kotlindiscord.kord.extensions.commands.events.*
import com.kotlindiscord.kord.extensions.components.forms.ModalForm
import com.kotlindiscord.kord.extensions.extensions.Extension
import com.kotlindiscord.kord.extensions.types.FailureReason
-import com.kotlindiscord.kord.extensions.types.respond
import com.kotlindiscord.kord.extensions.utils.MutableStringKeyedMap
import com.kotlindiscord.kord.extensions.utils.getLocale
import dev.kord.common.annotation.KordUnsafe
diff --git a/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/commands/application/slash/PublicSlashCommand.kt b/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/commands/application/slash/PublicSlashCommand.kt
index e4e222148f..68b71b28ba 100644
--- a/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/commands/application/slash/PublicSlashCommand.kt
+++ b/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/commands/application/slash/PublicSlashCommand.kt
@@ -17,7 +17,6 @@ import com.kotlindiscord.kord.extensions.commands.events.*
import com.kotlindiscord.kord.extensions.components.forms.ModalForm
import com.kotlindiscord.kord.extensions.extensions.Extension
import com.kotlindiscord.kord.extensions.types.FailureReason
-import com.kotlindiscord.kord.extensions.types.respond
import com.kotlindiscord.kord.extensions.utils.MutableStringKeyedMap
import com.kotlindiscord.kord.extensions.utils.getLocale
import dev.kord.common.annotation.KordUnsafe
diff --git a/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/commands/application/user/EphemeralUserCommand.kt b/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/commands/application/user/EphemeralUserCommand.kt
index be1c3be1b5..7f28f2a8a1 100644
--- a/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/commands/application/user/EphemeralUserCommand.kt
+++ b/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/commands/application/user/EphemeralUserCommand.kt
@@ -18,7 +18,6 @@ import com.kotlindiscord.kord.extensions.commands.events.EphemeralUserCommandSuc
import com.kotlindiscord.kord.extensions.components.forms.ModalForm
import com.kotlindiscord.kord.extensions.extensions.Extension
import com.kotlindiscord.kord.extensions.types.FailureReason
-import com.kotlindiscord.kord.extensions.types.respond
import com.kotlindiscord.kord.extensions.utils.MutableStringKeyedMap
import com.kotlindiscord.kord.extensions.utils.getLocale
import dev.kord.common.annotation.KordUnsafe
diff --git a/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/commands/application/user/PublicUserCommand.kt b/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/commands/application/user/PublicUserCommand.kt
index 6002a1f066..ff90bedea4 100644
--- a/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/commands/application/user/PublicUserCommand.kt
+++ b/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/commands/application/user/PublicUserCommand.kt
@@ -18,7 +18,6 @@ import com.kotlindiscord.kord.extensions.commands.events.PublicUserCommandSuccee
import com.kotlindiscord.kord.extensions.components.forms.ModalForm
import com.kotlindiscord.kord.extensions.extensions.Extension
import com.kotlindiscord.kord.extensions.types.FailureReason
-import com.kotlindiscord.kord.extensions.types.respond
import com.kotlindiscord.kord.extensions.utils.MutableStringKeyedMap
import com.kotlindiscord.kord.extensions.utils.getLocale
import dev.kord.common.annotation.KordUnsafe
diff --git a/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/components/buttons/EphemeralInteractionButton.kt b/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/components/buttons/EphemeralInteractionButton.kt
index 9c5802987a..43385c6414 100644
--- a/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/components/buttons/EphemeralInteractionButton.kt
+++ b/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/components/buttons/EphemeralInteractionButton.kt
@@ -12,7 +12,6 @@ package com.kotlindiscord.kord.extensions.components.buttons
import com.kotlindiscord.kord.extensions.DiscordRelayedException
import com.kotlindiscord.kord.extensions.components.forms.ModalForm
import com.kotlindiscord.kord.extensions.types.FailureReason
-import com.kotlindiscord.kord.extensions.types.respond
import com.kotlindiscord.kord.extensions.utils.MutableStringKeyedMap
import com.kotlindiscord.kord.extensions.utils.getLocale
import com.kotlindiscord.kord.extensions.utils.scheduling.Task
diff --git a/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/components/buttons/PublicInteractionButton.kt b/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/components/buttons/PublicInteractionButton.kt
index b7a15b4967..03df43ba4a 100644
--- a/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/components/buttons/PublicInteractionButton.kt
+++ b/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/components/buttons/PublicInteractionButton.kt
@@ -12,7 +12,6 @@ package com.kotlindiscord.kord.extensions.components.buttons
import com.kotlindiscord.kord.extensions.DiscordRelayedException
import com.kotlindiscord.kord.extensions.components.forms.ModalForm
import com.kotlindiscord.kord.extensions.types.FailureReason
-import com.kotlindiscord.kord.extensions.types.respond
import com.kotlindiscord.kord.extensions.utils.MutableStringKeyedMap
import com.kotlindiscord.kord.extensions.utils.getLocale
import com.kotlindiscord.kord.extensions.utils.scheduling.Task
diff --git a/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/components/menus/EphemeralSelectMenu.kt b/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/components/menus/EphemeralSelectMenu.kt
index 4c6ff3067d..121bdac9e2 100644
--- a/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/components/menus/EphemeralSelectMenu.kt
+++ b/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/components/menus/EphemeralSelectMenu.kt
@@ -11,7 +11,6 @@ import com.kotlindiscord.kord.extensions.components.forms.ModalForm
import com.kotlindiscord.kord.extensions.components.menus.channel.InitialEphemeralSelectMenuResponseBuilder
import com.kotlindiscord.kord.extensions.types.EphemeralInteractionContext
import com.kotlindiscord.kord.extensions.types.FailureReason
-import com.kotlindiscord.kord.extensions.types.respond
import com.kotlindiscord.kord.extensions.utils.MutableStringKeyedMap
import com.kotlindiscord.kord.extensions.utils.getLocale
import com.kotlindiscord.kord.extensions.utils.scheduling.Task
diff --git a/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/components/menus/PublicSelectMenu.kt b/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/components/menus/PublicSelectMenu.kt
index 29b603b0c5..d81513121b 100644
--- a/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/components/menus/PublicSelectMenu.kt
+++ b/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/components/menus/PublicSelectMenu.kt
@@ -11,7 +11,6 @@ import com.kotlindiscord.kord.extensions.components.forms.ModalForm
import com.kotlindiscord.kord.extensions.components.menus.channel.InitialEphemeralSelectMenuResponseBuilder
import com.kotlindiscord.kord.extensions.types.FailureReason
import com.kotlindiscord.kord.extensions.types.PublicInteractionContext
-import com.kotlindiscord.kord.extensions.types.respond
import com.kotlindiscord.kord.extensions.utils.MutableStringKeyedMap
import com.kotlindiscord.kord.extensions.utils.getLocale
import com.kotlindiscord.kord.extensions.utils.scheduling.Task
diff --git a/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/extensions/impl/SentryExtension.kt b/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/extensions/impl/SentryExtension.kt
index ac69c72e73..eeabf69d2b 100644
--- a/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/extensions/impl/SentryExtension.kt
+++ b/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/extensions/impl/SentryExtension.kt
@@ -15,7 +15,6 @@ import com.kotlindiscord.kord.extensions.extensions.chatCommand
import com.kotlindiscord.kord.extensions.extensions.ephemeralSlashCommand
import com.kotlindiscord.kord.extensions.sentry.SentryAdapter
import com.kotlindiscord.kord.extensions.sentry.sentryId
-import com.kotlindiscord.kord.extensions.types.respond
import com.kotlindiscord.kord.extensions.utils.respond
import com.kotlindiscord.kord.extensions.utils.tagOrUsername
import io.sentry.Sentry
diff --git a/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/types/EphemeralInteractionContext.kt b/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/types/EphemeralInteractionContext.kt
index 9ccbc93605..0ef9ef4bc9 100644
--- a/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/types/EphemeralInteractionContext.kt
+++ b/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/types/EphemeralInteractionContext.kt
@@ -6,6 +6,8 @@
package com.kotlindiscord.kord.extensions.types
+import com.kotlindiscord.kord.extensions.annotations.AlwaysPublicResponse
+import com.kotlindiscord.kord.extensions.annotations.UnexpectedBehaviour
import com.kotlindiscord.kord.extensions.pagination.EphemeralResponsePaginator
import com.kotlindiscord.kord.extensions.pagination.PublicFollowUpPaginator
import com.kotlindiscord.kord.extensions.pagination.builders.PaginatorBuilder
@@ -20,58 +22,53 @@ import dev.kord.rest.builder.message.create.FollowupMessageCreateBuilder
import dev.kord.rest.builder.message.modify.InteractionResponseModifyBuilder
import java.util.*
-/** Interface representing an ephemeral-only interaction action context. **/
-public interface EphemeralInteractionContext {
- /** Response created by acknowledging the interaction ephemerally. **/
- public val interactionResponse: EphemeralMessageInteractionResponseBehavior
-}
-
/**
- * Respond to the current interaction with an ephemeral followup.
+ * Interface representing an ephemeral interaction context.
*
- * **Note:** Calling this twice (or at all after [edit]) will result in a public followup!
+ * @see InteractionContext
*/
-public suspend inline fun EphemeralInteractionContext.respond(
- builder: FollowupMessageCreateBuilder.() -> Unit
-): EphemeralFollowupMessage = interactionResponse.createEphemeralFollowup { builder() }
+public interface EphemeralInteractionContext : InteractionContext<
+ EphemeralMessageInteractionResponseBehavior,
+ EphemeralMessageInteractionResponse,
+ EphemeralFollowupMessage,
+ PublicFollowupMessage,
+ > {
-/** Respond to the current interaction with a public followup. **/
-public suspend inline fun EphemeralInteractionContext.respondPublic(
- builder: FollowupMessageCreateBuilder.() -> Unit
-): PublicFollowupMessage = interactionResponse.createPublicFollowup { builder() }
+ public override suspend fun respond(
+ builder: suspend FollowupMessageCreateBuilder.() -> Unit,
+ ): EphemeralFollowupMessage = interactionResponse.createEphemeralFollowup { builder() }
-/**
- * Edit the current interaction's response.
- */
-public suspend inline fun EphemeralInteractionContext.edit(
- builder: InteractionResponseModifyBuilder.() -> Unit
-): EphemeralMessageInteractionResponse = interactionResponse.edit(builder)
+ @UnexpectedBehaviour
+ public override suspend fun respondOpposite(
+ builder: suspend FollowupMessageCreateBuilder.() -> Unit,
+ ): PublicFollowupMessage = interactionResponse.createPublicFollowup { builder() }
-/**
- * Create a paginator that edits the original interaction. This is the only option for an ephemeral interaction, as
- * it's impossible to edit an ephemeral follow-up.
- */
-public inline fun EphemeralInteractionContext.editingPaginator(
- defaultGroup: String = "",
- locale: Locale? = null,
- builder: (PaginatorBuilder).() -> Unit
-): EphemeralResponsePaginator {
- val pages = PaginatorBuilder(locale = locale, defaultGroup = defaultGroup)
+ public override suspend fun edit(
+ builder: suspend InteractionResponseModifyBuilder.() -> Unit,
+ ): EphemeralMessageInteractionResponse = interactionResponse.edit { builder() }
- builder(pages)
+ public override fun editingPaginator(
+ defaultGroup: String,
+ locale: Locale?,
+ builder: (PaginatorBuilder).() -> Unit,
+ ): EphemeralResponsePaginator {
+ val pages = PaginatorBuilder(locale = locale, defaultGroup = defaultGroup)
- return EphemeralResponsePaginator(pages, interactionResponse)
-}
+ builder(pages)
+
+ return EphemeralResponsePaginator(pages, interactionResponse)
+ }
-/** Create a paginator that creates a follow-up message, and edits that. **/
-public inline fun EphemeralInteractionContext.publicRespondingPaginator(
- defaultGroup: String = "",
- locale: Locale? = null,
- builder: (PaginatorBuilder).() -> Unit
-): PublicFollowUpPaginator {
- val pages = PaginatorBuilder(locale = locale, defaultGroup = defaultGroup)
+ @AlwaysPublicResponse
+ public override fun respondingPaginator(
+ defaultGroup: String,
+ locale: Locale?,
+ builder: (PaginatorBuilder).() -> Unit,
+ ): PublicFollowUpPaginator {
+ val pages = PaginatorBuilder(locale = locale, defaultGroup = defaultGroup)
- builder(pages)
+ builder(pages)
- return PublicFollowUpPaginator(pages, interactionResponse)
+ return PublicFollowUpPaginator(pages, interactionResponse)
+ }
}
diff --git a/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/types/InteractionContext.kt b/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/types/InteractionContext.kt
new file mode 100644
index 0000000000..30599455bc
--- /dev/null
+++ b/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/types/InteractionContext.kt
@@ -0,0 +1,79 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+
+@file:Suppress("UnnecessaryAbstractClass")
+
+package com.kotlindiscord.kord.extensions.types
+
+import com.kotlindiscord.kord.extensions.annotations.AlwaysPublicResponse
+import com.kotlindiscord.kord.extensions.annotations.UnexpectedBehaviour
+import com.kotlindiscord.kord.extensions.pagination.BaseButtonPaginator
+import com.kotlindiscord.kord.extensions.pagination.builders.PaginatorBuilder
+import dev.kord.core.entity.interaction.followup.FollowupMessage
+import dev.kord.core.entity.interaction.response.MessageInteractionResponse
+import dev.kord.rest.builder.message.create.FollowupMessageCreateBuilder
+import dev.kord.rest.builder.message.modify.InteractionResponseModifyBuilder
+import java.util.*
+
+/**
+ * Interface representing an interaction context. Provides a generic base type for action contexts when working
+ * with interactions.
+ *
+ * More specific types representing each interaction type (ephemeral/public) extend this class.
+ *
+ * @param ResponseBehavior Generic representing the relevant interaction response behavior.
+ * @param FollowupType Generic representing the follow-up type for the current interaction type.
+ * @param OppositeFollowupType Generic representing the opposite follow-up type for the current interaction type.
+ */
+public interface InteractionContext<
+ ResponseBehavior,
+ ResponseType : MessageInteractionResponse,
+ FollowupType : FollowupMessage,
+ OppositeFollowupType : FollowupMessage,
+ > {
+ /** Current interaction response being worked with. **/
+ public val interactionResponse: ResponseBehavior
+
+ /** Create a paginator that edits the original interaction response. **/
+ public fun editingPaginator(
+ defaultGroup: String = "",
+ locale: Locale? = null,
+ builder: (PaginatorBuilder).() -> Unit,
+ ): BaseButtonPaginator
+
+ /**
+ * Create a paginator that creates a follow-up message, and edits that.
+ *
+ * This function always creates a public follow-up, as Discord prevents bots from editing ephemeral follow-ups.
+ */
+ @AlwaysPublicResponse
+ public fun respondingPaginator(
+ defaultGroup: String = "",
+ locale: Locale? = null,
+ builder: (PaginatorBuilder).() -> Unit,
+ ): BaseButtonPaginator
+
+ /** Edit the original interaction response. **/
+ public suspend fun edit(
+ builder: suspend InteractionResponseModifyBuilder.() -> Unit,
+ ): ResponseType
+
+ /** Create a follow-up response. **/
+ public suspend fun respond(
+ builder: suspend FollowupMessageCreateBuilder.() -> Unit,
+ ): FollowupType
+
+ /**
+ * Create a follow-up response using the opposite interaction type.
+ *
+ * While Discord's API allows you to do this, it will rarely do what you'd expect.
+ * Only use this if you're sure it'll do what you want, and test thoroughly.
+ */
+ @UnexpectedBehaviour
+ public suspend fun respondOpposite(
+ builder: suspend FollowupMessageCreateBuilder.() -> Unit,
+ ): OppositeFollowupType
+}
diff --git a/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/types/PublicInteractionContext.kt b/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/types/PublicInteractionContext.kt
index cb6016ac2d..ec6526d061 100644
--- a/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/types/PublicInteractionContext.kt
+++ b/kord-extensions/src/main/kotlin/com/kotlindiscord/kord/extensions/types/PublicInteractionContext.kt
@@ -6,6 +6,8 @@
package com.kotlindiscord.kord.extensions.types
+import com.kotlindiscord.kord.extensions.annotations.AlwaysPublicResponse
+import com.kotlindiscord.kord.extensions.annotations.UnexpectedBehaviour
import com.kotlindiscord.kord.extensions.pagination.PublicFollowUpPaginator
import com.kotlindiscord.kord.extensions.pagination.PublicResponsePaginator
import com.kotlindiscord.kord.extensions.pagination.builders.PaginatorBuilder
@@ -20,51 +22,52 @@ import dev.kord.rest.builder.message.create.FollowupMessageCreateBuilder
import dev.kord.rest.builder.message.modify.InteractionResponseModifyBuilder
import java.util.*
-/** Interface representing a public-only interaction action context. **/
-public interface PublicInteractionContext {
- /** Response created by acknowledging the interaction publicly. **/
- public val interactionResponse: PublicMessageInteractionResponseBehavior
-}
-
-/** Respond to the current interaction with a public followup. **/
-public suspend inline fun PublicInteractionContext.respond(
- builder: FollowupMessageCreateBuilder.() -> Unit
-): PublicFollowupMessage = interactionResponse.createPublicFollowup { builder() }
-
-/** Respond to the current interaction with an ephemeral followup. **/
-public suspend inline fun PublicInteractionContext.respondEphemeral(
- builder: FollowupMessageCreateBuilder.() -> Unit
-): EphemeralFollowupMessage = interactionResponse.createEphemeralFollowup { builder() }
-
/**
- * Edit the current interaction's response.
+ * Interface representing a public interaction context.
+ *
+ * @see InteractionContext
*/
-public suspend inline fun PublicInteractionContext.edit(
- builder: InteractionResponseModifyBuilder.() -> Unit
-): PublicMessageInteractionResponse = interactionResponse.edit(builder)
+public interface PublicInteractionContext : InteractionContext<
+ PublicMessageInteractionResponseBehavior,
+ PublicMessageInteractionResponse,
+ PublicFollowupMessage,
+ EphemeralFollowupMessage,
+ > {
+ public override suspend fun respond(
+ builder: suspend FollowupMessageCreateBuilder.() -> Unit,
+ ): PublicFollowupMessage = interactionResponse.createPublicFollowup { builder() }
-/** Create a paginator that edits the original interaction. **/
-public inline fun PublicInteractionContext.editingPaginator(
- defaultGroup: String = "",
- locale: Locale? = null,
- builder: (PaginatorBuilder).() -> Unit
-): PublicResponsePaginator {
- val pages = PaginatorBuilder(locale = locale, defaultGroup = defaultGroup)
+ @UnexpectedBehaviour
+ public override suspend fun respondOpposite(
+ builder: suspend FollowupMessageCreateBuilder.() -> Unit,
+ ): EphemeralFollowupMessage = interactionResponse.createEphemeralFollowup { builder() }
- builder(pages)
+ public override suspend fun edit(
+ builder: suspend InteractionResponseModifyBuilder.() -> Unit,
+ ): PublicMessageInteractionResponse = interactionResponse.edit { builder() }
- return PublicResponsePaginator(pages, interactionResponse)
-}
+ public override fun editingPaginator(
+ defaultGroup: String,
+ locale: Locale?,
+ builder: (PaginatorBuilder).() -> Unit,
+ ): PublicResponsePaginator {
+ val pages = PaginatorBuilder(locale = locale, defaultGroup = defaultGroup)
+
+ builder(pages)
+
+ return PublicResponsePaginator(pages, interactionResponse)
+ }
-/** Create a paginator that creates a follow-up message, and edits that. **/
-public inline fun PublicInteractionContext.respondingPaginator(
- defaultGroup: String = "",
- locale: Locale? = null,
- builder: (PaginatorBuilder).() -> Unit
-): PublicFollowUpPaginator {
- val pages = PaginatorBuilder(locale = locale, defaultGroup = defaultGroup)
+ @AlwaysPublicResponse
+ public override fun respondingPaginator(
+ defaultGroup: String,
+ locale: Locale?,
+ builder: (PaginatorBuilder).() -> Unit,
+ ): PublicFollowUpPaginator {
+ val pages = PaginatorBuilder(locale = locale, defaultGroup = defaultGroup)
- builder(pages)
+ builder(pages)
- return PublicFollowUpPaginator(pages, interactionResponse)
+ return PublicFollowUpPaginator(pages, interactionResponse)
+ }
}
diff --git a/test-bot/src/main/kotlin/com/kotlindiscord/kord/extensions/testbot/extensions/ArgumentTestExtension.kt b/test-bot/src/main/kotlin/com/kotlindiscord/kord/extensions/testbot/extensions/ArgumentTestExtension.kt
index c6a7a68070..9715472ad0 100644
--- a/test-bot/src/main/kotlin/com/kotlindiscord/kord/extensions/testbot/extensions/ArgumentTestExtension.kt
+++ b/test-bot/src/main/kotlin/com/kotlindiscord/kord/extensions/testbot/extensions/ArgumentTestExtension.kt
@@ -12,7 +12,6 @@ import com.kotlindiscord.kord.extensions.commands.Arguments
import com.kotlindiscord.kord.extensions.commands.converters.impl.*
import com.kotlindiscord.kord.extensions.extensions.Extension
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
-import com.kotlindiscord.kord.extensions.types.respond
import com.kotlindiscord.kord.extensions.utils.suggestStringMap
import dev.kord.common.entity.ChannelType
import dev.kord.common.entity.ForumTag
diff --git a/test-bot/src/main/kotlin/com/kotlindiscord/kord/extensions/testbot/extensions/I18nTestExtension.kt b/test-bot/src/main/kotlin/com/kotlindiscord/kord/extensions/testbot/extensions/I18nTestExtension.kt
index 5a84036af0..b5f665e23d 100644
--- a/test-bot/src/main/kotlin/com/kotlindiscord/kord/extensions/testbot/extensions/I18nTestExtension.kt
+++ b/test-bot/src/main/kotlin/com/kotlindiscord/kord/extensions/testbot/extensions/I18nTestExtension.kt
@@ -18,7 +18,6 @@ import com.kotlindiscord.kord.extensions.commands.converters.impl.string
import com.kotlindiscord.kord.extensions.extensions.Extension
import com.kotlindiscord.kord.extensions.extensions.ephemeralSlashCommand
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
-import com.kotlindiscord.kord.extensions.types.respond
import dev.kord.common.asJavaLocale
import dev.kord.core.behavior.interaction.suggestString
import dev.kord.core.event.interaction.ChatInputCommandInteractionCreateEvent
diff --git a/test-bot/src/main/kotlin/com/kotlindiscord/kord/extensions/testbot/extensions/ModalTestExtension.kt b/test-bot/src/main/kotlin/com/kotlindiscord/kord/extensions/testbot/extensions/ModalTestExtension.kt
index 891feebc17..da061f8f30 100644
--- a/test-bot/src/main/kotlin/com/kotlindiscord/kord/extensions/testbot/extensions/ModalTestExtension.kt
+++ b/test-bot/src/main/kotlin/com/kotlindiscord/kord/extensions/testbot/extensions/ModalTestExtension.kt
@@ -18,7 +18,6 @@ import com.kotlindiscord.kord.extensions.extensions.Extension
import com.kotlindiscord.kord.extensions.extensions.publicMessageCommand
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
import com.kotlindiscord.kord.extensions.extensions.publicUserCommand
-import com.kotlindiscord.kord.extensions.types.respond
public class ModalTestExtension : Extension() {
override val name: String = "modals"
diff --git a/test-bot/src/main/kotlin/com/kotlindiscord/kord/extensions/testbot/extensions/NestingTestExtension.kt b/test-bot/src/main/kotlin/com/kotlindiscord/kord/extensions/testbot/extensions/NestingTestExtension.kt
index 85f2e951f5..e0d5efaf5c 100644
--- a/test-bot/src/main/kotlin/com/kotlindiscord/kord/extensions/testbot/extensions/NestingTestExtension.kt
+++ b/test-bot/src/main/kotlin/com/kotlindiscord/kord/extensions/testbot/extensions/NestingTestExtension.kt
@@ -10,7 +10,6 @@ import com.kotlindiscord.kord.extensions.commands.application.slash.group
import com.kotlindiscord.kord.extensions.commands.application.slash.publicSubCommand
import com.kotlindiscord.kord.extensions.extensions.Extension
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
-import com.kotlindiscord.kord.extensions.types.respond
public class NestingTestExtension : Extension() {
override val name: String = "test-nesting"
diff --git a/test-bot/src/main/kotlin/com/kotlindiscord/kord/extensions/testbot/extensions/PaginatorTestExtension.kt b/test-bot/src/main/kotlin/com/kotlindiscord/kord/extensions/testbot/extensions/PaginatorTestExtension.kt
index 684fb98f27..f51e96592b 100644
--- a/test-bot/src/main/kotlin/com/kotlindiscord/kord/extensions/testbot/extensions/PaginatorTestExtension.kt
+++ b/test-bot/src/main/kotlin/com/kotlindiscord/kord/extensions/testbot/extensions/PaginatorTestExtension.kt
@@ -11,7 +11,6 @@ package com.kotlindiscord.kord.extensions.testbot.extensions
import com.kotlindiscord.kord.extensions.commands.application.slash.publicSubCommand
import com.kotlindiscord.kord.extensions.extensions.Extension
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
-import com.kotlindiscord.kord.extensions.types.editingPaginator
public class PaginatorTestExtension : Extension() {
override val name: String = "test-paginator"
diff --git a/test-bot/src/main/kotlin/com/kotlindiscord/kord/extensions/testbot/extensions/SelectorTestExtension.kt b/test-bot/src/main/kotlin/com/kotlindiscord/kord/extensions/testbot/extensions/SelectorTestExtension.kt
index c69e1d0db6..3720769b3b 100644
--- a/test-bot/src/main/kotlin/com/kotlindiscord/kord/extensions/testbot/extensions/SelectorTestExtension.kt
+++ b/test-bot/src/main/kotlin/com/kotlindiscord/kord/extensions/testbot/extensions/SelectorTestExtension.kt
@@ -11,7 +11,6 @@ import com.kotlindiscord.kord.extensions.commands.application.slash.publicSubCom
import com.kotlindiscord.kord.extensions.components.*
import com.kotlindiscord.kord.extensions.extensions.Extension
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
-import com.kotlindiscord.kord.extensions.types.respond
import dev.kord.common.entity.ChannelType
import dev.kord.core.behavior.channel.asChannelOf
import dev.kord.core.entity.channel.TextChannel
diff --git a/test-bot/src/main/kotlin/com/kotlindiscord/kord/extensions/testbot/plugin/TestPluginExtension.kt b/test-bot/src/main/kotlin/com/kotlindiscord/kord/extensions/testbot/plugin/TestPluginExtension.kt
index 7b511862e3..02d5c71427 100644
--- a/test-bot/src/main/kotlin/com/kotlindiscord/kord/extensions/testbot/plugin/TestPluginExtension.kt
+++ b/test-bot/src/main/kotlin/com/kotlindiscord/kord/extensions/testbot/plugin/TestPluginExtension.kt
@@ -14,7 +14,6 @@ import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
import com.kotlindiscord.kord.extensions.plugins.PluginManager
import com.kotlindiscord.kord.extensions.plugins.extra.MappingsPlugin
import com.kotlindiscord.kord.extensions.testbot.utils.assert
-import com.kotlindiscord.kord.extensions.types.respond
import org.koin.core.component.inject
import org.pf4j.PluginState