Skip to content

Commit

Permalink
Merge branch 'main' into kotlin-2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
lukellmann committed Nov 10, 2024
2 parents 4582ffe + 32fb994 commit 07b13b2
Show file tree
Hide file tree
Showing 36 changed files with 99 additions and 237 deletions.
21 changes: 1 addition & 20 deletions common/api/common.api
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 <init> (JLkotlin/jvm/internal/DefaultConstructorMarker;)V
}

public final class dev/kord/common/entity/ArchiveDuration$Week : dev/kord/common/entity/ArchiveDuration {
Expand Down Expand Up @@ -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 {
Expand Down
20 changes: 1 addition & 19 deletions common/api/common.klib.api
Original file line number Diff line number Diff line change
Expand Up @@ -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> // dev.kord.common/Locale.Companion.serializer|serializer(){}[0]
}

final object Serializer : kotlinx.serialization/KSerializer<dev.kord.common/Locale> { // dev.kord.common/Locale.Serializer|null[0]
final val descriptor // dev.kord.common/Locale.Serializer.descriptor|{}descriptor[0]
final fun <get-descriptor>(): kotlinx.serialization.descriptors/SerialDescriptor // dev.kord.common/Locale.Serializer.descriptor.<get-descriptor>|<get-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]
Expand Down Expand Up @@ -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 <init>(kotlin.time/Duration) // dev.kord.common.entity/ArchiveDuration.Unknown.<init>|<init>(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]
Expand Down Expand Up @@ -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/DiscordBitSet> { // dev.kord.common/DiscordBitSetSerializer|null[0]
final val descriptor // dev.kord.common/DiscordBitSetSerializer.descriptor|{}descriptor[0]
final fun <get-descriptor>(): kotlinx.serialization.descriptors/SerialDescriptor // dev.kord.common/DiscordBitSetSerializer.descriptor.<get-descriptor>|<get-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 <get-GATEWAY_VERSION>(): kotlin/Int // dev.kord.common/KordConfiguration.GATEWAY_VERSION.<get-GATEWAY_VERSION>|<get-GATEWAY_VERSION>(){}[0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")),
)
Expand All @@ -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")),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")),
)
Expand All @@ -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")),
)
Expand Down
8 changes: 0 additions & 8 deletions common/src/commonMain/kotlin/DiscordBitSet.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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<DiscordBitSet> by DiscordBitSet.Serializer
12 changes: 2 additions & 10 deletions common/src/commonMain/kotlin/Locale.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -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<Locale> by NewSerializer

// TODO rename to 'Serializer' once deprecated public serializer is removed
internal object NewSerializer : KSerializer<Locale> {
internal object Serializer : KSerializer<Locale> {
override val descriptor = PrimitiveSerialDescriptor("dev.kord.common.Locale", PrimitiveKind.STRING)

override fun serialize(encoder: Encoder, value: Locale) =
Expand Down
14 changes: 2 additions & 12 deletions common/src/commonMain/kotlin/entity/DiscordChannel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
}
}

Expand Down
10 changes: 4 additions & 6 deletions common/src/commonMain/kotlin/entity/DiscordShard.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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> = DiscordShard.serializer()
Expand Down
6 changes: 3 additions & 3 deletions common/src/commonMain/kotlin/entity/Permissions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion core/api/core.api
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 0 additions & 2 deletions core/api/core.klib.api
Original file line number Diff line number Diff line change
Expand Up @@ -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).<get-id>(): kotlin/String // dev.kord.core.cache.data/id.<get-id>|<get-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).<get-effectiveName>(): kotlin/String // dev.kord.core.entity/effectiveName.<get-effectiveName>|<get-effectiveName>@dev.kord.core.entity.User(){}[0]
final val dev.kord.core/kordLogger // dev.kord.core/kordLogger|{}kordLogger[0]
final fun <get-kordLogger>(): mu/KLogger // dev.kord.core/kordLogger.<get-kordLogger>|<get-kordLogger>(){}[0]

final fun (dev.kord.cache.api/DataCache).dev.kord.core.cache/createView(): dev.kord.core.cache/DataCacheView // dev.kord.core.cache/createView|[email protected](){}[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|[email protected](){}[0]
Expand Down
3 changes: 0 additions & 3 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 0 additions & 3 deletions core/src/commonMain/kotlin/Kord.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
Loading

0 comments on commit 07b13b2

Please sign in to comment.