From e99c5c583229d20e69632aae39cee47da637abef Mon Sep 17 00:00:00 2001 From: Luca Kellermann Date: Mon, 21 Oct 2024 21:54:10 +0200 Subject: [PATCH 1/2] Bump DeprecationLevels after 0.15.0 (#987) WARNING -> ERROR ERROR -> HIDDEN HIDDEN -> remove --- common/api/common.api | 21 +--------------- common/api/common.klib.api | 20 +-------------- .../dev/kord/common/entity/Permission.kt | 10 +++----- .../kord/common/entity/SystemChannelFlag.kt | 10 +++----- common/src/commonMain/kotlin/DiscordBitSet.kt | 8 ------ common/src/commonMain/kotlin/Locale.kt | 12 ++------- .../kotlin/entity/DiscordChannel.kt | 14 ++--------- .../commonMain/kotlin/entity/DiscordShard.kt | 10 +++----- .../commonMain/kotlin/entity/Permissions.kt | 6 ++--- core/api/core.api | 1 - core/api/core.klib.api | 2 -- core/build.gradle.kts | 3 --- core/src/commonMain/kotlin/Kord.kt | 3 --- .../interaction/ApplicationCommandCreate.kt | 25 ++++++++----------- .../interaction/ApplicationCommandDelete.kt | 25 ++++++++----------- .../interaction/ApplicationCommandUpdate.kt | 25 ++++++++----------- gateway/api/gateway.api | 5 ---- gateway/api/gateway.klib.api | 3 --- gateway/build.gradle.kts | 3 --- gateway/src/commonMain/kotlin/Event.kt | 25 ++++++++----------- gateway/src/commonMain/kotlin/Gateway.kt | 8 ------ gateway/src/commonMain/kotlin/Utils.kt | 10 -------- gradle/libs.versions.toml | 2 -- .../bitflags/DeprecatedNewCompanion.kt | 5 ++-- rest/api/rest.api | 1 - rest/api/rest.klib.api | 1 - .../AutoModerationRuleBuilder.kt | 12 ++++----- .../AutoModerationRuleCreateBuilder.kt | 6 ++--- .../AutoModerationRuleModifyBuilder.kt | 6 ++--- .../src/commonMain/kotlin/route/DiscordCdn.kt | 8 ------ voice/api/voice.api | 3 +-- voice/build.gradle.kts | 3 --- voice/src/main/kotlin/gateway/VoiceEvent.kt | 5 ++-- voice/src/main/kotlin/gateway/VoiceGateway.kt | 8 ------ 34 files changed, 78 insertions(+), 231 deletions(-) delete mode 100644 gateway/src/commonMain/kotlin/Utils.kt diff --git a/common/api/common.api b/common/api/common.api index 8bbb86ea4a8..fb87a200c9d 100644 --- a/common/api/common.api +++ b/common/api/common.api @@ -49,15 +49,6 @@ public final class dev/kord/common/DiscordBitSetKt { public static final fun EmptyBitSet ()Ldev/kord/common/DiscordBitSet; } -public final class dev/kord/common/DiscordBitSetSerializer : kotlinx/serialization/KSerializer { - public static final field INSTANCE Ldev/kord/common/DiscordBitSetSerializer; - public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ldev/kord/common/DiscordBitSet; - public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object; - public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor; - public fun serialize (Lkotlinx/serialization/encoding/Encoder;Ldev/kord/common/DiscordBitSet;)V - public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V -} - public final class dev/kord/common/DiscordTimestampKt { public static final fun toMessageFormat (Lkotlinx/datetime/Instant;Ldev/kord/common/DiscordTimestampStyle;)Ljava/lang/String; public static synthetic fun toMessageFormat$default (Lkotlinx/datetime/Instant;Ldev/kord/common/DiscordTimestampStyle;ILjava/lang/Object;)Ljava/lang/String; @@ -149,15 +140,6 @@ public final class dev/kord/common/Locale$Companion { public final fun serializer ()Lkotlinx/serialization/KSerializer; } -public final class dev/kord/common/Locale$Serializer : kotlinx/serialization/KSerializer { - public static final field INSTANCE Ldev/kord/common/Locale$Serializer; - public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ldev/kord/common/Locale; - public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object; - public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor; - public fun serialize (Lkotlinx/serialization/encoding/Encoder;Ldev/kord/common/Locale;)V - public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V -} - public final class dev/kord/common/LocaleKt { public static final fun asJavaLocale (Ldev/kord/common/Locale;)Ljava/util/Locale; public static final fun getKLocale (Ljava/util/Locale;)Ldev/kord/common/Locale; @@ -775,7 +757,6 @@ public final class dev/kord/common/entity/ArchiveDuration$ThreeDays : dev/kord/c } public final class dev/kord/common/entity/ArchiveDuration$Unknown : dev/kord/common/entity/ArchiveDuration { - public synthetic fun (JLkotlin/jvm/internal/DefaultConstructorMarker;)V } public final class dev/kord/common/entity/ArchiveDuration$Week : dev/kord/common/entity/ArchiveDuration { @@ -8158,7 +8139,7 @@ public final class dev/kord/common/entity/Permissions$NewCompanion { public final class dev/kord/common/entity/PermissionsKt { public static final fun getALL (Ldev/kord/common/entity/Permissions$Companion;)Ldev/kord/common/entity/Permissions; - public static final fun getALL (Ldev/kord/common/entity/Permissions$NewCompanion;)Ldev/kord/common/entity/Permissions; + public static final synthetic fun getALL (Ldev/kord/common/entity/Permissions$NewCompanion;)Ldev/kord/common/entity/Permissions; } public abstract class dev/kord/common/entity/PremiumTier { diff --git a/common/api/common.klib.api b/common/api/common.klib.api index add796aee52..309c5b6cec0 100644 --- a/common/api/common.klib.api +++ b/common/api/common.klib.api @@ -6516,14 +6516,6 @@ final class dev.kord.common/Locale { // dev.kord.common/Locale|null[0] final fun fromString(kotlin/String): dev.kord.common/Locale // dev.kord.common/Locale.Companion.fromString|fromString(kotlin.String){}[0] final fun serializer(): kotlinx.serialization/KSerializer // dev.kord.common/Locale.Companion.serializer|serializer(){}[0] } - - final object Serializer : kotlinx.serialization/KSerializer { // dev.kord.common/Locale.Serializer|null[0] - final val descriptor // dev.kord.common/Locale.Serializer.descriptor|{}descriptor[0] - final fun (): kotlinx.serialization.descriptors/SerialDescriptor // dev.kord.common/Locale.Serializer.descriptor.|(){}[0] - - final fun deserialize(kotlinx.serialization.encoding/Decoder): dev.kord.common/Locale // dev.kord.common/Locale.Serializer.deserialize|deserialize(kotlinx.serialization.encoding.Decoder){}[0] - final fun serialize(kotlinx.serialization.encoding/Encoder, dev.kord.common/Locale) // dev.kord.common/Locale.Serializer.serialize|serialize(kotlinx.serialization.encoding.Encoder;dev.kord.common.Locale){}[0] - } } sealed class <#A: kotlin/Any?> dev.kord.common.entity/AuditLogChangeKey { // dev.kord.common.entity/AuditLogChangeKey|null[0] @@ -7329,9 +7321,7 @@ sealed class dev.kord.common.entity/ArchiveDuration { // dev.kord.common.entity/ final fun hashCode(): kotlin/Int // dev.kord.common.entity/ArchiveDuration.hashCode|hashCode(){}[0] final fun toString(): kotlin/String // dev.kord.common.entity/ArchiveDuration.toString|toString(){}[0] - final class Unknown : dev.kord.common.entity/ArchiveDuration { // dev.kord.common.entity/ArchiveDuration.Unknown|null[0] - constructor (kotlin.time/Duration) // dev.kord.common.entity/ArchiveDuration.Unknown.|(kotlin.time.Duration){}[0] - } + final class Unknown : dev.kord.common.entity/ArchiveDuration // dev.kord.common.entity/ArchiveDuration.Unknown|null[0] final object Companion { // dev.kord.common.entity/ArchiveDuration.Companion|null[0] final val entries // dev.kord.common.entity/ArchiveDuration.Companion.entries|{}entries[0] @@ -9295,14 +9285,6 @@ final object dev.kord.common.serialization/InstantInEpochSecondsSerializer : kot final fun serialize(kotlinx.serialization.encoding/Encoder, kotlinx.datetime/Instant) // dev.kord.common.serialization/InstantInEpochSecondsSerializer.serialize|serialize(kotlinx.serialization.encoding.Encoder;kotlinx.datetime.Instant){}[0] } -final object dev.kord.common/DiscordBitSetSerializer : kotlinx.serialization/KSerializer { // dev.kord.common/DiscordBitSetSerializer|null[0] - final val descriptor // dev.kord.common/DiscordBitSetSerializer.descriptor|{}descriptor[0] - final fun (): kotlinx.serialization.descriptors/SerialDescriptor // dev.kord.common/DiscordBitSetSerializer.descriptor.|(){}[0] - - final fun deserialize(kotlinx.serialization.encoding/Decoder): dev.kord.common/DiscordBitSet // dev.kord.common/DiscordBitSetSerializer.deserialize|deserialize(kotlinx.serialization.encoding.Decoder){}[0] - final fun serialize(kotlinx.serialization.encoding/Encoder, dev.kord.common/DiscordBitSet) // dev.kord.common/DiscordBitSetSerializer.serialize|serialize(kotlinx.serialization.encoding.Encoder;dev.kord.common.DiscordBitSet){}[0] -} - final object dev.kord.common/KordConfiguration { // dev.kord.common/KordConfiguration|null[0] final var GATEWAY_VERSION // dev.kord.common/KordConfiguration.GATEWAY_VERSION|{}GATEWAY_VERSION[0] final fun (): kotlin/Int // dev.kord.common/KordConfiguration.GATEWAY_VERSION.|(){}[0] 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 6f76d846002..ea64103fa22 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 @@ -619,9 +619,8 @@ public class Permissions internal constructor( public companion object { @Suppress(names = arrayOf("DEPRECATION_ERROR")) @Deprecated( - level = DeprecationLevel.ERROR, - 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.", + level = DeprecationLevel.HIDDEN, + message = "Renamed to 'Companion'. This declaration will be removed in 0.17.0.", replaceWith = ReplaceWith(expression = "Permissions.Companion", imports = arrayOf("dev.kord.common.entity.Permissions")), ) @@ -630,9 +629,8 @@ public class Permissions internal constructor( } @Deprecated( - level = DeprecationLevel.ERROR, - 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.", + level = DeprecationLevel.HIDDEN, + message = "Renamed to 'Companion'. This declaration will be removed in 0.17.0.", replaceWith = ReplaceWith(expression = "Permissions.Companion", imports = arrayOf("dev.kord.common.entity.Permissions")), ) 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 abac9875485..5b9611654d3 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 @@ -329,9 +329,8 @@ public class SystemChannelFlags internal constructor( public companion object { @Suppress(names = arrayOf("DEPRECATION_ERROR")) @Deprecated( - level = DeprecationLevel.ERROR, - 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.", + level = DeprecationLevel.HIDDEN, + message = "Renamed to 'Companion'. This declaration will be removed in 0.17.0.", replaceWith = ReplaceWith(expression = "SystemChannelFlags.Companion", imports = arrayOf("dev.kord.common.entity.SystemChannelFlags")), ) @@ -340,9 +339,8 @@ public class SystemChannelFlags internal constructor( } @Deprecated( - level = DeprecationLevel.ERROR, - 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.", + level = DeprecationLevel.HIDDEN, + message = "Renamed to 'Companion'. 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/src/commonMain/kotlin/DiscordBitSet.kt b/common/src/commonMain/kotlin/DiscordBitSet.kt index 45939272dc5..9202ea6a019 100644 --- a/common/src/commonMain/kotlin/DiscordBitSet.kt +++ b/common/src/commonMain/kotlin/DiscordBitSet.kt @@ -149,11 +149,3 @@ public fun DiscordBitSet(value: String): DiscordBitSet { return DiscordBitSet(destination) } - - -@Deprecated( - "Replaced by 'DiscordBitSet.serializer()'. This declaration will be removed in 0.16.0.", - ReplaceWith("DiscordBitSet.serializer()", imports = ["dev.kord.common.DiscordBitSet"]), - DeprecationLevel.HIDDEN, -) -public object DiscordBitSetSerializer : KSerializer by DiscordBitSet.Serializer diff --git a/common/src/commonMain/kotlin/Locale.kt b/common/src/commonMain/kotlin/Locale.kt index f512ce4edb8..599617e2321 100644 --- a/common/src/commonMain/kotlin/Locale.kt +++ b/common/src/commonMain/kotlin/Locale.kt @@ -13,7 +13,7 @@ import kotlinx.serialization.encoding.Encoder * @property language A language code representing the language. * @property country A country code representing the country. */ -@Serializable(with = Locale.NewSerializer::class) +@Serializable(with = Locale.Serializer::class) public data class Locale(val language: String, val country: String? = null) { public companion object { @@ -236,15 +236,7 @@ public data class Locale(val language: String, val country: String? = null) { } } - @Deprecated( - "Replaced by 'Locale.serializer()'. This declaration will be removed in 0.16.0.", - ReplaceWith("Locale.serializer()", imports = ["dev.kord.common.Locale"]), - DeprecationLevel.HIDDEN, - ) - public object Serializer : KSerializer by NewSerializer - - // TODO rename to 'Serializer' once deprecated public serializer is removed - internal object NewSerializer : KSerializer { + internal object Serializer : KSerializer { override val descriptor = PrimitiveSerialDescriptor("dev.kord.common.Locale", PrimitiveKind.STRING) override fun serialize(encoder: Encoder, value: Locale) = diff --git a/common/src/commonMain/kotlin/entity/DiscordChannel.kt b/common/src/commonMain/kotlin/entity/DiscordChannel.kt index fb6881ff398..0d98318192a 100644 --- a/common/src/commonMain/kotlin/entity/DiscordChannel.kt +++ b/common/src/commonMain/kotlin/entity/DiscordChannel.kt @@ -228,17 +228,7 @@ public sealed class ArchiveDuration( * * This is used as a fallback for [ArchiveDuration]s that haven't been added to Kord yet. */ - public class Unknown internal constructor( - duration: Duration, - @Suppress("UNUSED_PARAMETER") unused: Nothing?, - ) : ArchiveDuration(duration) { - @Deprecated( - "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, - ) - public constructor(duration: Duration) : this(duration, unused = null) - } + public class Unknown internal constructor(duration: Duration) : ArchiveDuration(duration) public object Hour : ArchiveDuration(60.minutes) public object Day : ArchiveDuration(1440.minutes) @@ -265,7 +255,7 @@ public sealed class ArchiveDuration( * Returns an instance of [ArchiveDuration] with [ArchiveDuration.duration] equal to the specified [duration]. */ public fun from(duration: Duration): ArchiveDuration = - entriesByDuration[duration] ?: Unknown(duration, unused = null) + entriesByDuration[duration] ?: Unknown(duration) } } diff --git a/common/src/commonMain/kotlin/entity/DiscordShard.kt b/common/src/commonMain/kotlin/entity/DiscordShard.kt index 8fa7bdc16c0..4c246b78294 100644 --- a/common/src/commonMain/kotlin/entity/DiscordShard.kt +++ b/common/src/commonMain/kotlin/entity/DiscordShard.kt @@ -35,20 +35,18 @@ public data class DiscordShard(val index: Int, val count: Int) { public companion object { @Suppress("DEPRECATION_ERROR") @Deprecated( - "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.", + "Renamed to 'Companion'. This declaration will be removed in 0.17.0.", ReplaceWith("DiscordShard.Companion", imports = ["dev.kord.common.entity.DiscordShard"]), - DeprecationLevel.ERROR, + DeprecationLevel.HIDDEN, ) @JvmField public val NewCompanion: NewCompanion = NewCompanion() } @Deprecated( - "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.", + "Renamed to 'Companion'. This declaration will be removed in 0.17.0.", ReplaceWith("DiscordShard.Companion", imports = ["dev.kord.common.entity.DiscordShard"]), - DeprecationLevel.ERROR, + DeprecationLevel.HIDDEN, ) public class NewCompanion internal constructor() { public fun serializer(): KSerializer = DiscordShard.serializer() diff --git a/common/src/commonMain/kotlin/entity/Permissions.kt b/common/src/commonMain/kotlin/entity/Permissions.kt index 8a6e3cefc2f..2831aa0ed73 100644 --- a/common/src/commonMain/kotlin/entity/Permissions.kt +++ b/common/src/commonMain/kotlin/entity/Permissions.kt @@ -112,9 +112,9 @@ 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. The " + - "deprecation level will be raised to HIDDEN in 0.16.0 and this declaration will be removed in 0.17.0.", + "'Permissions.NewCompanion' was renamed to 'Permissions.Companion'. Use 'Permissions.Companion.ALL' instead. " + + "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, + DeprecationLevel.HIDDEN, ) public val Permissions.NewCompanion.ALL: Permissions get() = ALL_PERMISSIONS diff --git a/core/api/core.api b/core/api/core.api index 3b4173c5603..a038d4920bb 100644 --- a/core/api/core.api +++ b/core/api/core.api @@ -104,7 +104,6 @@ public final class dev/kord/core/Kord$Companion { public final class dev/kord/core/KordKt { public static final fun Kord (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static synthetic fun Kord$default (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; - public static final synthetic fun getKordLogger ()Lmu/KLogger; public static final fun logCaughtThrowable (Ljava/lang/Throwable;)V } diff --git a/core/api/core.klib.api b/core/api/core.klib.api index fea2d3745fa..23bc8491c80 100644 --- a/core/api/core.klib.api +++ b/core/api/core.klib.api @@ -12330,8 +12330,6 @@ final val dev.kord.core.cache.data/id // dev.kord.core.cache.data/id|@dev.kord.c final fun (dev.kord.core.cache.data/VoiceStateData).(): kotlin/String // dev.kord.core.cache.data/id.|@dev.kord.core.cache.data.VoiceStateData(){}[0] final val dev.kord.core.entity/effectiveName // dev.kord.core.entity/effectiveName|@dev.kord.core.entity.User{}effectiveName[0] final fun (dev.kord.core.entity/User).(): kotlin/String // dev.kord.core.entity/effectiveName.|@dev.kord.core.entity.User(){}[0] -final val dev.kord.core/kordLogger // dev.kord.core/kordLogger|{}kordLogger[0] - final fun (): mu/KLogger // dev.kord.core/kordLogger.|(){}[0] final fun (dev.kord.cache.api/DataCache).dev.kord.core.cache/createView(): dev.kord.core.cache/DataCacheView // dev.kord.core.cache/createView|createView@dev.kord.cache.api.DataCache(){}[0] final fun (dev.kord.common.entity/DiscordChannel).dev.kord.core.cache.data/toData(): dev.kord.core.cache.data/ChannelData // dev.kord.core.cache.data/toData|toData@dev.kord.common.entity.DiscordChannel(){}[0] diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 6a9478a6873..de31a595e95 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -15,9 +15,6 @@ kotlin { api(libs.kord.cache.map) implementation(libs.kotlin.logging) - - // TODO remove when kordLogger is removed - implementation(libs.kotlin.logging.old) } } jvmMain { diff --git a/core/src/commonMain/kotlin/Kord.kt b/core/src/commonMain/kotlin/Kord.kt index 0b3bc844361..71d4c3d6741 100644 --- a/core/src/commonMain/kotlin/Kord.kt +++ b/core/src/commonMain/kotlin/Kord.kt @@ -43,9 +43,6 @@ import kotlin.coroutines.CoroutineContext import kotlin.jvm.JvmName import kotlinx.coroutines.channels.Channel as CoroutineChannel -@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 { } @PublishedApi diff --git a/core/src/commonMain/kotlin/event/interaction/ApplicationCommandCreate.kt b/core/src/commonMain/kotlin/event/interaction/ApplicationCommandCreate.kt index e44f876c6be..c0875356498 100644 --- a/core/src/commonMain/kotlin/event/interaction/ApplicationCommandCreate.kt +++ b/core/src/commonMain/kotlin/event/interaction/ApplicationCommandCreate.kt @@ -7,9 +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. 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, + "details. This declaration will be removed in 0.17.0.", + level = DeprecationLevel.HIDDEN, ) public sealed interface ApplicationCommandCreateEvent : Event { public val command: GuildApplicationCommand @@ -18,9 +17,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. 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, + "details. This declaration will be removed in 0.17.0.", + level = DeprecationLevel.HIDDEN, ) public class ChatInputCommandCreateEvent( override val command: GuildChatInputCommand, @@ -33,9 +31,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. 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, + "details. This declaration will be removed in 0.17.0.", + level = DeprecationLevel.HIDDEN, ) public class UserCommandCreateEvent( override val command: GuildUserCommand, @@ -48,9 +45,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. 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, + "details. This declaration will be removed in 0.17.0.", + level = DeprecationLevel.HIDDEN, ) public class MessageCommandCreateEvent( override val command: GuildMessageCommand, @@ -63,9 +59,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. 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, + "details. This declaration will be removed in 0.17.0.", + level = DeprecationLevel.HIDDEN, ) public class UnknownApplicationCommandCreateEvent( override val command: UnknownGuildApplicationCommand, diff --git a/core/src/commonMain/kotlin/event/interaction/ApplicationCommandDelete.kt b/core/src/commonMain/kotlin/event/interaction/ApplicationCommandDelete.kt index 07da0c05680..038c6b4a110 100644 --- a/core/src/commonMain/kotlin/event/interaction/ApplicationCommandDelete.kt +++ b/core/src/commonMain/kotlin/event/interaction/ApplicationCommandDelete.kt @@ -7,9 +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. 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, + "details. This declaration will be removed in 0.17.0.", + level = DeprecationLevel.HIDDEN, ) public sealed interface ApplicationCommandDeleteEvent : Event { public val command: GuildApplicationCommand @@ -18,9 +17,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. 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, + "details. This declaration will be removed in 0.17.0.", + level = DeprecationLevel.HIDDEN, ) public class ChatInputCommandDeleteEvent( override val command: GuildChatInputCommand, @@ -33,9 +31,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. 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, + "details. This declaration will be removed in 0.17.0.", + level = DeprecationLevel.HIDDEN, ) public class UserCommandDeleteEvent( override val command: GuildUserCommand, @@ -48,9 +45,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. 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, + "details. This declaration will be removed in 0.17.0.", + level = DeprecationLevel.HIDDEN, ) public class MessageCommandDeleteEvent( override val command: GuildMessageCommand, @@ -63,9 +59,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. 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, + "details. This declaration will be removed in 0.17.0.", + level = DeprecationLevel.HIDDEN, ) public class UnknownApplicationCommandDeleteEvent( override val command: UnknownGuildApplicationCommand, diff --git a/core/src/commonMain/kotlin/event/interaction/ApplicationCommandUpdate.kt b/core/src/commonMain/kotlin/event/interaction/ApplicationCommandUpdate.kt index 8bd152c4a7d..9d8f971a0dd 100644 --- a/core/src/commonMain/kotlin/event/interaction/ApplicationCommandUpdate.kt +++ b/core/src/commonMain/kotlin/event/interaction/ApplicationCommandUpdate.kt @@ -7,9 +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. 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, + "details. This declaration will be removed in 0.17.0.", + level = DeprecationLevel.HIDDEN, ) public sealed interface ApplicationCommandUpdateEvent : Event { public val command: GuildApplicationCommand @@ -18,9 +17,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. 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, + "details. This declaration will be removed in 0.17.0.", + level = DeprecationLevel.HIDDEN, ) public class ChatInputCommandUpdateEvent( override val command: GuildChatInputCommand, @@ -33,9 +31,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. 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, + "details. This declaration will be removed in 0.17.0.", + level = DeprecationLevel.HIDDEN, ) public class UserCommandUpdateEvent( override val command: GuildUserCommand, @@ -48,9 +45,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. 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, + "details. This declaration will be removed in 0.17.0.", + level = DeprecationLevel.HIDDEN, ) public class MessageCommandUpdateEvent( override val command: GuildMessageCommand, @@ -62,9 +58,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. 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, + "details. This declaration will be removed in 0.17.0.", + level = DeprecationLevel.HIDDEN, ) public class UnknownApplicationCommandUpdateEvent( override val command: UnknownGuildApplicationCommand, diff --git a/gateway/api/gateway.api b/gateway/api/gateway.api index 949870c870f..b73047ebda7 100644 --- a/gateway/api/gateway.api +++ b/gateway/api/gateway.api @@ -707,7 +707,6 @@ public final class dev/kord/gateway/GatewayConfigurationBuilder { public final class dev/kord/gateway/GatewayKt { public static final fun editPresence (Ldev/kord/gateway/Gateway;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static final synthetic fun getGatewayOnLogger ()Lmu/KLogger; public static final fun logCaughtThrowable (Ljava/lang/Throwable;)V public static final fun requestGuildMembers (Ldev/kord/gateway/Gateway;Ldev/kord/common/entity/Snowflake;Lkotlin/jvm/functions/Function1;)Lkotlinx/coroutines/flow/Flow; public static final fun requestGuildMembers (Ldev/kord/gateway/Gateway;Ldev/kord/gateway/RequestGuildMembers;)Lkotlinx/coroutines/flow/Flow; @@ -1958,10 +1957,6 @@ public final class dev/kord/gateway/UserUpdate : dev/kord/gateway/DispatchEvent public fun toString ()Ljava/lang/String; } -public final class dev/kord/gateway/UtilsKt { - public static final synthetic fun error (Lmu/KLogger;Ljava/lang/Throwable;)V -} - public final class dev/kord/gateway/VoiceServerUpdate : dev/kord/gateway/DispatchEvent { public fun (Ldev/kord/common/entity/DiscordVoiceServerUpdateData;Ljava/lang/Integer;)V public final fun component1 ()Ldev/kord/common/entity/DiscordVoiceServerUpdateData; diff --git a/gateway/api/gateway.klib.api b/gateway/api/gateway.klib.api index b272e94d237..b2e60f175ae 100644 --- a/gateway/api/gateway.klib.api +++ b/gateway/api/gateway.klib.api @@ -2350,12 +2350,9 @@ final val dev.kord.gateway/NON_PRIVILEGED // dev.kord.gateway/NON_PRIVILEGED|@de final fun (dev.kord.gateway/Intents.Companion).(): dev.kord.gateway/Intents // dev.kord.gateway/NON_PRIVILEGED.|@dev.kord.gateway.Intents.Companion(){}[0] final val dev.kord.gateway/PRIVILEGED // dev.kord.gateway/PRIVILEGED|@dev.kord.gateway.Intents.Companion{}PRIVILEGED[0] final fun (dev.kord.gateway/Intents.Companion).(): dev.kord.gateway/Intents // dev.kord.gateway/PRIVILEGED.|@dev.kord.gateway.Intents.Companion(){}[0] -final val dev.kord.gateway/gatewayOnLogger // dev.kord.gateway/gatewayOnLogger|{}gatewayOnLogger[0] - final fun (): mu/KLogger // dev.kord.gateway/gatewayOnLogger.|(){}[0] final fun (dev.kord.gateway/Gateway).dev.kord.gateway/requestGuildMembers(dev.kord.common.entity/Snowflake, kotlin/Function1 = ...): kotlinx.coroutines.flow/Flow // dev.kord.gateway/requestGuildMembers|requestGuildMembers@dev.kord.gateway.Gateway(dev.kord.common.entity.Snowflake;kotlin.Function1){}[0] final fun (dev.kord.gateway/Gateway).dev.kord.gateway/requestGuildMembers(dev.kord.gateway/RequestGuildMembers): kotlinx.coroutines.flow/Flow // dev.kord.gateway/requestGuildMembers|requestGuildMembers@dev.kord.gateway.Gateway(dev.kord.gateway.RequestGuildMembers){}[0] -final fun (mu/KLogger).dev.kord.gateway/error(kotlin/Throwable) // dev.kord.gateway/error|error@mu.KLogger(kotlin.Throwable){}[0] final fun dev.kord.gateway.ratelimit/IdentifyRateLimiter(kotlin/Int, kotlinx.coroutines/CoroutineDispatcher = ...): dev.kord.gateway.ratelimit/IdentifyRateLimiter // dev.kord.gateway.ratelimit/IdentifyRateLimiter|IdentifyRateLimiter(kotlin.Int;kotlinx.coroutines.CoroutineDispatcher){}[0] final fun dev.kord.gateway/Intents(kotlin.collections/Iterable): dev.kord.gateway/Intents // dev.kord.gateway/Intents|Intents(kotlin.collections.Iterable){}[0] final fun dev.kord.gateway/Intents(kotlin.collections/Iterable): dev.kord.gateway/Intents // dev.kord.gateway/Intents|Intents(kotlin.collections.Iterable){}[0] diff --git a/gateway/build.gradle.kts b/gateway/build.gradle.kts index 076873ffa47..2b646a41100 100644 --- a/gateway/build.gradle.kts +++ b/gateway/build.gradle.kts @@ -13,9 +13,6 @@ kotlin { implementation(libs.kotlin.logging) - // TODO remove when gatewayOnLogger and mu.KLogger.error() are removed - implementation(libs.kotlin.logging.old) - compileOnly(projects.kspAnnotations) } } diff --git a/gateway/src/commonMain/kotlin/Event.kt b/gateway/src/commonMain/kotlin/Event.kt index 69d0df9be3e..d9aead9ff00 100644 --- a/gateway/src/commonMain/kotlin/Event.kt +++ b/gateway/src/commonMain/kotlin/Event.kt @@ -345,20 +345,18 @@ public data class Heartbeat(val data: Long?) : Event() { public companion object { @Suppress("DEPRECATION_ERROR") @Deprecated( - "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.", + "Renamed to 'Companion'. This declaration will be removed in 0.17.0.", ReplaceWith("Heartbeat.Companion", imports = ["dev.kord.gateway.Heartbeat"]), - DeprecationLevel.ERROR, + DeprecationLevel.HIDDEN, ) @JvmField public val NewCompanion: NewCompanion = NewCompanion() } @Deprecated( - "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.", + "Renamed to 'Companion'. This declaration will be removed in 0.17.0.", ReplaceWith("Heartbeat.Companion", imports = ["dev.kord.gateway.Heartbeat"]), - DeprecationLevel.ERROR, + DeprecationLevel.HIDDEN, ) public class NewCompanion internal constructor() { public fun serializer(): KSerializer = Heartbeat.serializer() @@ -555,9 +553,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. 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, + "details. This declaration will be removed in 0.17.0.", + level = DeprecationLevel.HIDDEN, ) public data class ApplicationCommandCreate(val application: DiscordApplicationCommand, override val sequence: Int?) : DispatchEvent() @@ -565,9 +562,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. 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, + "details. This declaration will be removed in 0.17.0.", + level = DeprecationLevel.HIDDEN, ) public data class ApplicationCommandUpdate(val application: DiscordApplicationCommand, override val sequence: Int?) : DispatchEvent() @@ -575,9 +571,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. 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, + "details. This declaration will be removed in 0.17.0.", + level = DeprecationLevel.HIDDEN, ) public data class ApplicationCommandDelete(val application: DiscordApplicationCommand, override val sequence: Int?) : DispatchEvent() diff --git a/gateway/src/commonMain/kotlin/Gateway.kt b/gateway/src/commonMain/kotlin/Gateway.kt index 093791d17e6..2948b89b5c9 100644 --- a/gateway/src/commonMain/kotlin/Gateway.kt +++ b/gateway/src/commonMain/kotlin/Gateway.kt @@ -139,14 +139,6 @@ public suspend inline fun Gateway.start(token: String, config: GatewayConfigurat start(builder.build()) } -@Suppress("unused") -@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") - /** * Logger used to report [Throwable]s caught in [Gateway.on]. */ diff --git a/gateway/src/commonMain/kotlin/Utils.kt b/gateway/src/commonMain/kotlin/Utils.kt deleted file mode 100644 index 31ef79fd596..00000000000 --- a/gateway/src/commonMain/kotlin/Utils.kt +++ /dev/null @@ -1,10 +0,0 @@ -package dev.kord.gateway - -import mu.KLogger - -@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/gradle/libs.versions.toml b/gradle/libs.versions.toml index ab485a8dfde..1599989c8fa 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -10,7 +10,6 @@ kord-cache = "0.5.4" # https://github.com/kordlib/cache # implementation dependencies kotlin-logging = "7.0.0" # https://github.com/oshai/kotlin-logging -kotlin-logging-old = "3.0.5" # TODO remove after dependency is removed in rest, gateway, voice and core slf4j = "2.0.16" # https://www.slf4j.org kotlin-node = "22.5.4-pre.818" # https://github.com/JetBrains/kotlin-wrappers bignum = "0.3.10" # https://github.com/ionspin/kotlin-multiplatform-bignum @@ -58,7 +57,6 @@ kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version. # other kotlin-logging = { module = "io.github.oshai:kotlin-logging", version.ref = "kotlin-logging" } -kotlin-logging-old = { module = "io.github.microutils:kotlin-logging", version.ref = "kotlin-logging-old" } slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" } kotlin-node = { module = "org.jetbrains.kotlin-wrappers:kotlin-node", version.ref = "kotlin-node" } diff --git a/ksp-processors/src/main/kotlin/generation/bitflags/DeprecatedNewCompanion.kt b/ksp-processors/src/main/kotlin/generation/bitflags/DeprecatedNewCompanion.kt index ffb0973676c..94c5d4ec3cb 100644 --- a/ksp-processors/src/main/kotlin/generation/bitflags/DeprecatedNewCompanion.kt +++ b/ksp-processors/src/main/kotlin/generation/bitflags/DeprecatedNewCompanion.kt @@ -13,15 +13,14 @@ import dev.kord.ksp.generation.shared.GenerationContext import dev.kord.ksp.generation.shared.K_SERIALIZER // TODO bump LEVEL and remove this file eventually -private val LEVEL = DeprecationLevel.ERROR +private val LEVEL = DeprecationLevel.HIDDEN context(BitFlags, GenerationContext) @OptIn(DelicateKotlinPoetApi::class) internal fun TypeSpec.Builder.addDeprecatedNewCompanion() { val newCompanion = collectionCN.nestedClass("NewCompanion") val deprecated = Deprecated( - "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.", + "Renamed to 'Companion'. This declaration will be removed in 0.17.0.", ReplaceWith("${collectionCN.simpleName}.Companion", imports = arrayOf(collectionCN.canonicalName)), LEVEL, ) diff --git a/rest/api/rest.api b/rest/api/rest.api index 3107a6022a3..f0b237763c2 100644 --- a/rest/api/rest.api +++ b/rest/api/rest.api @@ -6441,7 +6441,6 @@ public final class dev/kord/rest/route/DiscordCdn { public static final field INSTANCE Ldev/kord/rest/route/DiscordCdn; public final fun applicationCover (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;)Ldev/kord/rest/route/CdnUrl; public final fun applicationIcon (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;)Ldev/kord/rest/route/CdnUrl; - public final synthetic fun defaultAvatar (I)Ldev/kord/rest/route/CdnUrl; public final fun defaultUserAvatar (I)Ldev/kord/rest/route/CdnUrl; public final fun defaultUserAvatar (Ldev/kord/common/entity/Snowflake;)Ldev/kord/rest/route/CdnUrl; public final fun emoji (Ldev/kord/common/entity/Snowflake;)Ldev/kord/rest/route/CdnUrl; diff --git a/rest/api/rest.klib.api b/rest/api/rest.klib.api index b9cb1a9ef81..09199d14d8e 100644 --- a/rest/api/rest.klib.api +++ b/rest/api/rest.klib.api @@ -8003,7 +8003,6 @@ sealed class dev.kord.rest.request/RequestIdentifier { // dev.kord.rest.request/ final object dev.kord.rest.route/DiscordCdn { // dev.kord.rest.route/DiscordCdn|null[0] final fun applicationCover(dev.kord.common.entity/Snowflake, kotlin/String): dev.kord.rest.route/CdnUrl // dev.kord.rest.route/DiscordCdn.applicationCover|applicationCover(dev.kord.common.entity.Snowflake;kotlin.String){}[0] final fun applicationIcon(dev.kord.common.entity/Snowflake, kotlin/String): dev.kord.rest.route/CdnUrl // dev.kord.rest.route/DiscordCdn.applicationIcon|applicationIcon(dev.kord.common.entity.Snowflake;kotlin.String){}[0] - final fun defaultAvatar(kotlin/Int): dev.kord.rest.route/CdnUrl // dev.kord.rest.route/DiscordCdn.defaultAvatar|defaultAvatar(kotlin.Int){}[0] final fun defaultUserAvatar(dev.kord.common.entity/Snowflake): dev.kord.rest.route/CdnUrl // dev.kord.rest.route/DiscordCdn.defaultUserAvatar|defaultUserAvatar(dev.kord.common.entity.Snowflake){}[0] final fun defaultUserAvatar(kotlin/Int): dev.kord.rest.route/CdnUrl // dev.kord.rest.route/DiscordCdn.defaultUserAvatar|defaultUserAvatar(kotlin.Int){}[0] final fun emoji(dev.kord.common.entity/Snowflake): dev.kord.rest.route/CdnUrl // dev.kord.rest.route/DiscordCdn.emoji|emoji(dev.kord.common.entity.Snowflake){}[0] diff --git a/rest/src/commonMain/kotlin/builder/automoderation/AutoModerationRuleBuilder.kt b/rest/src/commonMain/kotlin/builder/automoderation/AutoModerationRuleBuilder.kt index 8f2d46957b2..04da7ae33ae 100644 --- a/rest/src/commonMain/kotlin/builder/automoderation/AutoModerationRuleBuilder.kt +++ b/rest/src/commonMain/kotlin/builder/automoderation/AutoModerationRuleBuilder.kt @@ -310,10 +310,10 @@ public sealed interface KeywordPresetAutoModerationRuleBuilder : * [KeywordPresetAutoModerationRuleBuilder]. */ @Deprecated( - "This can be replaced with 'presets', it is now a 'var'. The deprecation level will be raised to ERROR in " + - "0.16.0, to HIDDEN in 0.17.0, and this declaration will be removed in 0.18.0.", + "This can be replaced with 'presets', it is now a 'var'. The deprecation level will be raised to HIDDEN in " + + "0.17.0 and this declaration will be removed in 0.18.0.", ReplaceWith("this.run { this@run.presets = presets }", imports = ["kotlin.run"]), - DeprecationLevel.WARNING, + DeprecationLevel.ERROR, ) public fun assignPresets(presets: MutableList) } @@ -364,8 +364,8 @@ public inline fun MemberProfileAutoModerationRuleBuilder.blockMemberInteraction( @Deprecated( "Not all Auto Moderation Rules can have a 'BlockMessage' action (e.g. 'MemberProfile' rules can't), so this " + "extension function is deprecated for 'AutoModerationRuleBuilder'. Use the extension function on " + - "'BlockMessageAutoModerationRuleBuilder' instead. The deprecation level will be raised to ERROR in 0.16.0, " + - "to HIDDEN in 0.17.0, and this declaration will be removed in 0.18.0.", + "'BlockMessageAutoModerationRuleBuilder' instead. The deprecation level will be raised to HIDDEN in 0.17.0 " + + "and this declaration will be removed in 0.18.0.", ReplaceWith( "(this as? BlockMessageAutoModerationRuleBuilder)?.blockMessage { builder() } ?: Unit", imports = [ @@ -373,7 +373,7 @@ public inline fun MemberProfileAutoModerationRuleBuilder.blockMemberInteraction( "dev.kord.rest.builder.automoderation.blockMessage", "kotlin.Unit", ], ), - DeprecationLevel.WARNING, + DeprecationLevel.ERROR, ) public inline fun AutoModerationRuleBuilder.blockMessage( builder: BlockMessageAutoModerationActionBuilder.() -> Unit = {}, diff --git a/rest/src/commonMain/kotlin/builder/automoderation/AutoModerationRuleCreateBuilder.kt b/rest/src/commonMain/kotlin/builder/automoderation/AutoModerationRuleCreateBuilder.kt index f34f0531086..f2f7cae0b86 100644 --- a/rest/src/commonMain/kotlin/builder/automoderation/AutoModerationRuleCreateBuilder.kt +++ b/rest/src/commonMain/kotlin/builder/automoderation/AutoModerationRuleCreateBuilder.kt @@ -102,10 +102,10 @@ public class KeywordPresetAutoModerationRuleCreateBuilder( /** @suppress Use `this.presets = presets` instead. */ @Deprecated( - "Use 'this.presets = presets' instead. The deprecation level will be raised to ERROR in 0.16.0, to HIDDEN in " + - "0.17.0, and this declaration will be removed in 0.18.0.", + "Use 'this.presets = presets' instead. The deprecation level will be raised to HIDDEN in 0.17.0 and this " + + "declaration will be removed in 0.18.0.", ReplaceWith("this.run { this@run.presets = presets }", imports = ["kotlin.run"]), - DeprecationLevel.WARNING, + DeprecationLevel.ERROR, ) override fun assignPresets(presets: MutableList) { this.presets = presets diff --git a/rest/src/commonMain/kotlin/builder/automoderation/AutoModerationRuleModifyBuilder.kt b/rest/src/commonMain/kotlin/builder/automoderation/AutoModerationRuleModifyBuilder.kt index 76d9218073c..f6fafd8ab30 100644 --- a/rest/src/commonMain/kotlin/builder/automoderation/AutoModerationRuleModifyBuilder.kt +++ b/rest/src/commonMain/kotlin/builder/automoderation/AutoModerationRuleModifyBuilder.kt @@ -120,10 +120,10 @@ public class KeywordPresetAutoModerationRuleModifyBuilder : /** @suppress Use `this.presets = presets` instead. */ @Deprecated( - "Use 'this.presets = presets' instead. The deprecation level will be raised to ERROR in 0.16.0, to HIDDEN in " + - "0.17.0, and this declaration will be removed in 0.18.0.", + "Use 'this.presets = presets' instead. The deprecation level will be raised to HIDDEN in 0.17.0 and this " + + "declaration will be removed in 0.18.0.", ReplaceWith("this.run { this@run.presets = presets }", imports = ["kotlin.run"]), - DeprecationLevel.WARNING, + DeprecationLevel.ERROR, ) override fun assignPresets(presets: MutableList) { this.presets = presets diff --git a/rest/src/commonMain/kotlin/route/DiscordCdn.kt b/rest/src/commonMain/kotlin/route/DiscordCdn.kt index 994578eaad7..e46cf6e5f43 100644 --- a/rest/src/commonMain/kotlin/route/DiscordCdn.kt +++ b/rest/src/commonMain/kotlin/route/DiscordCdn.kt @@ -20,14 +20,6 @@ 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. This " + - "declaration will be removed in 0.16.0.", - ReplaceWith("DiscordCdn.defaultUserAvatar(discriminator)", imports = ["dev.kord.rest.route.DiscordCdn"]), - DeprecationLevel.HIDDEN, - ) - public fun defaultAvatar(discriminator: Int): CdnUrl = defaultUserAvatar(discriminator) - public fun defaultUserAvatar(discriminator: Int): CdnUrl = CdnUrl("$BASE_URL/embed/avatars/${discriminator % 5}") public fun defaultUserAvatar(userId: Snowflake): CdnUrl = diff --git a/voice/api/voice.api b/voice/api/voice.api index 6680afe9661..513ead64fbb 100644 --- a/voice/api/voice.api +++ b/voice/api/voice.api @@ -733,7 +733,7 @@ public final class dev/kord/voice/gateway/Resume$Companion { public final class dev/kord/voice/gateway/Resumed : dev/kord/voice/gateway/VoiceEvent { public static final field INSTANCE Ldev/kord/voice/gateway/Resumed; - public final fun serializer ()Lkotlinx/serialization/KSerializer; + public final synthetic fun serializer ()Lkotlinx/serialization/KSerializer; } public final class dev/kord/voice/gateway/SelectProtocol : dev/kord/voice/gateway/Command { @@ -988,7 +988,6 @@ public final class dev/kord/voice/gateway/VoiceGatewayConfiguration { } public final class dev/kord/voice/gateway/VoiceGatewayKt { - public static final synthetic fun getVoiceGatewayOnLogger ()Lmu/KLogger; public static final fun logCaughtThrowable (Ljava/lang/Throwable;)V } diff --git a/voice/build.gradle.kts b/voice/build.gradle.kts index fbf4f4eaaad..5eddf01309a 100644 --- a/voice/build.gradle.kts +++ b/voice/build.gradle.kts @@ -12,9 +12,6 @@ dependencies { implementation(libs.kotlin.logging) implementation(libs.slf4j.api) - // TODO remove when voiceGatewayOnLogger is removed - implementation(libs.kotlin.logging.old) - compileOnly(projects.kspAnnotations) api(libs.ktor.network) diff --git a/voice/src/main/kotlin/gateway/VoiceEvent.kt b/voice/src/main/kotlin/gateway/VoiceEvent.kt index edce66dbd63..198227eaf68 100644 --- a/voice/src/main/kotlin/gateway/VoiceEvent.kt +++ b/voice/src/main/kotlin/gateway/VoiceEvent.kt @@ -109,9 +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. 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, + "Deprecated without a replacement. This declaration will be removed in 0.17.0.", + level = DeprecationLevel.HIDDEN, ) public fun serializer(): KSerializer = Serializer diff --git a/voice/src/main/kotlin/gateway/VoiceGateway.kt b/voice/src/main/kotlin/gateway/VoiceGateway.kt index 9e738a4e1eb..58799a2d553 100644 --- a/voice/src/main/kotlin/gateway/VoiceGateway.kt +++ b/voice/src/main/kotlin/gateway/VoiceGateway.kt @@ -86,14 +86,6 @@ public interface VoiceGateway { } -@Suppress("unused") -@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") - /** * Logger used to report [Throwable]s caught in [VoiceGateway.on]. */ From 32fb99403d0339fb38bb5f9153305fab780c2256 Mon Sep 17 00:00:00 2001 From: Michael Rittmeister Date: Tue, 29 Oct 2024 18:21:35 +0100 Subject: [PATCH 2/2] Exclude interaction endpoints from global rate limit (#989) Interaction endpoints [1] are not bound to the bot's Global Rate Limit. [2] This actually causes issues with Kord no longer responding to commands because it exceeded some other rate limit. [1] https://discord.com/developers/docs/interactions/receiving-and-responding#endpoints [2] https://discord.com/developers/docs/topics/rate-limits#global-rate-limit --- rest/api/rest.api | 9 +++++---- rest/api/rest.klib.api | 2 ++ .../kotlin/ratelimit/AbstractRateLimiter.kt | 4 +++- rest/src/commonMain/kotlin/route/Route.kt | 12 +++++++++++- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/rest/api/rest.api b/rest/api/rest.api index f0b237763c2..541efb4ea8f 100644 --- a/rest/api/rest.api +++ b/rest/api/rest.api @@ -6492,10 +6492,11 @@ public abstract interface class dev/kord/rest/route/ResponseMapper { public abstract class dev/kord/rest/route/Route { public static final field Companion Ldev/kord/rest/route/Route$Companion; - public synthetic fun (Lio/ktor/http/HttpMethod;Ljava/lang/String;Ldev/kord/rest/route/ResponseMapper;ZILkotlin/jvm/internal/DefaultConstructorMarker;)V - public synthetic fun (Lio/ktor/http/HttpMethod;Ljava/lang/String;Ldev/kord/rest/route/ResponseMapper;ZLkotlin/jvm/internal/DefaultConstructorMarker;)V - public synthetic fun (Lio/ktor/http/HttpMethod;Ljava/lang/String;Lkotlinx/serialization/DeserializationStrategy;ZILkotlin/jvm/internal/DefaultConstructorMarker;)V - public synthetic fun (Lio/ktor/http/HttpMethod;Ljava/lang/String;Lkotlinx/serialization/DeserializationStrategy;ZLkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Lio/ktor/http/HttpMethod;Ljava/lang/String;Ldev/kord/rest/route/ResponseMapper;ZZILkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Lio/ktor/http/HttpMethod;Ljava/lang/String;Ldev/kord/rest/route/ResponseMapper;ZZLkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Lio/ktor/http/HttpMethod;Ljava/lang/String;Lkotlinx/serialization/DeserializationStrategy;ZZILkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Lio/ktor/http/HttpMethod;Ljava/lang/String;Lkotlinx/serialization/DeserializationStrategy;ZZLkotlin/jvm/internal/DefaultConstructorMarker;)V + public final fun getAffectedByGlobalRateLimit ()Z public final fun getMapper ()Ldev/kord/rest/route/ResponseMapper; public final fun getMethod ()Lio/ktor/http/HttpMethod; public final fun getPath ()Ljava/lang/String; diff --git a/rest/api/rest.klib.api b/rest/api/rest.klib.api index 09199d14d8e..1af2cb5b897 100644 --- a/rest/api/rest.klib.api +++ b/rest/api/rest.klib.api @@ -7211,6 +7211,8 @@ sealed class <#A: kotlin/Any?, #B: dev.kord.common.entity/Choice> dev.kord.rest. } sealed class <#A: kotlin/Any?> dev.kord.rest.route/Route { // dev.kord.rest.route/Route|null[0] + final val affectedByGlobalRateLimit // dev.kord.rest.route/Route.affectedByGlobalRateLimit|{}affectedByGlobalRateLimit[0] + final fun (): kotlin/Boolean // dev.kord.rest.route/Route.affectedByGlobalRateLimit.|(){}[0] final val mapper // dev.kord.rest.route/Route.mapper|{}mapper[0] final fun (): dev.kord.rest.route/ResponseMapper<#A> // dev.kord.rest.route/Route.mapper.|(){}[0] final val method // dev.kord.rest.route/Route.method|{}method[0] diff --git a/rest/src/commonMain/kotlin/ratelimit/AbstractRateLimiter.kt b/rest/src/commonMain/kotlin/ratelimit/AbstractRateLimiter.kt index 0fb31876233..f7ca7067f4c 100644 --- a/rest/src/commonMain/kotlin/ratelimit/AbstractRateLimiter.kt +++ b/rest/src/commonMain/kotlin/ratelimit/AbstractRateLimiter.kt @@ -33,7 +33,9 @@ public abstract class AbstractRateLimiter internal constructor(public val clock: } override suspend fun await(request: Request<*, *>): RequestToken { - globalSuspensionPoint.value.await() + if (request.route.affectedByGlobalRateLimit) { + globalSuspensionPoint.value.await() + } val buckets = request.buckets buckets.forEach { it.awaitAndLock() } diff --git a/rest/src/commonMain/kotlin/route/Route.kt b/rest/src/commonMain/kotlin/route/Route.kt index 7476d62e5ef..d36346b19bd 100644 --- a/rest/src/commonMain/kotlin/route/Route.kt +++ b/rest/src/commonMain/kotlin/route/Route.kt @@ -50,6 +50,7 @@ public sealed class Route( public val path: String, public val mapper: ResponseMapper, public val requiresAuthorizationHeader: Boolean = true, + public val affectedByGlobalRateLimit: Boolean = true ) { public companion object { @@ -91,7 +92,8 @@ public sealed class Route( path: String, strategy: DeserializationStrategy, requiresAuthorizationHeader: Boolean = true, - ) : this(method, path, ValueJsonMapper(strategy), requiresAuthorizationHeader) + affectedByGlobalRateLimit: Boolean = true + ) : this(method, path, ValueJsonMapper(strategy), requiresAuthorizationHeader, affectedByGlobalRateLimit) override fun toString(): String = "Route(method:${method.value},path:$path,mapper:$mapper)" @@ -990,6 +992,7 @@ public sealed class Route( "/interactions/$InteractionId/$InteractionToken/callback", NoStrategy, requiresAuthorizationHeader = false, + affectedByGlobalRateLimit = false ) public object OriginalInteractionResponseGet : @@ -998,6 +1001,7 @@ public sealed class Route( "/webhooks/$ApplicationId/$InteractionToken/messages/@original", DiscordMessage.serializer(), requiresAuthorizationHeader = false, + affectedByGlobalRateLimit = false ) public object OriginalInteractionResponseModify : @@ -1006,6 +1010,7 @@ public sealed class Route( "/webhooks/$ApplicationId/$InteractionToken/messages/@original", DiscordMessage.serializer(), requiresAuthorizationHeader = false, + affectedByGlobalRateLimit = false ) public object OriginalInteractionResponseDelete : @@ -1014,6 +1019,7 @@ public sealed class Route( "/webhooks/$ApplicationId/$InteractionToken/messages/@original", NoStrategy, requiresAuthorizationHeader = false, + affectedByGlobalRateLimit = false ) public object FollowupMessageCreate : @@ -1022,6 +1028,7 @@ public sealed class Route( "/webhooks/$ApplicationId/$InteractionToken", DiscordMessage.serializer(), requiresAuthorizationHeader = false, + affectedByGlobalRateLimit = false ) public object FollowupMessageGet : @@ -1030,6 +1037,7 @@ public sealed class Route( "/webhooks/$ApplicationId/$InteractionToken/messages/$MessageId", DiscordMessage.serializer(), requiresAuthorizationHeader = false, + affectedByGlobalRateLimit = false ) public object FollowupMessageModify : @@ -1038,6 +1046,7 @@ public sealed class Route( "/webhooks/$ApplicationId/$InteractionToken/messages/$MessageId", DiscordMessage.serializer(), requiresAuthorizationHeader = false, + affectedByGlobalRateLimit = false ) public object FollowupMessageDelete : @@ -1046,6 +1055,7 @@ public sealed class Route( "/webhooks/$ApplicationId/$InteractionToken/messages/$MessageId", NoStrategy, requiresAuthorizationHeader = false, + affectedByGlobalRateLimit = false )