From e2e5f19f967e7c122f3986b9fa7a31c42a485409 Mon Sep 17 00:00:00 2001 From: Luca Kellermann Date: Mon, 19 Aug 2024 20:44:07 +0200 Subject: [PATCH 1/4] Publish snapshots to https://repo.kord.dev/snapshots (#961) --- .github/workflows/deployment-ci.yml | 2 ++ README.md | 21 +++++++++++++++---- .../main/kotlin/kord-publishing.gradle.kts | 11 ++++++++++ 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deployment-ci.yml b/.github/workflows/deployment-ci.yml index f372fdbf87f..12e5d765085 100644 --- a/.github/workflows/deployment-ci.yml +++ b/.github/workflows/deployment-ci.yml @@ -42,6 +42,8 @@ jobs: KORD_TEST_TOKEN: ${{ secrets.KORD_TEST_TOKEN }} NEXUS_USER: ${{ secrets.NEXUS_USER }} NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} + KORD_REPO_USER: ${{ secrets.KORD_REPO_USER }} + KORD_REPO_PASSWORD: ${{ secrets.KORD_REPO_PASSWORD }} SIGNING_KEY: ${{ secrets.signingKey }} SIGNING_PASSWORD: ${{ secrets.signingPassword }} steps: diff --git a/README.md b/README.md index 01d68716b00..e19a99d4636 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,8 @@ in [`gradle.properties`](gradle.properties)) ```kotlin repositories { mavenCentral() - // Kord Snapshots Repository (Optional): + // Kord Snapshot Repositories (optional, choose one of these): + maven("https://repo.kord.dev/snapshots") maven("https://oss.sonatype.org/content/repositories/snapshots") } @@ -82,7 +83,10 @@ dependencies { ```groovy repositories { mavenCentral() - // Kord Snapshots Repository (Optional): + // Kord Snapshot Repositories (optional, choose one of these): + maven { + url "https://repo.kord.dev/snapshots" + } maven { url "https://oss.sonatype.org/content/repositories/snapshots" } @@ -95,9 +99,19 @@ dependencies { ### Maven -##### Kord Snapshots Repository (Optional): +##### Kord Snapshot Repositories (optional, choose one of these): ```xml + + snapshots-repo + https://repo.kord.dev/snapshots + + false + + + true + + snapshots-repo @@ -114,7 +128,6 @@ dependencies { --- ```xml - dev.kord kord-core-jvm diff --git a/buildSrc/src/main/kotlin/kord-publishing.gradle.kts b/buildSrc/src/main/kotlin/kord-publishing.gradle.kts index a001f7113cc..89913975c14 100644 --- a/buildSrc/src/main/kotlin/kord-publishing.gradle.kts +++ b/buildSrc/src/main/kotlin/kord-publishing.gradle.kts @@ -68,6 +68,17 @@ publishing { password = getenv("NEXUS_PASSWORD") } } + + if (!isRelease) { + maven { + name = "kordSnapshots" + url = uri("https://repo.kord.dev/snapshots") + credentials { + username = getenv("KORD_REPO_USER") + password = getenv("KORD_REPO_PASSWORD") + } + } + } } } From a4311db4775ee5c7df8aa527999cee4403125901 Mon Sep 17 00:00:00 2001 From: Luca Kellermann Date: Tue, 20 Aug 2024 00:09:25 +0200 Subject: [PATCH 2/4] Document deprecation cycle of deprecated declarations (#969) --- .../dev/kord/common/entity/Permission.kt | 10 +++--- .../kord/common/entity/SystemChannelFlag.kt | 6 ++-- .../kotlin/dev/kord/common/entity/UserFlag.kt | 2 +- common/src/commonMain/kotlin/DiscordBitSet.kt | 2 +- common/src/commonMain/kotlin/Locale.kt | 2 +- .../kotlin/entity/DiscordChannel.kt | 2 +- .../commonMain/kotlin/entity/DiscordShard.kt | 6 ++-- .../commonMain/kotlin/entity/Permissions.kt | 3 +- core/src/commonMain/kotlin/Kord.kt | 2 +- .../interaction/ApplicationCommandCreate.kt | 15 +++++--- .../interaction/ApplicationCommandDelete.kt | 15 +++++--- .../interaction/ApplicationCommandUpdate.kt | 15 +++++--- .../kotlin/dev/kord/gateway/Intent.kt | 4 +-- gateway/src/commonMain/kotlin/Event.kt | 35 ++++++++++++++----- gateway/src/commonMain/kotlin/Gateway.kt | 5 ++- gateway/src/commonMain/kotlin/Utils.kt | 5 ++- .../commonMain/kotlin/builder/LoginBuilder.kt | 5 ++- .../bitflags/ContainsPlusMinusCopy.kt | 7 +++- .../bitflags/DeprecatedNewCompanion.kt | 3 +- .../generation/bitflags/FactoryFunctions.kt | 7 +++- .../src/commonMain/kotlin/route/DiscordCdn.kt | 3 +- voice/src/main/kotlin/gateway/VoiceEvent.kt | 3 +- voice/src/main/kotlin/gateway/VoiceGateway.kt | 5 ++- 23 files changed, 113 insertions(+), 49 deletions(-) diff --git a/common/build/generated/ksp/metadata/commonMain/kotlin/dev/kord/common/entity/Permission.kt b/common/build/generated/ksp/metadata/commonMain/kotlin/dev/kord/common/entity/Permission.kt index 57ec37f77d5..6f76d846002 100644 --- a/common/build/generated/ksp/metadata/commonMain/kotlin/dev/kord/common/entity/Permission.kt +++ b/common/build/generated/ksp/metadata/commonMain/kotlin/dev/kord/common/entity/Permission.kt @@ -549,7 +549,7 @@ public class Permissions internal constructor( @Deprecated( level = DeprecationLevel.HIDDEN, - message = "Binary compatibility, keep for some releases.", + message = "Kept for binary compatibility, this declaration will be removed in 0.17.0.", ) public inline fun copy0(builder: Builder.() -> Unit): Permissions { contract { callsInPlace(builder, EXACTLY_ONCE) } @@ -620,7 +620,8 @@ public class Permissions internal constructor( @Suppress(names = arrayOf("DEPRECATION_ERROR")) @Deprecated( level = DeprecationLevel.ERROR, - message = "Renamed to 'Companion'.", + message = + "Renamed to 'Companion'. The deprecation level will be raised to HIDDEN in 0.16.0 and this declaration will be removed in 0.17.0.", replaceWith = ReplaceWith(expression = "Permissions.Companion", imports = arrayOf("dev.kord.common.entity.Permissions")), ) @@ -630,7 +631,8 @@ public class Permissions internal constructor( @Deprecated( level = DeprecationLevel.ERROR, - message = "Renamed to 'Companion'.", + message = + "Renamed to 'Companion'. The deprecation level will be raised to HIDDEN in 0.16.0 and this declaration will be removed in 0.17.0.", replaceWith = ReplaceWith(expression = "Permissions.Companion", imports = arrayOf("dev.kord.common.entity.Permissions")), ) @@ -650,7 +652,7 @@ public inline fun Permissions(builder: Permissions.Builder.() -> Unit = {}): Per @Suppress(names = arrayOf("FunctionName")) @Deprecated( level = DeprecationLevel.HIDDEN, - message = "Binary compatibility, keep for some releases.", + message = "Kept for binary compatibility, this declaration will be removed in 0.17.0.", ) public inline fun Permissions0(builder: Permissions.Builder.() -> Unit = {}): Permissions { contract { callsInPlace(builder, EXACTLY_ONCE) } diff --git a/common/build/generated/ksp/metadata/commonMain/kotlin/dev/kord/common/entity/SystemChannelFlag.kt b/common/build/generated/ksp/metadata/commonMain/kotlin/dev/kord/common/entity/SystemChannelFlag.kt index 27f60625c5a..abac9875485 100644 --- a/common/build/generated/ksp/metadata/commonMain/kotlin/dev/kord/common/entity/SystemChannelFlag.kt +++ b/common/build/generated/ksp/metadata/commonMain/kotlin/dev/kord/common/entity/SystemChannelFlag.kt @@ -330,7 +330,8 @@ public class SystemChannelFlags internal constructor( @Suppress(names = arrayOf("DEPRECATION_ERROR")) @Deprecated( level = DeprecationLevel.ERROR, - message = "Renamed to 'Companion'.", + message = + "Renamed to 'Companion'. The deprecation level will be raised to HIDDEN in 0.16.0 and this declaration will be removed in 0.17.0.", replaceWith = ReplaceWith(expression = "SystemChannelFlags.Companion", imports = arrayOf("dev.kord.common.entity.SystemChannelFlags")), ) @@ -340,7 +341,8 @@ public class SystemChannelFlags internal constructor( @Deprecated( level = DeprecationLevel.ERROR, - message = "Renamed to 'Companion'.", + message = + "Renamed to 'Companion'. The deprecation level will be raised to HIDDEN in 0.16.0 and this declaration will be removed in 0.17.0.", replaceWith = ReplaceWith(expression = "SystemChannelFlags.Companion", imports = arrayOf("dev.kord.common.entity.SystemChannelFlags")), ) diff --git a/common/build/generated/ksp/metadata/commonMain/kotlin/dev/kord/common/entity/UserFlag.kt b/common/build/generated/ksp/metadata/commonMain/kotlin/dev/kord/common/entity/UserFlag.kt index af3585bd8bc..0ce65c36e3d 100644 --- a/common/build/generated/ksp/metadata/commonMain/kotlin/dev/kord/common/entity/UserFlag.kt +++ b/common/build/generated/ksp/metadata/commonMain/kotlin/dev/kord/common/entity/UserFlag.kt @@ -315,7 +315,7 @@ public class UserFlags internal constructor( @Deprecated( level = DeprecationLevel.HIDDEN, - message = "Binary compatibility, keep for some releases.", + message = "Kept for binary compatibility, this declaration will be removed in 0.17.0.", ) public inline fun copy0(builder: Builder.() -> Unit): UserFlags { contract { callsInPlace(builder, EXACTLY_ONCE) } diff --git a/common/src/commonMain/kotlin/DiscordBitSet.kt b/common/src/commonMain/kotlin/DiscordBitSet.kt index 8b98a3b0668..45939272dc5 100644 --- a/common/src/commonMain/kotlin/DiscordBitSet.kt +++ b/common/src/commonMain/kotlin/DiscordBitSet.kt @@ -152,7 +152,7 @@ public fun DiscordBitSet(value: String): DiscordBitSet { @Deprecated( - "Replaced by 'DiscordBitSet.serializer()'.", + "Replaced by 'DiscordBitSet.serializer()'. This declaration will be removed in 0.16.0.", ReplaceWith("DiscordBitSet.serializer()", imports = ["dev.kord.common.DiscordBitSet"]), DeprecationLevel.HIDDEN, ) diff --git a/common/src/commonMain/kotlin/Locale.kt b/common/src/commonMain/kotlin/Locale.kt index 0ed29906bf0..f512ce4edb8 100644 --- a/common/src/commonMain/kotlin/Locale.kt +++ b/common/src/commonMain/kotlin/Locale.kt @@ -237,7 +237,7 @@ public data class Locale(val language: String, val country: String? = null) { } @Deprecated( - "Replaced by 'Locale.serializer()'.", + "Replaced by 'Locale.serializer()'. This declaration will be removed in 0.16.0.", ReplaceWith("Locale.serializer()", imports = ["dev.kord.common.Locale"]), DeprecationLevel.HIDDEN, ) diff --git a/common/src/commonMain/kotlin/entity/DiscordChannel.kt b/common/src/commonMain/kotlin/entity/DiscordChannel.kt index d6b247f33a8..fb6881ff398 100644 --- a/common/src/commonMain/kotlin/entity/DiscordChannel.kt +++ b/common/src/commonMain/kotlin/entity/DiscordChannel.kt @@ -233,7 +233,7 @@ public sealed class ArchiveDuration( @Suppress("UNUSED_PARAMETER") unused: Nothing?, ) : ArchiveDuration(duration) { @Deprecated( - "Replaced by 'ArchiveDuration.from()'.", + "Replaced by 'ArchiveDuration.from()'. This declaration will be removed in 0.16.0.", ReplaceWith("ArchiveDuration.from(duration)", imports = ["dev.kord.common.entity.ArchiveDuration"]), DeprecationLevel.HIDDEN, ) diff --git a/common/src/commonMain/kotlin/entity/DiscordShard.kt b/common/src/commonMain/kotlin/entity/DiscordShard.kt index b7e2b0d9d2d..8fa7bdc16c0 100644 --- a/common/src/commonMain/kotlin/entity/DiscordShard.kt +++ b/common/src/commonMain/kotlin/entity/DiscordShard.kt @@ -35,7 +35,8 @@ public data class DiscordShard(val index: Int, val count: Int) { public companion object { @Suppress("DEPRECATION_ERROR") @Deprecated( - "Renamed to 'Companion'.", + "Renamed to 'Companion'. The deprecation level will be raised to HIDDEN in 0.16.0 and this declaration " + + "will be removed in 0.17.0.", ReplaceWith("DiscordShard.Companion", imports = ["dev.kord.common.entity.DiscordShard"]), DeprecationLevel.ERROR, ) @@ -44,7 +45,8 @@ public data class DiscordShard(val index: Int, val count: Int) { } @Deprecated( - "Renamed to 'Companion'.", + "Renamed to 'Companion'. The deprecation level will be raised to HIDDEN in 0.16.0 and this declaration will " + + "be removed in 0.17.0.", ReplaceWith("DiscordShard.Companion", imports = ["dev.kord.common.entity.DiscordShard"]), DeprecationLevel.ERROR, ) diff --git a/common/src/commonMain/kotlin/entity/Permissions.kt b/common/src/commonMain/kotlin/entity/Permissions.kt index 65e7af96c9a..8a6e3cefc2f 100644 --- a/common/src/commonMain/kotlin/entity/Permissions.kt +++ b/common/src/commonMain/kotlin/entity/Permissions.kt @@ -112,7 +112,8 @@ public val Permissions.Companion.ALL: Permissions get() = ALL_PERMISSIONS @Suppress("UnusedReceiverParameter", "DEPRECATION_ERROR") @Deprecated( - "'Permissions.NewCompanion' was renamed to 'Permissions.Companion'. Use 'Permissions.Companion.ALL' instead.", + "'Permissions.NewCompanion' was renamed to 'Permissions.Companion'. Use 'Permissions.Companion.ALL' instead. The " + + "deprecation level will be raised to HIDDEN in 0.16.0 and this declaration will be removed in 0.17.0.", ReplaceWith("Permissions.ALL", imports = ["dev.kord.common.entity.Permissions", "dev.kord.common.entity.ALL"]), DeprecationLevel.ERROR, ) diff --git a/core/src/commonMain/kotlin/Kord.kt b/core/src/commonMain/kotlin/Kord.kt index f116b1b2571..0ae5ec4fae1 100644 --- a/core/src/commonMain/kotlin/Kord.kt +++ b/core/src/commonMain/kotlin/Kord.kt @@ -39,7 +39,7 @@ import kotlin.contracts.contract import kotlin.coroutines.CoroutineContext import kotlinx.coroutines.channels.Channel as CoroutineChannel -@Deprecated("Use your own logger instead, this will be removed in the future.", level = DeprecationLevel.HIDDEN) +@Deprecated("Use your own logger instead. This declaration will be removed in 0.16.0.", level = DeprecationLevel.HIDDEN) public val kordLogger: mu.KLogger = mu.KotlinLogging.logger { } private val logger = KotlinLogging.logger { } diff --git a/core/src/commonMain/kotlin/event/interaction/ApplicationCommandCreate.kt b/core/src/commonMain/kotlin/event/interaction/ApplicationCommandCreate.kt index 60c296bb035..e44f876c6be 100644 --- a/core/src/commonMain/kotlin/event/interaction/ApplicationCommandCreate.kt +++ b/core/src/commonMain/kotlin/event/interaction/ApplicationCommandCreate.kt @@ -7,7 +7,8 @@ import dev.kord.core.event.Event @Deprecated( "This event is not supposed to be sent to bots. See https://github.com/discord/discord-api-docs/issues/3690 for " + - "details.", + "details. The deprecation level will be raised to HIDDEN in 0.16.0 and this declaration will be removed in " + + "0.17.0.", level = DeprecationLevel.ERROR, ) public sealed interface ApplicationCommandCreateEvent : Event { @@ -17,7 +18,8 @@ public sealed interface ApplicationCommandCreateEvent : Event { @Suppress("DEPRECATION_ERROR") @Deprecated( "This event is not supposed to be sent to bots. See https://github.com/discord/discord-api-docs/issues/3690 for " + - "details.", + "details. The deprecation level will be raised to HIDDEN in 0.16.0 and this declaration will be removed in " + + "0.17.0.", level = DeprecationLevel.ERROR, ) public class ChatInputCommandCreateEvent( @@ -31,7 +33,8 @@ public class ChatInputCommandCreateEvent( @Suppress("DEPRECATION_ERROR") @Deprecated( "This event is not supposed to be sent to bots. See https://github.com/discord/discord-api-docs/issues/3690 for " + - "details.", + "details. The deprecation level will be raised to HIDDEN in 0.16.0 and this declaration will be removed in " + + "0.17.0.", level = DeprecationLevel.ERROR, ) public class UserCommandCreateEvent( @@ -45,7 +48,8 @@ public class UserCommandCreateEvent( @Suppress("DEPRECATION_ERROR") @Deprecated( "This event is not supposed to be sent to bots. See https://github.com/discord/discord-api-docs/issues/3690 for " + - "details.", + "details. The deprecation level will be raised to HIDDEN in 0.16.0 and this declaration will be removed in " + + "0.17.0.", level = DeprecationLevel.ERROR, ) public class MessageCommandCreateEvent( @@ -59,7 +63,8 @@ public class MessageCommandCreateEvent( @Suppress("DEPRECATION_ERROR") @Deprecated( "This event is not supposed to be sent to bots. See https://github.com/discord/discord-api-docs/issues/3690 for " + - "details.", + "details. The deprecation level will be raised to HIDDEN in 0.16.0 and this declaration will be removed in " + + "0.17.0.", level = DeprecationLevel.ERROR, ) public class UnknownApplicationCommandCreateEvent( diff --git a/core/src/commonMain/kotlin/event/interaction/ApplicationCommandDelete.kt b/core/src/commonMain/kotlin/event/interaction/ApplicationCommandDelete.kt index ba2f859353e..07da0c05680 100644 --- a/core/src/commonMain/kotlin/event/interaction/ApplicationCommandDelete.kt +++ b/core/src/commonMain/kotlin/event/interaction/ApplicationCommandDelete.kt @@ -7,7 +7,8 @@ import dev.kord.core.event.Event @Deprecated( "This event is not supposed to be sent to bots. See https://github.com/discord/discord-api-docs/issues/3690 for " + - "details.", + "details. The deprecation level will be raised to HIDDEN in 0.16.0 and this declaration will be removed in " + + "0.17.0.", level = DeprecationLevel.ERROR, ) public sealed interface ApplicationCommandDeleteEvent : Event { @@ -17,7 +18,8 @@ public sealed interface ApplicationCommandDeleteEvent : Event { @Suppress("DEPRECATION_ERROR") @Deprecated( "This event is not supposed to be sent to bots. See https://github.com/discord/discord-api-docs/issues/3690 for " + - "details.", + "details. The deprecation level will be raised to HIDDEN in 0.16.0 and this declaration will be removed in " + + "0.17.0.", level = DeprecationLevel.ERROR, ) public class ChatInputCommandDeleteEvent( @@ -31,7 +33,8 @@ public class ChatInputCommandDeleteEvent( @Suppress("DEPRECATION_ERROR") @Deprecated( "This event is not supposed to be sent to bots. See https://github.com/discord/discord-api-docs/issues/3690 for " + - "details.", + "details. The deprecation level will be raised to HIDDEN in 0.16.0 and this declaration will be removed in " + + "0.17.0.", level = DeprecationLevel.ERROR, ) public class UserCommandDeleteEvent( @@ -45,7 +48,8 @@ public class UserCommandDeleteEvent( @Suppress("DEPRECATION_ERROR") @Deprecated( "This event is not supposed to be sent to bots. See https://github.com/discord/discord-api-docs/issues/3690 for " + - "details.", + "details. The deprecation level will be raised to HIDDEN in 0.16.0 and this declaration will be removed in " + + "0.17.0.", level = DeprecationLevel.ERROR, ) public class MessageCommandDeleteEvent( @@ -59,7 +63,8 @@ public class MessageCommandDeleteEvent( @Suppress("DEPRECATION_ERROR") @Deprecated( "This event is not supposed to be sent to bots. See https://github.com/discord/discord-api-docs/issues/3690 for " + - "details.", + "details. The deprecation level will be raised to HIDDEN in 0.16.0 and this declaration will be removed in " + + "0.17.0.", level = DeprecationLevel.ERROR, ) public class UnknownApplicationCommandDeleteEvent( diff --git a/core/src/commonMain/kotlin/event/interaction/ApplicationCommandUpdate.kt b/core/src/commonMain/kotlin/event/interaction/ApplicationCommandUpdate.kt index daf181e4a5a..8bd152c4a7d 100644 --- a/core/src/commonMain/kotlin/event/interaction/ApplicationCommandUpdate.kt +++ b/core/src/commonMain/kotlin/event/interaction/ApplicationCommandUpdate.kt @@ -7,7 +7,8 @@ import dev.kord.core.event.Event @Deprecated( "This event is not supposed to be sent to bots. See https://github.com/discord/discord-api-docs/issues/3690 for " + - "details.", + "details. The deprecation level will be raised to HIDDEN in 0.16.0 and this declaration will be removed in " + + "0.17.0.", level = DeprecationLevel.ERROR, ) public sealed interface ApplicationCommandUpdateEvent : Event { @@ -17,7 +18,8 @@ public sealed interface ApplicationCommandUpdateEvent : Event { @Suppress("DEPRECATION_ERROR") @Deprecated( "This event is not supposed to be sent to bots. See https://github.com/discord/discord-api-docs/issues/3690 for " + - "details.", + "details. The deprecation level will be raised to HIDDEN in 0.16.0 and this declaration will be removed in " + + "0.17.0.", level = DeprecationLevel.ERROR, ) public class ChatInputCommandUpdateEvent( @@ -31,7 +33,8 @@ public class ChatInputCommandUpdateEvent( @Suppress("DEPRECATION_ERROR") @Deprecated( "This event is not supposed to be sent to bots. See https://github.com/discord/discord-api-docs/issues/3690 for " + - "details.", + "details. The deprecation level will be raised to HIDDEN in 0.16.0 and this declaration will be removed in " + + "0.17.0.", level = DeprecationLevel.ERROR, ) public class UserCommandUpdateEvent( @@ -45,7 +48,8 @@ public class UserCommandUpdateEvent( @Suppress("DEPRECATION_ERROR") @Deprecated( "This event is not supposed to be sent to bots. See https://github.com/discord/discord-api-docs/issues/3690 for " + - "details.", + "details. The deprecation level will be raised to HIDDEN in 0.16.0 and this declaration will be removed in " + + "0.17.0.", level = DeprecationLevel.ERROR, ) public class MessageCommandUpdateEvent( @@ -58,7 +62,8 @@ public class MessageCommandUpdateEvent( @Suppress("DEPRECATION_ERROR") @Deprecated( "This event is not supposed to be sent to bots. See https://github.com/discord/discord-api-docs/issues/3690 for " + - "details.", + "details. The deprecation level will be raised to HIDDEN in 0.16.0 and this declaration will be removed in " + + "0.17.0.", level = DeprecationLevel.ERROR, ) public class UnknownApplicationCommandUpdateEvent( diff --git a/gateway/build/generated/ksp/metadata/commonMain/kotlin/dev/kord/gateway/Intent.kt b/gateway/build/generated/ksp/metadata/commonMain/kotlin/dev/kord/gateway/Intent.kt index b5f4c49f4ca..5d189d3cd0f 100644 --- a/gateway/build/generated/ksp/metadata/commonMain/kotlin/dev/kord/gateway/Intent.kt +++ b/gateway/build/generated/ksp/metadata/commonMain/kotlin/dev/kord/gateway/Intent.kt @@ -424,7 +424,7 @@ public class Intents internal constructor( @Deprecated( level = DeprecationLevel.HIDDEN, - message = "Binary compatibility, keep for some releases.", + message = "Kept for binary compatibility, this declaration will be removed in 0.17.0.", ) public inline fun copy0(builder: Builder.() -> Unit): Intents { contract { callsInPlace(builder, EXACTLY_ONCE) } @@ -502,7 +502,7 @@ public inline fun Intents(builder: Intents.Builder.() -> Unit = {}): Intents { @Suppress(names = arrayOf("FunctionName")) @Deprecated( level = DeprecationLevel.HIDDEN, - message = "Binary compatibility, keep for some releases.", + message = "Kept for binary compatibility, this declaration will be removed in 0.17.0.", ) public inline fun Intents0(builder: Intents.Builder.() -> Unit = {}): Intents { contract { callsInPlace(builder, EXACTLY_ONCE) } diff --git a/gateway/src/commonMain/kotlin/Event.kt b/gateway/src/commonMain/kotlin/Event.kt index bf7c4e5f93e..ac19a5dd5ce 100644 --- a/gateway/src/commonMain/kotlin/Event.kt +++ b/gateway/src/commonMain/kotlin/Event.kt @@ -302,23 +302,35 @@ public data class Heartbeat(val data: Long?) : Event() { override fun deserialize(decoder: Decoder) = Heartbeat(decoder.decodeSerializableValue(delegate)) } - @Deprecated("Binary compatibility, keep for some releases.", level = DeprecationLevel.HIDDEN) + @Deprecated( + "Kept for binary compatibility, this declaration will be removed in 0.18.0.", + level = DeprecationLevel.HIDDEN, + ) public constructor(data: Long) : this(data as Long?) @Suppress("PropertyName") - @Deprecated("Binary compatibility, keep for some releases.", level = DeprecationLevel.HIDDEN) + @Deprecated( + "Kept for binary compatibility, this declaration will be removed in 0.18.0.", + level = DeprecationLevel.HIDDEN, + ) @get:JvmName("getData") public val data_: Long get() = data ?: throw NullPointerException("This heartbeat request contains a null sequence number") @Suppress("FunctionName") - @Deprecated("Binary compatibility, keep for some releases.", level = DeprecationLevel.HIDDEN) + @Deprecated( + "Kept for binary compatibility, this declaration will be removed in 0.18.0.", + level = DeprecationLevel.HIDDEN, + ) @JvmName("component1") public fun component1_(): Long = component1() ?: throw NullPointerException("This heartbeat request contains a null sequence number") @Suppress("FunctionName") - @Deprecated("Binary compatibility, keep for some releases.", level = DeprecationLevel.HIDDEN) + @Deprecated( + "Kept for binary compatibility, this declaration will be removed in 0.18.0.", + level = DeprecationLevel.HIDDEN, + ) @JvmName("copy") public fun copy_( data: Long = this.data ?: throw NullPointerException("This heartbeat request contains a null sequence number"), @@ -327,7 +339,8 @@ public data class Heartbeat(val data: Long?) : Event() { public companion object { @Suppress("DEPRECATION_ERROR") @Deprecated( - "Renamed to 'Companion'.", + "Renamed to 'Companion'. The deprecation level will be raised to HIDDEN in 0.16.0 and this declaration " + + "will be removed in 0.17.0.", ReplaceWith("Heartbeat.Companion", imports = ["dev.kord.gateway.Heartbeat"]), DeprecationLevel.ERROR, ) @@ -336,7 +349,8 @@ public data class Heartbeat(val data: Long?) : Event() { } @Deprecated( - "Renamed to 'Companion'.", + "Renamed to 'Companion'. The deprecation level will be raised to HIDDEN in 0.16.0 and this declaration will " + + "be removed in 0.17.0.", ReplaceWith("Heartbeat.Companion", imports = ["dev.kord.gateway.Heartbeat"]), DeprecationLevel.ERROR, ) @@ -535,7 +549,8 @@ public data class InteractionCreate(val interaction: DiscordInteraction, overrid @Deprecated( "This event is not supposed to be sent to bots. See https://github.com/discord/discord-api-docs/issues/3690 for " + - "details.", + "details. The deprecation level will be raised to HIDDEN in 0.16.0 and this declaration will be removed in " + + "0.17.0.", level = DeprecationLevel.ERROR, ) public data class ApplicationCommandCreate(val application: DiscordApplicationCommand, override val sequence: Int?) : @@ -544,7 +559,8 @@ public data class ApplicationCommandCreate(val application: DiscordApplicationCo @Deprecated( "This event is not supposed to be sent to bots. See https://github.com/discord/discord-api-docs/issues/3690 for " + - "details.", + "details. The deprecation level will be raised to HIDDEN in 0.16.0 and this declaration will be removed in " + + "0.17.0.", level = DeprecationLevel.ERROR, ) public data class ApplicationCommandUpdate(val application: DiscordApplicationCommand, override val sequence: Int?) : @@ -553,7 +569,8 @@ public data class ApplicationCommandUpdate(val application: DiscordApplicationCo @Deprecated( "This event is not supposed to be sent to bots. See https://github.com/discord/discord-api-docs/issues/3690 for " + - "details.", + "details. The deprecation level will be raised to HIDDEN in 0.16.0 and this declaration will be removed in " + + "0.17.0.", level = DeprecationLevel.ERROR, ) public data class ApplicationCommandDelete(val application: DiscordApplicationCommand, override val sequence: Int?) : diff --git a/gateway/src/commonMain/kotlin/Gateway.kt b/gateway/src/commonMain/kotlin/Gateway.kt index 103a9ed59be..093791d17e6 100644 --- a/gateway/src/commonMain/kotlin/Gateway.kt +++ b/gateway/src/commonMain/kotlin/Gateway.kt @@ -140,7 +140,10 @@ public suspend inline fun Gateway.start(token: String, config: GatewayConfigurat } @Suppress("unused") -@Deprecated("Binary compatibility, remove after deprecation cycle.", level = DeprecationLevel.HIDDEN) +@Deprecated( + "Kept for binary compatibility, this declaration will be removed in 0.16.0.", + level = DeprecationLevel.HIDDEN, +) @PublishedApi internal val gatewayOnLogger: mu.KLogger = mu.KotlinLogging.logger("Gateway.on") diff --git a/gateway/src/commonMain/kotlin/Utils.kt b/gateway/src/commonMain/kotlin/Utils.kt index 4de4345af29..31ef79fd596 100644 --- a/gateway/src/commonMain/kotlin/Utils.kt +++ b/gateway/src/commonMain/kotlin/Utils.kt @@ -2,6 +2,9 @@ package dev.kord.gateway import mu.KLogger -@Deprecated("Binary compatibility, remove after deprecation cycle.", level = DeprecationLevel.HIDDEN) +@Deprecated( + "Kept for binary compatibility, this declaration will be removed in 0.16.0.", + level = DeprecationLevel.HIDDEN, +) @PublishedApi internal fun KLogger.error(throwable: Throwable): Unit = error(throwable) { "" } diff --git a/gateway/src/commonMain/kotlin/builder/LoginBuilder.kt b/gateway/src/commonMain/kotlin/builder/LoginBuilder.kt index d52f91c4a98..58681977b3f 100644 --- a/gateway/src/commonMain/kotlin/builder/LoginBuilder.kt +++ b/gateway/src/commonMain/kotlin/builder/LoginBuilder.kt @@ -26,7 +26,10 @@ public class LoginBuilder { this.intents = Intents(builder) } - @Deprecated("Binary compatibility, keep for some releases.", level = DeprecationLevel.HIDDEN) + @Deprecated( + "Kept for binary compatibility, this declaration will be removed in 0.17.0.", + level = DeprecationLevel.HIDDEN, + ) public inline fun intents0(builder: Intents.Builder.() -> Unit) { contract { callsInPlace(builder, InvocationKind.EXACTLY_ONCE) } intents(builder) diff --git a/ksp-processors/src/main/kotlin/generation/bitflags/ContainsPlusMinusCopy.kt b/ksp-processors/src/main/kotlin/generation/bitflags/ContainsPlusMinusCopy.kt index 2ab53bcd710..629fc6ae5db 100644 --- a/ksp-processors/src/main/kotlin/generation/bitflags/ContainsPlusMinusCopy.kt +++ b/ksp-processors/src/main/kotlin/generation/bitflags/ContainsPlusMinusCopy.kt @@ -81,7 +81,12 @@ internal fun TypeSpec.Builder.addCopy() = addFunction("copy") { context(BitFlags, GenerationContext) internal fun TypeSpec.Builder.addCopy0() = addFunction("copy0") { @OptIn(DelicateKotlinPoetApi::class) - addAnnotation(Deprecated("Binary compatibility, keep for some releases.", level = DeprecationLevel.HIDDEN)) + addAnnotation( + Deprecated( + "Kept for binary compatibility, this declaration will be removed in 0.17.0.", + level = DeprecationLevel.HIDDEN, + ) + ) addModifiers(PUBLIC, INLINE) addParameter("builder", type = LambdaTypeName.get(receiver = builderCN, returnType = UNIT)) returns(collectionCN) diff --git a/ksp-processors/src/main/kotlin/generation/bitflags/DeprecatedNewCompanion.kt b/ksp-processors/src/main/kotlin/generation/bitflags/DeprecatedNewCompanion.kt index d3e4c0608d5..9751b2e0187 100644 --- a/ksp-processors/src/main/kotlin/generation/bitflags/DeprecatedNewCompanion.kt +++ b/ksp-processors/src/main/kotlin/generation/bitflags/DeprecatedNewCompanion.kt @@ -18,7 +18,8 @@ context(BitFlags, GenerationContext) internal fun TypeSpec.Builder.addDeprecatedNewCompanion() { val newCompanion = collectionCN.nestedClass("NewCompanion") val deprecated = Deprecated( - "Renamed to 'Companion'.", + "Renamed to 'Companion'. The deprecation level will be raised to HIDDEN in 0.16.0 and this declaration will " + + "be removed in 0.17.0.", ReplaceWith("${collectionCN.simpleName}.Companion", imports = arrayOf(collectionCN.canonicalName)), LEVEL, ) diff --git a/ksp-processors/src/main/kotlin/generation/bitflags/FactoryFunctions.kt b/ksp-processors/src/main/kotlin/generation/bitflags/FactoryFunctions.kt index 796e02c2750..8d62c4af4e1 100644 --- a/ksp-processors/src/main/kotlin/generation/bitflags/FactoryFunctions.kt +++ b/ksp-processors/src/main/kotlin/generation/bitflags/FactoryFunctions.kt @@ -34,7 +34,12 @@ internal fun FileSpec.Builder.addFactoryFunctions() { @OptIn(DelicateKotlinPoetApi::class) addFunction(factoryFunctionName + '0') { addAnnotation(Suppress("FunctionName")) - addAnnotation(Deprecated("Binary compatibility, keep for some releases.", level = DeprecationLevel.HIDDEN)) + addAnnotation( + Deprecated( + "Kept for binary compatibility, this declaration will be removed in 0.17.0.", + level = DeprecationLevel.HIDDEN, + ) + ) addModifiers(PUBLIC, INLINE) addParameter("builder", type = LambdaTypeName.get(receiver = builderCN, returnType = UNIT)) { defaultValue("{}") diff --git a/rest/src/commonMain/kotlin/route/DiscordCdn.kt b/rest/src/commonMain/kotlin/route/DiscordCdn.kt index 0ea69a8aade..994578eaad7 100644 --- a/rest/src/commonMain/kotlin/route/DiscordCdn.kt +++ b/rest/src/commonMain/kotlin/route/DiscordCdn.kt @@ -21,7 +21,8 @@ public object DiscordCdn { public fun userBanner(userId: Snowflake, hash: String): CdnUrl = CdnUrl("$BASE_URL/banners/$userId/$hash") @Deprecated( - "Renamed to 'defaultUserAvatar' to align name with documentation and overload taking Snowflake.", + "Renamed to 'defaultUserAvatar' to align name with documentation and overload taking Snowflake. This " + + "declaration will be removed in 0.16.0.", ReplaceWith("DiscordCdn.defaultUserAvatar(discriminator)", imports = ["dev.kord.rest.route.DiscordCdn"]), DeprecationLevel.HIDDEN, ) diff --git a/voice/src/main/kotlin/gateway/VoiceEvent.kt b/voice/src/main/kotlin/gateway/VoiceEvent.kt index 711f216c223..edce66dbd63 100644 --- a/voice/src/main/kotlin/gateway/VoiceEvent.kt +++ b/voice/src/main/kotlin/gateway/VoiceEvent.kt @@ -109,7 +109,8 @@ public data class Speaking( public object Resumed : VoiceEvent() { @Deprecated( "'Resumed' is no longer serializable, deserialize it with 'VoiceEvent.DeserializationStrategy' instead. " + - "Deprecated without a replacement.", + "Deprecated without a replacement. The deprecation level will be raised to HIDDEN in 0.16.0 and this " + + "declaration will be removed in 0.17.0.", level = DeprecationLevel.ERROR, ) public fun serializer(): KSerializer = Serializer diff --git a/voice/src/main/kotlin/gateway/VoiceGateway.kt b/voice/src/main/kotlin/gateway/VoiceGateway.kt index 8d331d3ae18..9e738a4e1eb 100644 --- a/voice/src/main/kotlin/gateway/VoiceGateway.kt +++ b/voice/src/main/kotlin/gateway/VoiceGateway.kt @@ -87,7 +87,10 @@ public interface VoiceGateway { @Suppress("unused") -@Deprecated("Binary compatibility, remove after deprecation cycle.", level = DeprecationLevel.HIDDEN) +@Deprecated( + "Kept for binary compatibility, this declaration will be removed in 0.16.0.", + level = DeprecationLevel.HIDDEN, +) @PublishedApi internal val voiceGatewayOnLogger: mu.KLogger = mu.KotlinLogging.logger("Gateway.on") From 4ecbb47bd767700b60e765a29406e6e62b2e0a6e Mon Sep 17 00:00:00 2001 From: Michael Rittmeister Date: Tue, 27 Aug 2024 18:33:31 +0200 Subject: [PATCH 3/4] Add support for enforceNonce (#971) * Add support for enforceNonce * Fix typo * Fix typo again --- rest/api/rest.api | 12 ++++++++---- rest/api/rest.klib.api | 10 ++++++++-- .../message/create/UserMessageCreateBuilder.kt | 12 +++++++++++- .../kotlin/json/request/MessageRequests.kt | 4 +++- 4 files changed, 30 insertions(+), 8 deletions(-) diff --git a/rest/api/rest.api b/rest/api/rest.api index 91bf1d6b21b..1b0fc4f685c 100644 --- a/rest/api/rest.api +++ b/rest/api/rest.api @@ -2229,10 +2229,12 @@ public final class dev/kord/rest/builder/message/create/UpdateMessageInteraction public final class dev/kord/rest/builder/message/create/UserMessageCreateBuilder : dev/kord/rest/builder/message/create/AbstractMessageCreateBuilder, dev/kord/rest/builder/RequestBuilder { public fun ()V + public final fun getEnforceNonce ()Ljava/lang/Boolean; public final fun getFailIfNotExists ()Ljava/lang/Boolean; public final fun getMessageReference ()Ldev/kord/common/entity/Snowflake; public final fun getNonce ()Ljava/lang/String; public final fun getStickerIds ()Ljava/util/List; + public final fun setEnforceNonce (Ljava/lang/Boolean;)V public final fun setFailIfNotExists (Ljava/lang/Boolean;)V public final fun setMessageReference (Ldev/kord/common/entity/Snowflake;)V public final fun setNonce (Ljava/lang/String;)V @@ -4773,10 +4775,11 @@ public final class dev/kord/rest/json/request/ListThreadsByTimestampRequest { public final class dev/kord/rest/json/request/MessageCreateRequest { public static final field Companion Ldev/kord/rest/json/request/MessageCreateRequest$Companion; public fun ()V - public fun (Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;)V - public synthetic fun (Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;)V + public synthetic fun (Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()Ldev/kord/common/entity/optional/Optional; public final fun component10 ()Ldev/kord/common/entity/optional/Optional; + public final fun component11 ()Ldev/kord/common/entity/optional/OptionalBoolean; public final fun component2 ()Ldev/kord/common/entity/optional/Optional; public final fun component3 ()Ldev/kord/common/entity/optional/OptionalBoolean; public final fun component4 ()Ldev/kord/common/entity/optional/Optional; @@ -4785,14 +4788,15 @@ public final class dev/kord/rest/json/request/MessageCreateRequest { public final fun component7 ()Ldev/kord/common/entity/optional/Optional; public final fun component8 ()Ldev/kord/common/entity/optional/Optional; public final fun component9 ()Ldev/kord/common/entity/optional/Optional; - public final fun copy (Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;)Ldev/kord/rest/json/request/MessageCreateRequest; - public static synthetic fun copy$default (Ldev/kord/rest/json/request/MessageCreateRequest;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;ILjava/lang/Object;)Ldev/kord/rest/json/request/MessageCreateRequest; + public final fun copy (Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;)Ldev/kord/rest/json/request/MessageCreateRequest; + public static synthetic fun copy$default (Ldev/kord/rest/json/request/MessageCreateRequest;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;ILjava/lang/Object;)Ldev/kord/rest/json/request/MessageCreateRequest; public fun equals (Ljava/lang/Object;)Z public final fun getAllowedMentions ()Ldev/kord/common/entity/optional/Optional; public final fun getAttachments ()Ldev/kord/common/entity/optional/Optional; public final fun getComponents ()Ldev/kord/common/entity/optional/Optional; public final fun getContent ()Ldev/kord/common/entity/optional/Optional; public final fun getEmbeds ()Ldev/kord/common/entity/optional/Optional; + public final fun getEnforceNonce ()Ldev/kord/common/entity/optional/OptionalBoolean; public final fun getFlags ()Ldev/kord/common/entity/optional/Optional; public final fun getMessageReference ()Ldev/kord/common/entity/optional/Optional; public final fun getNonce ()Ldev/kord/common/entity/optional/Optional; diff --git a/rest/api/rest.klib.api b/rest/api/rest.klib.api index 569a77c7fb9..5a0bc4b8049 100644 --- a/rest/api/rest.klib.api +++ b/rest/api/rest.klib.api @@ -2479,6 +2479,9 @@ final class dev.kord.rest.builder.message.create/UpdateMessageInteractionRespons final class dev.kord.rest.builder.message.create/UserMessageCreateBuilder : dev.kord.rest.builder.message.create/AbstractMessageCreateBuilder, dev.kord.rest.builder/RequestBuilder { // dev.kord.rest.builder.message.create/UserMessageCreateBuilder|null[0] constructor () // dev.kord.rest.builder.message.create/UserMessageCreateBuilder.|(){}[0] + final var enforceNonce // dev.kord.rest.builder.message.create/UserMessageCreateBuilder.enforceNonce|{}enforceNonce[0] + final fun (): kotlin/Boolean? // dev.kord.rest.builder.message.create/UserMessageCreateBuilder.enforceNonce.|(){}[0] + final fun (kotlin/Boolean?) // dev.kord.rest.builder.message.create/UserMessageCreateBuilder.enforceNonce.|(kotlin.Boolean?){}[0] final var failIfNotExists // dev.kord.rest.builder.message.create/UserMessageCreateBuilder.failIfNotExists|{}failIfNotExists[0] final fun (): kotlin/Boolean? // dev.kord.rest.builder.message.create/UserMessageCreateBuilder.failIfNotExists.|(){}[0] final fun (kotlin/Boolean?) // dev.kord.rest.builder.message.create/UserMessageCreateBuilder.failIfNotExists.|(kotlin.Boolean?){}[0] @@ -5197,7 +5200,7 @@ final class dev.kord.rest.json.request/ListThreadsByTimestampRequest { // dev.ko } final class dev.kord.rest.json.request/MessageCreateRequest { // dev.kord.rest.json.request/MessageCreateRequest|null[0] - constructor (dev.kord.common.entity.optional/Optional = ..., dev.kord.common.entity.optional/Optional = ..., dev.kord.common.entity.optional/OptionalBoolean = ..., dev.kord.common.entity.optional/Optional> = ..., dev.kord.common.entity.optional/Optional = ..., dev.kord.common.entity.optional/Optional = ..., dev.kord.common.entity.optional/Optional> = ..., dev.kord.common.entity.optional/Optional> = ..., dev.kord.common.entity.optional/Optional> = ..., dev.kord.common.entity.optional/Optional = ...) // dev.kord.rest.json.request/MessageCreateRequest.|(dev.kord.common.entity.optional.Optional;dev.kord.common.entity.optional.Optional;dev.kord.common.entity.optional.OptionalBoolean;dev.kord.common.entity.optional.Optional>;dev.kord.common.entity.optional.Optional;dev.kord.common.entity.optional.Optional;dev.kord.common.entity.optional.Optional>;dev.kord.common.entity.optional.Optional>;dev.kord.common.entity.optional.Optional>;dev.kord.common.entity.optional.Optional){}[0] + constructor (dev.kord.common.entity.optional/Optional = ..., dev.kord.common.entity.optional/Optional = ..., dev.kord.common.entity.optional/OptionalBoolean = ..., dev.kord.common.entity.optional/Optional> = ..., dev.kord.common.entity.optional/Optional = ..., dev.kord.common.entity.optional/Optional = ..., dev.kord.common.entity.optional/Optional> = ..., dev.kord.common.entity.optional/Optional> = ..., dev.kord.common.entity.optional/Optional> = ..., dev.kord.common.entity.optional/Optional = ..., dev.kord.common.entity.optional/OptionalBoolean = ...) // dev.kord.rest.json.request/MessageCreateRequest.|(dev.kord.common.entity.optional.Optional;dev.kord.common.entity.optional.Optional;dev.kord.common.entity.optional.OptionalBoolean;dev.kord.common.entity.optional.Optional>;dev.kord.common.entity.optional.Optional;dev.kord.common.entity.optional.Optional;dev.kord.common.entity.optional.Optional>;dev.kord.common.entity.optional.Optional>;dev.kord.common.entity.optional.Optional>;dev.kord.common.entity.optional.Optional;dev.kord.common.entity.optional.OptionalBoolean){}[0] final val allowedMentions // dev.kord.rest.json.request/MessageCreateRequest.allowedMentions|{}allowedMentions[0] final fun (): dev.kord.common.entity.optional/Optional // dev.kord.rest.json.request/MessageCreateRequest.allowedMentions.|(){}[0] @@ -5209,6 +5212,8 @@ final class dev.kord.rest.json.request/MessageCreateRequest { // dev.kord.rest.j final fun (): dev.kord.common.entity.optional/Optional // dev.kord.rest.json.request/MessageCreateRequest.content.|(){}[0] final val embeds // dev.kord.rest.json.request/MessageCreateRequest.embeds|{}embeds[0] final fun (): dev.kord.common.entity.optional/Optional> // dev.kord.rest.json.request/MessageCreateRequest.embeds.|(){}[0] + final val enforceNonce // dev.kord.rest.json.request/MessageCreateRequest.enforceNonce|{}enforceNonce[0] + final fun (): dev.kord.common.entity.optional/OptionalBoolean // dev.kord.rest.json.request/MessageCreateRequest.enforceNonce.|(){}[0] final val flags // dev.kord.rest.json.request/MessageCreateRequest.flags|{}flags[0] final fun (): dev.kord.common.entity.optional/Optional // dev.kord.rest.json.request/MessageCreateRequest.flags.|(){}[0] final val messageReference // dev.kord.rest.json.request/MessageCreateRequest.messageReference|{}messageReference[0] @@ -5222,6 +5227,7 @@ final class dev.kord.rest.json.request/MessageCreateRequest { // dev.kord.rest.j final fun component1(): dev.kord.common.entity.optional/Optional // dev.kord.rest.json.request/MessageCreateRequest.component1|component1(){}[0] final fun component10(): dev.kord.common.entity.optional/Optional // dev.kord.rest.json.request/MessageCreateRequest.component10|component10(){}[0] + final fun component11(): dev.kord.common.entity.optional/OptionalBoolean // dev.kord.rest.json.request/MessageCreateRequest.component11|component11(){}[0] final fun component2(): dev.kord.common.entity.optional/Optional // dev.kord.rest.json.request/MessageCreateRequest.component2|component2(){}[0] final fun component3(): dev.kord.common.entity.optional/OptionalBoolean // dev.kord.rest.json.request/MessageCreateRequest.component3|component3(){}[0] final fun component4(): dev.kord.common.entity.optional/Optional> // dev.kord.rest.json.request/MessageCreateRequest.component4|component4(){}[0] @@ -5230,7 +5236,7 @@ final class dev.kord.rest.json.request/MessageCreateRequest { // dev.kord.rest.j final fun component7(): dev.kord.common.entity.optional/Optional> // dev.kord.rest.json.request/MessageCreateRequest.component7|component7(){}[0] final fun component8(): dev.kord.common.entity.optional/Optional> // dev.kord.rest.json.request/MessageCreateRequest.component8|component8(){}[0] final fun component9(): dev.kord.common.entity.optional/Optional> // dev.kord.rest.json.request/MessageCreateRequest.component9|component9(){}[0] - final fun copy(dev.kord.common.entity.optional/Optional = ..., dev.kord.common.entity.optional/Optional = ..., dev.kord.common.entity.optional/OptionalBoolean = ..., dev.kord.common.entity.optional/Optional> = ..., dev.kord.common.entity.optional/Optional = ..., dev.kord.common.entity.optional/Optional = ..., dev.kord.common.entity.optional/Optional> = ..., dev.kord.common.entity.optional/Optional> = ..., dev.kord.common.entity.optional/Optional> = ..., dev.kord.common.entity.optional/Optional = ...): dev.kord.rest.json.request/MessageCreateRequest // dev.kord.rest.json.request/MessageCreateRequest.copy|copy(dev.kord.common.entity.optional.Optional;dev.kord.common.entity.optional.Optional;dev.kord.common.entity.optional.OptionalBoolean;dev.kord.common.entity.optional.Optional>;dev.kord.common.entity.optional.Optional;dev.kord.common.entity.optional.Optional;dev.kord.common.entity.optional.Optional>;dev.kord.common.entity.optional.Optional>;dev.kord.common.entity.optional.Optional>;dev.kord.common.entity.optional.Optional){}[0] + final fun copy(dev.kord.common.entity.optional/Optional = ..., dev.kord.common.entity.optional/Optional = ..., dev.kord.common.entity.optional/OptionalBoolean = ..., dev.kord.common.entity.optional/Optional> = ..., dev.kord.common.entity.optional/Optional = ..., dev.kord.common.entity.optional/Optional = ..., dev.kord.common.entity.optional/Optional> = ..., dev.kord.common.entity.optional/Optional> = ..., dev.kord.common.entity.optional/Optional> = ..., dev.kord.common.entity.optional/Optional = ..., dev.kord.common.entity.optional/OptionalBoolean = ...): dev.kord.rest.json.request/MessageCreateRequest // dev.kord.rest.json.request/MessageCreateRequest.copy|copy(dev.kord.common.entity.optional.Optional;dev.kord.common.entity.optional.Optional;dev.kord.common.entity.optional.OptionalBoolean;dev.kord.common.entity.optional.Optional>;dev.kord.common.entity.optional.Optional;dev.kord.common.entity.optional.Optional;dev.kord.common.entity.optional.Optional>;dev.kord.common.entity.optional.Optional>;dev.kord.common.entity.optional.Optional>;dev.kord.common.entity.optional.Optional;dev.kord.common.entity.optional.OptionalBoolean){}[0] final fun equals(kotlin/Any?): kotlin/Boolean // dev.kord.rest.json.request/MessageCreateRequest.equals|equals(kotlin.Any?){}[0] final fun hashCode(): kotlin/Int // dev.kord.rest.json.request/MessageCreateRequest.hashCode|hashCode(){}[0] final fun toString(): kotlin/String // dev.kord.rest.json.request/MessageCreateRequest.toString|toString(){}[0] diff --git a/rest/src/commonMain/kotlin/builder/message/create/UserMessageCreateBuilder.kt b/rest/src/commonMain/kotlin/builder/message/create/UserMessageCreateBuilder.kt index bd13c9ebf97..99a56168e0b 100644 --- a/rest/src/commonMain/kotlin/builder/message/create/UserMessageCreateBuilder.kt +++ b/rest/src/commonMain/kotlin/builder/message/create/UserMessageCreateBuilder.kt @@ -8,7 +8,6 @@ import dev.kord.common.entity.optional.* import dev.kord.common.entity.optional.delegate.delegate import dev.kord.rest.builder.RequestBuilder import dev.kord.rest.builder.message.AllowedMentionsBuilder -import dev.kord.rest.builder.message.allowedMentions import dev.kord.rest.builder.message.buildMessageFlags import dev.kord.rest.json.request.MessageCreateRequest import dev.kord.rest.json.request.MultipartMessageCreateRequest @@ -25,6 +24,15 @@ public class UserMessageCreateBuilder : AbstractMessageCreateBuilder(), RequestB /** A value that can be used to verify a message was sent (up to 25 characters). */ public var nonce: String? by ::_nonce.delegate() + private var _enforceNonce: OptionalBoolean = OptionalBoolean.Missing + + /** + * If `true` and [nonce] is present, it will be checked for uniqueness in the past few minutes. + * If another message was created by the same author with the same nonce, + * that message will be returned and no new message will be created. + */ + public var enforceNonce: Boolean? by ::_enforceNonce.delegate() + private var _messageReference: OptionalSnowflake = OptionalSnowflake.Missing /** @@ -62,12 +70,14 @@ public class UserMessageCreateBuilder : AbstractMessageCreateBuilder(), RequestB messageReference = when (val id = _messageReference) { is OptionalSnowflake.Value -> Optional.Value(DiscordMessageReference(id = id, failIfNotExists = _failIfNotExists)) + is OptionalSnowflake.Missing -> Optional.Missing() }, components = _components.mapList { it.build() }, stickerIds = _stickerIds.mapCopy(), attachments = _attachments.mapList { it.toRequest() }, flags = buildMessageFlags(flags, suppressEmbeds, suppressNotifications), + enforceNonce = _enforceNonce, ), files = files.toList(), ) diff --git a/rest/src/commonMain/kotlin/json/request/MessageRequests.kt b/rest/src/commonMain/kotlin/json/request/MessageRequests.kt index f451d6da3b3..9444374bcc0 100644 --- a/rest/src/commonMain/kotlin/json/request/MessageRequests.kt +++ b/rest/src/commonMain/kotlin/json/request/MessageRequests.kt @@ -23,7 +23,9 @@ public data class MessageCreateRequest( @SerialName("sticker_ids") val stickerIds: Optional> = Optional.Missing(), val attachments: Optional> = Optional.Missing(), - val flags: Optional = Optional.Missing() + val flags: Optional = Optional.Missing(), + @SerialName("enforce_nonce") + val enforceNonce: OptionalBoolean = OptionalBoolean.Missing, ) public data class MultipartMessageCreateRequest( From 43c5bd8a74a67613a276f73757c1abf805092490 Mon Sep 17 00:00:00 2001 From: Luca Kellermann Date: Thu, 29 Aug 2024 09:56:12 +0200 Subject: [PATCH 4/4] Update Kotlin to 2.0.20 --- gradle/libs.versions.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 64ab8d78871..3d4637bd0a9 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,7 +1,7 @@ [versions] # api dependencies -kotlin = "2.0.20-RC2" # https://github.com/JetBrains/kotlin +kotlin = "2.0.20" # https://github.com/JetBrains/kotlin ktor = "2.3.12" # https://github.com/ktorio/ktor kotlinx-coroutines = "1.8.1" # https://github.com/Kotlin/kotlinx.coroutines kotlinx-serialization = "1.7.1" # https://github.com/Kotlin/kotlinx.serialization @@ -18,7 +18,7 @@ stately = "2.0.7" # https://github.com/touchlab/Stately fastZlib = "2.0.1" # https://github.com/timotejroiko/fast-zlib # code generation -ksp = "2.0.20-RC2-1.0.24" # https://github.com/google/ksp +ksp = "2.0.20-1.0.24" # https://github.com/google/ksp kotlinpoet = "1.18.1" # https://github.com/square/kotlinpoet # tests