diff --git a/core/api/core.api b/core/api/core.api index 5e8ab8e7aff..3b4173c5603 100644 --- a/core/api/core.api +++ b/core/api/core.api @@ -42,8 +42,8 @@ public final class dev/kord/core/Kord : kotlinx/coroutines/CoroutineScope { public final fun getEvents ()Lkotlinx/coroutines/flow/SharedFlow; public final fun getGateway ()Ldev/kord/core/gateway/MasterGateway; public final fun getGlobalApplicationCommand (Ldev/kord/common/entity/Snowflake;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public final fun getGlobalApplicationCommandOf (Ldev/kord/common/entity/Snowflake;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public final fun getGlobalApplicationCommandOfOrNull (Ldev/kord/common/entity/Snowflake;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public final synthetic fun getGlobalApplicationCommandOf (Ldev/kord/common/entity/Snowflake;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public final synthetic fun getGlobalApplicationCommandOfOrNull (Ldev/kord/common/entity/Snowflake;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public final fun getGlobalApplicationCommandOrNull (Ldev/kord/common/entity/Snowflake;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public final fun getGlobalApplicationCommands (Ljava/lang/Boolean;)Lkotlinx/coroutines/flow/Flow; public static synthetic fun getGlobalApplicationCommands$default (Ldev/kord/core/Kord;Ljava/lang/Boolean;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow; diff --git a/core/api/core.klib.api b/core/api/core.klib.api index a8278e84f50..fea2d3745fa 100644 --- a/core/api/core.klib.api +++ b/core/api/core.klib.api @@ -11732,6 +11732,8 @@ final class dev.kord.core/Kord : kotlinx.coroutines/CoroutineScope { // dev.kord final suspend fun getWebhookWithTokenOrNull(dev.kord.common.entity/Snowflake, kotlin/String, dev.kord.core.supplier/EntitySupplyStrategy<*> = ...): dev.kord.core.entity/Webhook? // dev.kord.core/Kord.getWebhookWithTokenOrNull|getWebhookWithTokenOrNull(dev.kord.common.entity.Snowflake;kotlin.String;dev.kord.core.supplier.EntitySupplyStrategy<*>){}[0] final suspend fun logout() // dev.kord.core/Kord.logout|logout(){}[0] final suspend fun shutdown() // dev.kord.core/Kord.shutdown|shutdown(){}[0] + final suspend inline fun <#A1: reified dev.kord.core.entity.application/GlobalApplicationCommand> getGlobalApplicationCommandOf(dev.kord.common.entity/Snowflake): #A1 // dev.kord.core/Kord.getGlobalApplicationCommandOf|getGlobalApplicationCommandOf(dev.kord.common.entity.Snowflake){0§}[0] + final suspend inline fun <#A1: reified dev.kord.core.entity.application/GlobalApplicationCommand> getGlobalApplicationCommandOfOrNull(dev.kord.common.entity/Snowflake): #A1? // dev.kord.core/Kord.getGlobalApplicationCommandOfOrNull|getGlobalApplicationCommandOfOrNull(dev.kord.common.entity.Snowflake){0§}[0] final suspend inline fun <#A1: reified dev.kord.core.entity.application/GuildApplicationCommand> getGuildApplicationCommandOf(dev.kord.common.entity/Snowflake, dev.kord.common.entity/Snowflake): #A1 // dev.kord.core/Kord.getGuildApplicationCommandOf|getGuildApplicationCommandOf(dev.kord.common.entity.Snowflake;dev.kord.common.entity.Snowflake){0§}[0] final suspend inline fun <#A1: reified dev.kord.core.entity.application/GuildApplicationCommand> getGuildApplicationCommandOfOrNull(dev.kord.common.entity/Snowflake, dev.kord.common.entity/Snowflake): #A1? // dev.kord.core/Kord.getGuildApplicationCommandOfOrNull|getGuildApplicationCommandOfOrNull(dev.kord.common.entity.Snowflake;dev.kord.common.entity.Snowflake){0§}[0] final suspend inline fun <#A1: reified dev.kord.core.entity.channel/Channel> getChannelOf(dev.kord.common.entity/Snowflake, dev.kord.core.supplier/EntitySupplyStrategy<*> = ...): #A1? // dev.kord.core/Kord.getChannelOf|getChannelOf(dev.kord.common.entity.Snowflake;dev.kord.core.supplier.EntitySupplyStrategy<*>){0§}[0] diff --git a/core/src/commonMain/kotlin/Kord.kt b/core/src/commonMain/kotlin/Kord.kt index 9f49374ee11..0b3bc844361 100644 --- a/core/src/commonMain/kotlin/Kord.kt +++ b/core/src/commonMain/kotlin/Kord.kt @@ -40,6 +40,7 @@ import kotlinx.coroutines.flow.* import kotlin.contracts.InvocationKind import kotlin.contracts.contract 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) @@ -501,11 +502,41 @@ public class Kord( } + @JvmName("getGlobalApplicationCommandOfJvmInlineReplacement") + public suspend inline fun getGlobalApplicationCommandOf( + commandId: Snowflake, + ): T = defaultSupplier.getGlobalApplicationCommandOf(resources.applicationId, commandId) + + + @JvmName("getGlobalApplicationCommandOfOrNullJvmInlineReplacement") + public suspend inline fun getGlobalApplicationCommandOfOrNull( + commandId: Snowflake, + ): T? = defaultSupplier.getGlobalApplicationCommandOfOrNull(resources.applicationId, commandId) + + + @Suppress("TYPE_INTERSECTION_AS_REIFIED_WARNING") + @Deprecated( + "This function has bad semantics: the type argument for T is effectively ignored. It no longer compiles " + + "without a 'TYPE_INTERSECTION_AS_REIFIED_WARNING' since Kotlin 2.1.0 " + + "(https://youtrack.jetbrains.com/issue/KT-52469). The replacement function has a proper bounded reified " + + "type parameter that is actually used. This declaration is kept for binary compatibility, it will be " + + "removed in 0.18.0. The replacement function should then be migrated away from using @JvmName.", + level = DeprecationLevel.HIDDEN, + ) public suspend fun getGlobalApplicationCommandOf(commandId: Snowflake): T { return defaultSupplier.getGlobalApplicationCommandOf(resources.applicationId, commandId) } + @Suppress("TYPE_INTERSECTION_AS_REIFIED_WARNING") + @Deprecated( + "This function has bad semantics: the type argument for T is effectively ignored. It no longer compiles " + + "without a 'TYPE_INTERSECTION_AS_REIFIED_WARNING' since Kotlin 2.1.0 " + + "(https://youtrack.jetbrains.com/issue/KT-52469). The replacement function has a proper bounded reified " + + "type parameter that is actually used. This declaration is kept for binary compatibility, it will be " + + "removed in 0.18.0. The replacement function should then be migrated away from using @JvmName.", + level = DeprecationLevel.HIDDEN, + ) public suspend fun getGlobalApplicationCommandOfOrNull(commandId: Snowflake): T? { return defaultSupplier.getGlobalApplicationCommandOfOrNull(resources.applicationId, commandId) } diff --git a/core/src/commonMain/kotlin/entity/VoiceState.kt b/core/src/commonMain/kotlin/entity/VoiceState.kt index 22003beea14..0c41c80410e 100644 --- a/core/src/commonMain/kotlin/entity/VoiceState.kt +++ b/core/src/commonMain/kotlin/entity/VoiceState.kt @@ -60,7 +60,8 @@ public class VoiceState( * * @throws [RequestException] if anything went wrong during the request. */ - public suspend fun getChannelOrNull(): BaseVoiceChannelBehavior? = channelId?.let { supplier.getChannelOfOrNull(it) } + public suspend fun getChannelOrNull(): BaseVoiceChannelBehavior? = + channelId?.let { supplier.getChannelOrNull(it) as? BaseVoiceChannelBehavior } /**