From bf59ab9f83ffd458d81d85bd22ca2aaae32438c2 Mon Sep 17 00:00:00 2001 From: hope Date: Fri, 24 Mar 2023 13:49:25 +0200 Subject: [PATCH 01/42] fix builders --- .../behavior/channel/NewsChannelBehavior.kt | 41 +++++++++++++++++++ .../behavior/channel/TextChannelBehavior.kt | 30 +++++++++++++- 2 files changed, 70 insertions(+), 1 deletion(-) diff --git a/core/src/main/kotlin/behavior/channel/NewsChannelBehavior.kt b/core/src/main/kotlin/behavior/channel/NewsChannelBehavior.kt index fd75430b8f18..8c14c969c66c 100644 --- a/core/src/main/kotlin/behavior/channel/NewsChannelBehavior.kt +++ b/core/src/main/kotlin/behavior/channel/NewsChannelBehavior.kt @@ -83,6 +83,11 @@ public interface NewsChannelBehavior : ThreadParentChannelBehavior { kord.rest.channel.followNewsChannel(id, ChannelFollowRequest(webhookChannelId = target)) } + @Deprecated( + "Replace with overloaded method.", + replaceWith = ReplaceWith("startPublicThread(name, archiveDuration, reason)"), + level = DeprecationLevel.HIDDEN + ) public suspend fun startPublicThread( name: String, @@ -95,6 +100,12 @@ public interface NewsChannelBehavior : ThreadParentChannelBehavior { } } + @Deprecated( + "Replace with overloaded method.", + replaceWith = ReplaceWith("startPublicThread(name, builder = builder)"), + level = DeprecationLevel.HIDDEN + ) + public suspend fun startPublicThread( name: String, builder: StartThreadWithoutMessageBuilder.() -> Unit = {} @@ -106,6 +117,23 @@ public interface NewsChannelBehavior : ThreadParentChannelBehavior { } as NewsChannelThread } + public suspend fun startPublicThread( + name: String, + archiveDuration: ArchiveDuration = ArchiveDuration.Day, + reason: String? = null, + builder: StartThreadWithoutMessageBuilder.() -> Unit = {} + ): NewsChannelThread { + return unsafeStartThread(name) { + builder() + + type = ChannelType.PublicNewsThread + } as NewsChannelThread + } + @Deprecated( + "Replace with overloaded method.", + replaceWith = ReplaceWith("startPublicThreadWithMessage(messageId, name, archiveDuration, reason)"), + level = DeprecationLevel.HIDDEN + ) public suspend fun startPublicThreadWithMessage( messageId: Snowflake, name: String, @@ -118,6 +146,11 @@ public interface NewsChannelBehavior : ThreadParentChannelBehavior { } } + @Deprecated( + "Replace with overloaded method.", + replaceWith = ReplaceWith("startPublicThreadWithMessage(messageId, name, builder = builder)"), + level = DeprecationLevel.HIDDEN + ) public suspend fun startPublicThreadWithMessage( messageId: Snowflake, name: String, @@ -126,6 +159,14 @@ public interface NewsChannelBehavior : ThreadParentChannelBehavior { return unsafeStartPublicThreadWithMessage(messageId, name, builder) as NewsChannelThread } + public suspend fun startPublicThreadWithMessage( + messageId: Snowflake, + name: String, + reason: String? = null, + builder: StartThreadWithMessageBuilder.() -> Unit = {} + ): NewsChannelThread { + return unsafeStartPublicThreadWithMessage(messageId, name, builder) as NewsChannelThread + } override fun getPublicArchivedThreads(before: Instant?, limit: Int?): Flow { return super.getPublicArchivedThreads(before, limit).filterIsInstance() diff --git a/core/src/main/kotlin/behavior/channel/TextChannelBehavior.kt b/core/src/main/kotlin/behavior/channel/TextChannelBehavior.kt index 6bf8f3dfda97..d2a6561cdb81 100644 --- a/core/src/main/kotlin/behavior/channel/TextChannelBehavior.kt +++ b/core/src/main/kotlin/behavior/channel/TextChannelBehavior.kt @@ -78,6 +78,11 @@ public interface TextChannelBehavior : PrivateThreadParentChannelBehavior { builder() } } + @Deprecated( + "Replace with overloaded method.", + replaceWith = ReplaceWith("startPublicThread(name, builder = builder)"), + level = DeprecationLevel.HIDDEN + ) public suspend fun startPublicThread( name: String, @@ -102,6 +107,11 @@ public interface TextChannelBehavior : PrivateThreadParentChannelBehavior { builder() } } + @Deprecated( + "Replace with overloaded method.", + replaceWith = ReplaceWith("startPrivateThread(name, builder = builder)"), + level = DeprecationLevel.HIDDEN + ) public suspend fun startPrivateThread( name: String, @@ -112,7 +122,11 @@ public interface TextChannelBehavior : PrivateThreadParentChannelBehavior { type = ChannelType.PrivateThread } as TextChannelThread } - + @Deprecated( + "Replace with overloaded method.", + replaceWith = ReplaceWith("startPublicThreadWithMessage(messageId, name, reason)"), + level = DeprecationLevel.HIDDEN + ) public suspend fun startPublicThreadWithMessage( messageId: Snowflake, name: String, @@ -123,6 +137,11 @@ public interface TextChannelBehavior : PrivateThreadParentChannelBehavior { } } + @Deprecated( + "Replace with overloaded method.", + replaceWith = ReplaceWith("startPublicThreadWithMessage(messageId, name, reason, builder)"), + level = DeprecationLevel.HIDDEN + ) public suspend fun startPublicThreadWithMessage( messageId: Snowflake, name: String, @@ -131,6 +150,15 @@ public interface TextChannelBehavior : PrivateThreadParentChannelBehavior { return unsafeStartPublicThreadWithMessage(messageId, name, builder) as TextChannelThread } + + public suspend fun startPublicThreadWithMessage( + messageId: Snowflake, + name: String, + reason: String? = null, + builder: StartThreadWithMessageBuilder.() -> Unit = {} + ): TextChannelThread { + return unsafeStartPublicThreadWithMessage(messageId, name, builder) as TextChannelThread + } override fun getPublicArchivedThreads(before: Instant?, limit: Int?): Flow { return super.getPublicArchivedThreads(before, limit).filterIsInstance() } From 1f3812996e29f7629b37147c8314d4ccbee37b81 Mon Sep 17 00:00:00 2001 From: hope Date: Fri, 24 Mar 2023 13:52:38 +0200 Subject: [PATCH 02/42] apiDump --- core/api/core.api | 60 ++++++++++++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 24 deletions(-) diff --git a/core/api/core.api b/core/api/core.api index 3a32eeb8d6df..41bf4fd85819 100644 --- a/core/api/core.api +++ b/core/api/core.api @@ -1251,10 +1251,12 @@ public abstract interface class dev/kord/core/behavior/channel/NewsChannelBehavi public abstract fun follow (Ldev/kord/common/entity/Snowflake;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public abstract fun getActiveThreads ()Lkotlinx/coroutines/flow/Flow; public abstract fun getPublicArchivedThreads (Lkotlinx/datetime/Instant;Ljava/lang/Integer;)Lkotlinx/coroutines/flow/Flow; - public abstract fun startPublicThread (Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public abstract fun startPublicThread (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public abstract fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public abstract fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public abstract synthetic fun startPublicThread (Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public abstract fun startPublicThread (Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public abstract synthetic fun startPublicThread (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public abstract synthetic fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public abstract fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public abstract synthetic fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public abstract fun withStrategy (Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/behavior/channel/NewsChannelBehavior; } @@ -1274,13 +1276,17 @@ public final class dev/kord/core/behavior/channel/NewsChannelBehavior$DefaultImp public static fun getMention (Ldev/kord/core/behavior/channel/NewsChannelBehavior;)Ljava/lang/String; public static fun getPosition (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun getPublicArchivedThreads (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Lkotlinx/datetime/Instant;Ljava/lang/Integer;)Lkotlinx/coroutines/flow/Flow; - public static fun startPublicThread (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static fun startPublicThread (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun startPublicThread (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static fun startPublicThread (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun startPublicThread (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static synthetic fun startPublicThread$default (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static synthetic fun startPublicThread$default (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; public static synthetic fun startPublicThread$default (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; - public static fun startPublicThreadWithMessage (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static fun startPublicThreadWithMessage (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun startPublicThreadWithMessage (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static fun startPublicThreadWithMessage (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun startPublicThreadWithMessage (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static synthetic fun startPublicThreadWithMessage$default (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static synthetic fun startPublicThreadWithMessage$default (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; public static synthetic fun startPublicThreadWithMessage$default (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; public static fun withStrategy (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/behavior/channel/NewsChannelBehavior; } @@ -1352,11 +1358,12 @@ public abstract interface class dev/kord/core/behavior/channel/TextChannelBehavi public abstract fun getPrivateArchivedThreads (Lkotlinx/datetime/Instant;Ljava/lang/Integer;)Lkotlinx/coroutines/flow/Flow; public abstract fun getPublicArchivedThreads (Lkotlinx/datetime/Instant;Ljava/lang/Integer;)Lkotlinx/coroutines/flow/Flow; public abstract fun startPrivateThread (Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public abstract fun startPrivateThread (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public abstract synthetic fun startPrivateThread (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public abstract fun startPublicThread (Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public abstract fun startPublicThread (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public abstract fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public abstract fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public abstract synthetic fun startPublicThread (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public abstract synthetic fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public abstract fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public abstract synthetic fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public abstract fun withStrategy (Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/behavior/channel/TextChannelBehavior; } @@ -1378,16 +1385,18 @@ public final class dev/kord/core/behavior/channel/TextChannelBehavior$DefaultImp public static fun getPrivateArchivedThreads (Ldev/kord/core/behavior/channel/TextChannelBehavior;Lkotlinx/datetime/Instant;Ljava/lang/Integer;)Lkotlinx/coroutines/flow/Flow; public static fun getPublicArchivedThreads (Ldev/kord/core/behavior/channel/TextChannelBehavior;Lkotlinx/datetime/Instant;Ljava/lang/Integer;)Lkotlinx/coroutines/flow/Flow; public static fun startPrivateThread (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static fun startPrivateThread (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun startPrivateThread (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static synthetic fun startPrivateThread$default (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; public static synthetic fun startPrivateThread$default (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; public static fun startPublicThread (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static fun startPublicThread (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun startPublicThread (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static synthetic fun startPublicThread$default (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; public static synthetic fun startPublicThread$default (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; - public static fun startPublicThreadWithMessage (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static fun startPublicThreadWithMessage (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun startPublicThreadWithMessage (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static fun startPublicThreadWithMessage (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun startPublicThreadWithMessage (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static synthetic fun startPublicThreadWithMessage$default (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ljava/lang/String;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static synthetic fun startPublicThreadWithMessage$default (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; public static synthetic fun startPublicThreadWithMessage$default (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; public static fun withStrategy (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/behavior/channel/TextChannelBehavior; } @@ -7980,10 +7989,12 @@ public final class dev/kord/core/entity/channel/NewsChannel : dev/kord/core/beha public fun getType ()Ldev/kord/common/entity/ChannelType; public fun getWebhooks ()Lkotlinx/coroutines/flow/Flow; public fun hashCode ()I - public fun startPublicThread (Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public fun startPublicThread (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public synthetic fun startPublicThread (Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun startPublicThread (Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public synthetic fun startPublicThread (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public synthetic fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public synthetic fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun toString ()Ljava/lang/String; public fun type (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun typeUntil (Lkotlin/time/TimeMark;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; @@ -8172,11 +8183,12 @@ public final class dev/kord/core/entity/channel/TextChannel : dev/kord/core/beha public fun hashCode ()I public final fun isNsfw ()Z public fun startPrivateThread (Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public fun startPrivateThread (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public synthetic fun startPrivateThread (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun startPublicThread (Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public fun startPublicThread (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public synthetic fun startPublicThread (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public synthetic fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public synthetic fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun toString ()Ljava/lang/String; public fun type (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun typeUntil (Lkotlin/time/TimeMark;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; From e26d35ed173d9f45581d4b58497e258f5e12902b Mon Sep 17 00:00:00 2001 From: hope Date: Fri, 24 Mar 2023 13:59:58 +0200 Subject: [PATCH 03/42] Apply params --- .../behavior/channel/NewsChannelBehavior.kt | 37 ++++++++++++------- .../behavior/channel/TextChannelBehavior.kt | 21 ++++++----- 2 files changed, 35 insertions(+), 23 deletions(-) diff --git a/core/src/main/kotlin/behavior/channel/NewsChannelBehavior.kt b/core/src/main/kotlin/behavior/channel/NewsChannelBehavior.kt index 8c14c969c66c..dc0473ad9645 100644 --- a/core/src/main/kotlin/behavior/channel/NewsChannelBehavior.kt +++ b/core/src/main/kotlin/behavior/channel/NewsChannelBehavior.kt @@ -83,6 +83,22 @@ public interface NewsChannelBehavior : ThreadParentChannelBehavior { kord.rest.channel.followNewsChannel(id, ChannelFollowRequest(webhookChannelId = target)) } + + public suspend fun startPublicThread( + name: String, + archiveDuration: ArchiveDuration = ArchiveDuration.Day, + reason: String? = null, + builder: StartThreadWithoutMessageBuilder.() -> Unit = {} + ): NewsChannelThread { + return unsafeStartThread(name) { + this.reason = reason + this.autoArchiveDuration = archiveDuration + builder() + + type = ChannelType.PublicNewsThread + } as NewsChannelThread + } + @Deprecated( "Replace with overloaded method.", replaceWith = ReplaceWith("startPublicThread(name, archiveDuration, reason)"), @@ -117,18 +133,19 @@ public interface NewsChannelBehavior : ThreadParentChannelBehavior { } as NewsChannelThread } - public suspend fun startPublicThread( + + public suspend fun startPublicThreadWithMessage( + messageId: Snowflake, name: String, - archiveDuration: ArchiveDuration = ArchiveDuration.Day, reason: String? = null, - builder: StartThreadWithoutMessageBuilder.() -> Unit = {} + builder: StartThreadWithMessageBuilder.() -> Unit = {} ): NewsChannelThread { - return unsafeStartThread(name) { + return unsafeStartPublicThreadWithMessage(messageId, name, ) { + this.reason = reason builder() - - type = ChannelType.PublicNewsThread } as NewsChannelThread } + @Deprecated( "Replace with overloaded method.", replaceWith = ReplaceWith("startPublicThreadWithMessage(messageId, name, archiveDuration, reason)"), @@ -159,14 +176,6 @@ public interface NewsChannelBehavior : ThreadParentChannelBehavior { return unsafeStartPublicThreadWithMessage(messageId, name, builder) as NewsChannelThread } - public suspend fun startPublicThreadWithMessage( - messageId: Snowflake, - name: String, - reason: String? = null, - builder: StartThreadWithMessageBuilder.() -> Unit = {} - ): NewsChannelThread { - return unsafeStartPublicThreadWithMessage(messageId, name, builder) as NewsChannelThread - } override fun getPublicArchivedThreads(before: Instant?, limit: Int?): Flow { return super.getPublicArchivedThreads(before, limit).filterIsInstance() diff --git a/core/src/main/kotlin/behavior/channel/TextChannelBehavior.kt b/core/src/main/kotlin/behavior/channel/TextChannelBehavior.kt index d2a6561cdb81..dabd8c8c7551 100644 --- a/core/src/main/kotlin/behavior/channel/TextChannelBehavior.kt +++ b/core/src/main/kotlin/behavior/channel/TextChannelBehavior.kt @@ -122,6 +122,18 @@ public interface TextChannelBehavior : PrivateThreadParentChannelBehavior { type = ChannelType.PrivateThread } as TextChannelThread } + + public suspend fun startPublicThreadWithMessage( + messageId: Snowflake, + name: String, + reason: String? = null, + builder: StartThreadWithMessageBuilder.() -> Unit = {} + ): TextChannelThread { + return unsafeStartPublicThreadWithMessage(messageId, name) { + this.reason = reason + builder() + } as TextChannelThread + } @Deprecated( "Replace with overloaded method.", replaceWith = ReplaceWith("startPublicThreadWithMessage(messageId, name, reason)"), @@ -150,15 +162,6 @@ public interface TextChannelBehavior : PrivateThreadParentChannelBehavior { return unsafeStartPublicThreadWithMessage(messageId, name, builder) as TextChannelThread } - - public suspend fun startPublicThreadWithMessage( - messageId: Snowflake, - name: String, - reason: String? = null, - builder: StartThreadWithMessageBuilder.() -> Unit = {} - ): TextChannelThread { - return unsafeStartPublicThreadWithMessage(messageId, name, builder) as TextChannelThread - } override fun getPublicArchivedThreads(before: Instant?, limit: Int?): Flow { return super.getPublicArchivedThreads(before, limit).filterIsInstance() } From 2845e4c41f9c99dbae9b6cc8b9a76b46e94e4d3f Mon Sep 17 00:00:00 2001 From: Lukellmann Date: Fri, 24 Mar 2023 13:34:22 +0100 Subject: [PATCH 04/42] Fix ambiguity by removing default builder argument The default argument can be reintroduced in the future, when the other overloads are removed. --- .../behavior/channel/NewsChannelBehavior.kt | 58 +++---------------- .../behavior/channel/TextChannelBehavior.kt | 39 +++---------- .../threads/ThreadParentChannelBehavior.kt | 4 +- 3 files changed, 18 insertions(+), 83 deletions(-) diff --git a/core/src/main/kotlin/behavior/channel/NewsChannelBehavior.kt b/core/src/main/kotlin/behavior/channel/NewsChannelBehavior.kt index dc0473ad9645..3d9ba48a3477 100644 --- a/core/src/main/kotlin/behavior/channel/NewsChannelBehavior.kt +++ b/core/src/main/kotlin/behavior/channel/NewsChannelBehavior.kt @@ -26,6 +26,7 @@ import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filterIsInstance import kotlinx.datetime.Instant import java.util.Objects +import kotlin.DeprecationLevel.WARNING import kotlin.contracts.InvocationKind import kotlin.contracts.contract @@ -83,28 +84,11 @@ public interface NewsChannelBehavior : ThreadParentChannelBehavior { kord.rest.channel.followNewsChannel(id, ChannelFollowRequest(webhookChannelId = target)) } - - public suspend fun startPublicThread( - name: String, - archiveDuration: ArchiveDuration = ArchiveDuration.Day, - reason: String? = null, - builder: StartThreadWithoutMessageBuilder.() -> Unit = {} - ): NewsChannelThread { - return unsafeStartThread(name) { - this.reason = reason - this.autoArchiveDuration = archiveDuration - builder() - - type = ChannelType.PublicNewsThread - } as NewsChannelThread - } - @Deprecated( - "Replace with overloaded method.", - replaceWith = ReplaceWith("startPublicThread(name, archiveDuration, reason)"), - level = DeprecationLevel.HIDDEN + "Replaced by builder overload", + ReplaceWith("this.startPublicThread(name) {\nautoArchiveDuration = archiveDuration\nthis@startPublicThreadWithMessage.reason = reason\n}"), + level = WARNING, ) - public suspend fun startPublicThread( name: String, archiveDuration: ArchiveDuration = ArchiveDuration.Day, @@ -116,15 +100,9 @@ public interface NewsChannelBehavior : ThreadParentChannelBehavior { } } - @Deprecated( - "Replace with overloaded method.", - replaceWith = ReplaceWith("startPublicThread(name, builder = builder)"), - level = DeprecationLevel.HIDDEN - ) - public suspend fun startPublicThread( name: String, - builder: StartThreadWithoutMessageBuilder.() -> Unit = {} + builder: StartThreadWithoutMessageBuilder.() -> Unit, // TODO add empty default when overload is deprecated HIDDEN ): NewsChannelThread { return unsafeStartThread(name) { builder() @@ -133,23 +111,10 @@ public interface NewsChannelBehavior : ThreadParentChannelBehavior { } as NewsChannelThread } - - public suspend fun startPublicThreadWithMessage( - messageId: Snowflake, - name: String, - reason: String? = null, - builder: StartThreadWithMessageBuilder.() -> Unit = {} - ): NewsChannelThread { - return unsafeStartPublicThreadWithMessage(messageId, name, ) { - this.reason = reason - builder() - } as NewsChannelThread - } - @Deprecated( - "Replace with overloaded method.", - replaceWith = ReplaceWith("startPublicThreadWithMessage(messageId, name, archiveDuration, reason)"), - level = DeprecationLevel.HIDDEN + "Replaced by builder overload", + ReplaceWith("this.startPublicThreadWithMessage(messageId, name) {\nautoArchiveDuration = archiveDuration\nthis@startPublicThreadWithMessage.reason = reason\n}"), + level = WARNING, ) public suspend fun startPublicThreadWithMessage( messageId: Snowflake, @@ -163,15 +128,10 @@ public interface NewsChannelBehavior : ThreadParentChannelBehavior { } } - @Deprecated( - "Replace with overloaded method.", - replaceWith = ReplaceWith("startPublicThreadWithMessage(messageId, name, builder = builder)"), - level = DeprecationLevel.HIDDEN - ) public suspend fun startPublicThreadWithMessage( messageId: Snowflake, name: String, - builder: StartThreadWithMessageBuilder.() -> Unit = {} + builder: StartThreadWithMessageBuilder.() -> Unit, // TODO add empty default when overload is deprecated HIDDEN ): NewsChannelThread { return unsafeStartPublicThreadWithMessage(messageId, name, builder) as NewsChannelThread } diff --git a/core/src/main/kotlin/behavior/channel/TextChannelBehavior.kt b/core/src/main/kotlin/behavior/channel/TextChannelBehavior.kt index dabd8c8c7551..2916bb43ffdd 100644 --- a/core/src/main/kotlin/behavior/channel/TextChannelBehavior.kt +++ b/core/src/main/kotlin/behavior/channel/TextChannelBehavior.kt @@ -24,6 +24,7 @@ import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filterIsInstance import kotlinx.datetime.Instant import java.util.* +import kotlin.DeprecationLevel.WARNING import kotlin.contracts.InvocationKind import kotlin.contracts.contract @@ -78,15 +79,10 @@ public interface TextChannelBehavior : PrivateThreadParentChannelBehavior { builder() } } - @Deprecated( - "Replace with overloaded method.", - replaceWith = ReplaceWith("startPublicThread(name, builder = builder)"), - level = DeprecationLevel.HIDDEN - ) public suspend fun startPublicThread( name: String, - builder: StartThreadWithoutMessageBuilder.() -> Unit = {} + builder: StartThreadWithoutMessageBuilder.() -> Unit, ): TextChannelThread { return unsafeStartThread(name) { builder() @@ -107,15 +103,10 @@ public interface TextChannelBehavior : PrivateThreadParentChannelBehavior { builder() } } - @Deprecated( - "Replace with overloaded method.", - replaceWith = ReplaceWith("startPrivateThread(name, builder = builder)"), - level = DeprecationLevel.HIDDEN - ) public suspend fun startPrivateThread( name: String, - builder: StartThreadWithoutMessageBuilder.() -> Unit = {} + builder: StartThreadWithoutMessageBuilder.() -> Unit, // TODO add empty default when overload is deprecated HIDDEN ): TextChannelThread { return unsafeStartThread(name) { builder() @@ -123,21 +114,10 @@ public interface TextChannelBehavior : PrivateThreadParentChannelBehavior { } as TextChannelThread } - public suspend fun startPublicThreadWithMessage( - messageId: Snowflake, - name: String, - reason: String? = null, - builder: StartThreadWithMessageBuilder.() -> Unit = {} - ): TextChannelThread { - return unsafeStartPublicThreadWithMessage(messageId, name) { - this.reason = reason - builder() - } as TextChannelThread - } @Deprecated( - "Replace with overloaded method.", - replaceWith = ReplaceWith("startPublicThreadWithMessage(messageId, name, reason)"), - level = DeprecationLevel.HIDDEN + "Replaced by builder overload", + ReplaceWith("this.startPublicThreadWithMessage(messageId, name) { this@startPublicThreadWithMessage.reason = reason }"), + level = WARNING, ) public suspend fun startPublicThreadWithMessage( messageId: Snowflake, @@ -149,15 +129,10 @@ public interface TextChannelBehavior : PrivateThreadParentChannelBehavior { } } - @Deprecated( - "Replace with overloaded method.", - replaceWith = ReplaceWith("startPublicThreadWithMessage(messageId, name, reason, builder)"), - level = DeprecationLevel.HIDDEN - ) public suspend fun startPublicThreadWithMessage( messageId: Snowflake, name: String, - builder: StartThreadWithMessageBuilder.() -> Unit = {} + builder: StartThreadWithMessageBuilder.() -> Unit, // TODO add empty default when overload is deprecated HIDDEN ): TextChannelThread { return unsafeStartPublicThreadWithMessage(messageId, name, builder) as TextChannelThread } diff --git a/core/src/main/kotlin/behavior/channel/threads/ThreadParentChannelBehavior.kt b/core/src/main/kotlin/behavior/channel/threads/ThreadParentChannelBehavior.kt index cbc6d47cad13..0cab4209a53f 100644 --- a/core/src/main/kotlin/behavior/channel/threads/ThreadParentChannelBehavior.kt +++ b/core/src/main/kotlin/behavior/channel/threads/ThreadParentChannelBehavior.kt @@ -140,8 +140,8 @@ internal suspend fun ThreadParentChannelBehavior.unsafeStartPublicThreadWithMess name: String, builder: StartThreadWithMessageBuilder.() -> Unit = {} ): ThreadChannel { - val request = StartThreadWithMessageBuilder(name).apply(builder).toRequest() - val response = kord.rest.channel.startThreadWithMessage(id, messageId, request) + val startBuilder = StartThreadWithMessageBuilder(name).apply(builder) + val response = kord.rest.channel.startThreadWithMessage(id, messageId, startBuilder.toRequest(), startBuilder.reason) val data = ChannelData.from(response) return Channel.from(data, kord) as ThreadChannel From 319450d509f8cb42f731698e1f13250242c96a0e Mon Sep 17 00:00:00 2001 From: Lukellmann Date: Fri, 24 Mar 2023 13:35:17 +0100 Subject: [PATCH 05/42] Dump API --- core/api/core.api | 65 +++++++++++++++++------------------------------ 1 file changed, 24 insertions(+), 41 deletions(-) diff --git a/core/api/core.api b/core/api/core.api index 41bf4fd85819..6f343529c071 100644 --- a/core/api/core.api +++ b/core/api/core.api @@ -1251,12 +1251,10 @@ public abstract interface class dev/kord/core/behavior/channel/NewsChannelBehavi public abstract fun follow (Ldev/kord/common/entity/Snowflake;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public abstract fun getActiveThreads ()Lkotlinx/coroutines/flow/Flow; public abstract fun getPublicArchivedThreads (Lkotlinx/datetime/Instant;Ljava/lang/Integer;)Lkotlinx/coroutines/flow/Flow; - public abstract synthetic fun startPublicThread (Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public abstract fun startPublicThread (Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public abstract synthetic fun startPublicThread (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public abstract synthetic fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public abstract fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public abstract synthetic fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public abstract fun startPublicThread (Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public abstract fun startPublicThread (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public abstract fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public abstract fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public abstract fun withStrategy (Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/behavior/channel/NewsChannelBehavior; } @@ -1276,18 +1274,12 @@ public final class dev/kord/core/behavior/channel/NewsChannelBehavior$DefaultImp public static fun getMention (Ldev/kord/core/behavior/channel/NewsChannelBehavior;)Ljava/lang/String; public static fun getPosition (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun getPublicArchivedThreads (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Lkotlinx/datetime/Instant;Ljava/lang/Integer;)Lkotlinx/coroutines/flow/Flow; - public static synthetic fun startPublicThread (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static fun startPublicThread (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static synthetic fun startPublicThread (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static fun startPublicThread (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static fun startPublicThread (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static synthetic fun startPublicThread$default (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; - public static synthetic fun startPublicThread$default (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; - public static synthetic fun startPublicThread$default (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; - public static synthetic fun startPublicThreadWithMessage (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static fun startPublicThreadWithMessage (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static synthetic fun startPublicThreadWithMessage (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static fun startPublicThreadWithMessage (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static fun startPublicThreadWithMessage (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static synthetic fun startPublicThreadWithMessage$default (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; - public static synthetic fun startPublicThreadWithMessage$default (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; - public static synthetic fun startPublicThreadWithMessage$default (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; public static fun withStrategy (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/behavior/channel/NewsChannelBehavior; } @@ -1358,12 +1350,11 @@ public abstract interface class dev/kord/core/behavior/channel/TextChannelBehavi public abstract fun getPrivateArchivedThreads (Lkotlinx/datetime/Instant;Ljava/lang/Integer;)Lkotlinx/coroutines/flow/Flow; public abstract fun getPublicArchivedThreads (Lkotlinx/datetime/Instant;Ljava/lang/Integer;)Lkotlinx/coroutines/flow/Flow; public abstract fun startPrivateThread (Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public abstract synthetic fun startPrivateThread (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public abstract fun startPrivateThread (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public abstract fun startPublicThread (Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public abstract synthetic fun startPublicThread (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public abstract synthetic fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public abstract fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public abstract synthetic fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public abstract fun startPublicThread (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public abstract fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public abstract fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public abstract fun withStrategy (Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/behavior/channel/TextChannelBehavior; } @@ -1385,19 +1376,14 @@ public final class dev/kord/core/behavior/channel/TextChannelBehavior$DefaultImp public static fun getPrivateArchivedThreads (Ldev/kord/core/behavior/channel/TextChannelBehavior;Lkotlinx/datetime/Instant;Ljava/lang/Integer;)Lkotlinx/coroutines/flow/Flow; public static fun getPublicArchivedThreads (Ldev/kord/core/behavior/channel/TextChannelBehavior;Lkotlinx/datetime/Instant;Ljava/lang/Integer;)Lkotlinx/coroutines/flow/Flow; public static fun startPrivateThread (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static synthetic fun startPrivateThread (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static fun startPrivateThread (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static synthetic fun startPrivateThread$default (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; - public static synthetic fun startPrivateThread$default (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; public static fun startPublicThread (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static synthetic fun startPublicThread (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static fun startPublicThread (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static synthetic fun startPublicThread$default (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; - public static synthetic fun startPublicThread$default (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; - public static synthetic fun startPublicThreadWithMessage (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static fun startPublicThreadWithMessage (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static synthetic fun startPublicThreadWithMessage (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static fun startPublicThreadWithMessage (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static fun startPublicThreadWithMessage (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static synthetic fun startPublicThreadWithMessage$default (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ljava/lang/String;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; - public static synthetic fun startPublicThreadWithMessage$default (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; - public static synthetic fun startPublicThreadWithMessage$default (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; public static fun withStrategy (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/behavior/channel/TextChannelBehavior; } @@ -7989,12 +7975,10 @@ public final class dev/kord/core/entity/channel/NewsChannel : dev/kord/core/beha public fun getType ()Ldev/kord/common/entity/ChannelType; public fun getWebhooks ()Lkotlinx/coroutines/flow/Flow; public fun hashCode ()I - public synthetic fun startPublicThread (Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public fun startPublicThread (Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public synthetic fun startPublicThread (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public synthetic fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public synthetic fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun startPublicThread (Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun startPublicThread (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun toString ()Ljava/lang/String; public fun type (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun typeUntil (Lkotlin/time/TimeMark;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; @@ -8183,12 +8167,11 @@ public final class dev/kord/core/entity/channel/TextChannel : dev/kord/core/beha public fun hashCode ()I public final fun isNsfw ()Z public fun startPrivateThread (Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public synthetic fun startPrivateThread (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun startPrivateThread (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun startPublicThread (Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public synthetic fun startPublicThread (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public synthetic fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public synthetic fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun startPublicThread (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun toString ()Ljava/lang/String; public fun type (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun typeUntil (Lkotlin/time/TimeMark;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; From b5e238dfaad0d116783d7fc2ae1e829cd52a5278 Mon Sep 17 00:00:00 2001 From: Lukellmann Date: Fri, 24 Mar 2023 15:20:47 +0100 Subject: [PATCH 06/42] Fix forum incompatibilities in core NewsChannelBehavior was missing TopGuildMessageChannelBehavior as a supertype since ThreadParentChannelBehavior is no longer a TopGuildMessageChannelBehavior. TextChannelBehavior was missing TopGuildMessageChannelBehavior as a supertype since PrivateThreadParentChannelBehavior is no longer a TopGuildMessageChannelBehavior. ThreadParentChannelBehavior was extended to be a CategorizableChannelBehavior (implicating that ThreadParentChannel was als extended to be a CategorizableChannel) TextChannelBehavior's startPublicThread and startPrivateThread had an additional reason parameter added, breaking binary compatibility. The reason can be specified in the builder lambda. TextChannelBehavior.startPublicThreadWithMessage had the archiveDuration parameter removed, breaking binary compatibility. --- core/api/core.api | 79 ++++++++++++++----- .../behavior/channel/NewsChannelBehavior.kt | 10 +-- .../behavior/channel/TextChannelBehavior.kt | 28 ++++--- .../threads/ThreadParentChannelBehavior.kt | 4 +- .../entity/channel/ThreadParentChannel.kt | 18 +---- 5 files changed, 85 insertions(+), 54 deletions(-) diff --git a/core/api/core.api b/core/api/core.api index 6f343529c071..32c10e248453 100644 --- a/core/api/core.api +++ b/core/api/core.api @@ -1104,6 +1104,7 @@ public final class dev/kord/core/behavior/channel/ForumChannelBehavior$DefaultIm public static fun getGuild (Ldev/kord/core/behavior/channel/ForumChannelBehavior;)Ldev/kord/core/behavior/GuildBehavior; public static fun getGuild (Ldev/kord/core/behavior/channel/ForumChannelBehavior;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun getGuildOrNull (Ldev/kord/core/behavior/channel/ForumChannelBehavior;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static fun getInvites (Ldev/kord/core/behavior/channel/ForumChannelBehavior;)Lkotlinx/coroutines/flow/Flow; public static fun getMention (Ldev/kord/core/behavior/channel/ForumChannelBehavior;)Ljava/lang/String; public static fun getPosition (Ldev/kord/core/behavior/channel/ForumChannelBehavior;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun getPublicArchivedThreads (Ldev/kord/core/behavior/channel/ForumChannelBehavior;Lkotlinx/datetime/Instant;Ljava/lang/Integer;)Lkotlinx/coroutines/flow/Flow; @@ -1243,7 +1244,7 @@ public final class dev/kord/core/behavior/channel/MessageChannelBehaviorKt { public static final fun withTyping (Ldev/kord/core/behavior/channel/MessageChannelBehavior;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; } -public abstract interface class dev/kord/core/behavior/channel/NewsChannelBehavior : dev/kord/core/behavior/channel/threads/ThreadParentChannelBehavior { +public abstract interface class dev/kord/core/behavior/channel/NewsChannelBehavior : dev/kord/core/behavior/channel/TopGuildMessageChannelBehavior, dev/kord/core/behavior/channel/threads/ThreadParentChannelBehavior { public abstract fun asChannel (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public abstract fun asChannelOrNull (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public abstract fun fetchChannel (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; @@ -1262,8 +1263,12 @@ public final class dev/kord/core/behavior/channel/NewsChannelBehavior$DefaultImp public static fun addOverwrite (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ldev/kord/core/entity/PermissionOverwrite;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun asChannel (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun asChannelOrNull (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun bulkDelete (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ljava/lang/Iterable;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static fun bulkDelete (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ljava/lang/Iterable;ZLjava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun compareTo (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ldev/kord/core/entity/Entity;)I + public static fun createMessage (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun delete (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static fun deleteMessage (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun fetchChannel (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun fetchChannelOrNull (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun follow (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ldev/kord/common/entity/Snowflake;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; @@ -1271,15 +1276,27 @@ public final class dev/kord/core/behavior/channel/NewsChannelBehavior$DefaultImp public static fun getGuild (Ldev/kord/core/behavior/channel/NewsChannelBehavior;)Ldev/kord/core/behavior/GuildBehavior; public static fun getGuild (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun getGuildOrNull (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static fun getInvites (Ldev/kord/core/behavior/channel/NewsChannelBehavior;)Lkotlinx/coroutines/flow/Flow; public static fun getMention (Ldev/kord/core/behavior/channel/NewsChannelBehavior;)Ljava/lang/String; + public static fun getMessage (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ldev/kord/common/entity/Snowflake;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static fun getMessageOrNull (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ldev/kord/common/entity/Snowflake;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static fun getMessages (Ldev/kord/core/behavior/channel/NewsChannelBehavior;)Lkotlinx/coroutines/flow/Flow; + public static fun getMessagesAfter (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/Integer;)Lkotlinx/coroutines/flow/Flow; + public static fun getMessagesAround (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ldev/kord/common/entity/Snowflake;I)Lkotlinx/coroutines/flow/Flow; + public static fun getMessagesBefore (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/Integer;)Lkotlinx/coroutines/flow/Flow; + public static fun getPinnedMessages (Ldev/kord/core/behavior/channel/NewsChannelBehavior;)Lkotlinx/coroutines/flow/Flow; public static fun getPosition (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun getPublicArchivedThreads (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Lkotlinx/datetime/Instant;Ljava/lang/Integer;)Lkotlinx/coroutines/flow/Flow; + public static fun getWebhooks (Ldev/kord/core/behavior/channel/NewsChannelBehavior;)Lkotlinx/coroutines/flow/Flow; public static fun startPublicThread (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun startPublicThread (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static synthetic fun startPublicThread$default (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; public static fun startPublicThreadWithMessage (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun startPublicThreadWithMessage (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static synthetic fun startPublicThreadWithMessage$default (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static fun type (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static fun typeUntil (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Lkotlin/time/TimeMark;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static fun typeUntil (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Lkotlinx/datetime/Instant;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun withStrategy (Ldev/kord/core/behavior/channel/NewsChannelBehavior;Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/behavior/channel/NewsChannelBehavior; } @@ -1340,7 +1357,7 @@ public final class dev/kord/core/behavior/channel/StageChannelBehaviorKt { public static final fun editVoiceState (Ldev/kord/core/behavior/channel/StageChannelBehavior;Ldev/kord/common/entity/Snowflake;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; } -public abstract interface class dev/kord/core/behavior/channel/TextChannelBehavior : dev/kord/core/behavior/channel/threads/PrivateThreadParentChannelBehavior { +public abstract interface class dev/kord/core/behavior/channel/TextChannelBehavior : dev/kord/core/behavior/channel/TopGuildMessageChannelBehavior, dev/kord/core/behavior/channel/threads/PrivateThreadParentChannelBehavior { public abstract fun asChannel (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public abstract fun asChannelOrNull (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public abstract fun fetchChannel (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; @@ -1349,11 +1366,11 @@ public abstract interface class dev/kord/core/behavior/channel/TextChannelBehavi public abstract fun getJoinedPrivateArchivedThreads (Ldev/kord/common/entity/Snowflake;Ljava/lang/Integer;)Lkotlinx/coroutines/flow/Flow; public abstract fun getPrivateArchivedThreads (Lkotlinx/datetime/Instant;Ljava/lang/Integer;)Lkotlinx/coroutines/flow/Flow; public abstract fun getPublicArchivedThreads (Lkotlinx/datetime/Instant;Ljava/lang/Integer;)Lkotlinx/coroutines/flow/Flow; - public abstract fun startPrivateThread (Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public abstract fun startPrivateThread (Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public abstract fun startPrivateThread (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public abstract fun startPublicThread (Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public abstract fun startPublicThread (Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public abstract fun startPublicThread (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public abstract fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public abstract fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public abstract fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public abstract fun withStrategy (Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/behavior/channel/TextChannelBehavior; } @@ -1362,28 +1379,44 @@ public final class dev/kord/core/behavior/channel/TextChannelBehavior$DefaultImp public static fun addOverwrite (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ldev/kord/core/entity/PermissionOverwrite;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun asChannel (Ldev/kord/core/behavior/channel/TextChannelBehavior;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun asChannelOrNull (Ldev/kord/core/behavior/channel/TextChannelBehavior;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun bulkDelete (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ljava/lang/Iterable;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static fun bulkDelete (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ljava/lang/Iterable;ZLjava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun compareTo (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ldev/kord/core/entity/Entity;)I + public static fun createMessage (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun delete (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static fun deleteMessage (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun fetchChannel (Ldev/kord/core/behavior/channel/TextChannelBehavior;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun fetchChannelOrNull (Ldev/kord/core/behavior/channel/TextChannelBehavior;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun getActiveThreads (Ldev/kord/core/behavior/channel/TextChannelBehavior;)Lkotlinx/coroutines/flow/Flow; public static fun getGuild (Ldev/kord/core/behavior/channel/TextChannelBehavior;)Ldev/kord/core/behavior/GuildBehavior; public static fun getGuild (Ldev/kord/core/behavior/channel/TextChannelBehavior;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun getGuildOrNull (Ldev/kord/core/behavior/channel/TextChannelBehavior;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static fun getInvites (Ldev/kord/core/behavior/channel/TextChannelBehavior;)Lkotlinx/coroutines/flow/Flow; public static fun getJoinedPrivateArchivedThreads (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/Integer;)Lkotlinx/coroutines/flow/Flow; public static fun getMention (Ldev/kord/core/behavior/channel/TextChannelBehavior;)Ljava/lang/String; + public static fun getMessage (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ldev/kord/common/entity/Snowflake;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static fun getMessageOrNull (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ldev/kord/common/entity/Snowflake;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static fun getMessages (Ldev/kord/core/behavior/channel/TextChannelBehavior;)Lkotlinx/coroutines/flow/Flow; + public static fun getMessagesAfter (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/Integer;)Lkotlinx/coroutines/flow/Flow; + public static fun getMessagesAround (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ldev/kord/common/entity/Snowflake;I)Lkotlinx/coroutines/flow/Flow; + public static fun getMessagesBefore (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/Integer;)Lkotlinx/coroutines/flow/Flow; + public static fun getPinnedMessages (Ldev/kord/core/behavior/channel/TextChannelBehavior;)Lkotlinx/coroutines/flow/Flow; public static fun getPosition (Ldev/kord/core/behavior/channel/TextChannelBehavior;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun getPrivateArchivedThreads (Ldev/kord/core/behavior/channel/TextChannelBehavior;Lkotlinx/datetime/Instant;Ljava/lang/Integer;)Lkotlinx/coroutines/flow/Flow; public static fun getPublicArchivedThreads (Ldev/kord/core/behavior/channel/TextChannelBehavior;Lkotlinx/datetime/Instant;Ljava/lang/Integer;)Lkotlinx/coroutines/flow/Flow; - public static fun startPrivateThread (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static fun getWebhooks (Ldev/kord/core/behavior/channel/TextChannelBehavior;)Lkotlinx/coroutines/flow/Flow; + public static fun startPrivateThread (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun startPrivateThread (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static synthetic fun startPrivateThread$default (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; - public static fun startPublicThread (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun startPrivateThread$default (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static fun startPublicThread (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun startPublicThread (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static synthetic fun startPublicThread$default (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; - public static fun startPublicThreadWithMessage (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun startPublicThread$default (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static fun startPublicThreadWithMessage (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun startPublicThreadWithMessage (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static synthetic fun startPublicThreadWithMessage$default (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ljava/lang/String;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static synthetic fun startPublicThreadWithMessage$default (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static fun type (Ldev/kord/core/behavior/channel/TextChannelBehavior;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static fun typeUntil (Ldev/kord/core/behavior/channel/TextChannelBehavior;Lkotlin/time/TimeMark;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static fun typeUntil (Ldev/kord/core/behavior/channel/TextChannelBehavior;Lkotlinx/datetime/Instant;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun withStrategy (Ldev/kord/core/behavior/channel/TextChannelBehavior;Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/behavior/channel/TextChannelBehavior; } @@ -1535,6 +1568,7 @@ public final class dev/kord/core/behavior/channel/threads/PrivateThreadParentCha public static fun getGuild (Ldev/kord/core/behavior/channel/threads/PrivateThreadParentChannelBehavior;)Ldev/kord/core/behavior/GuildBehavior; public static fun getGuild (Ldev/kord/core/behavior/channel/threads/PrivateThreadParentChannelBehavior;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun getGuildOrNull (Ldev/kord/core/behavior/channel/threads/PrivateThreadParentChannelBehavior;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static fun getInvites (Ldev/kord/core/behavior/channel/threads/PrivateThreadParentChannelBehavior;)Lkotlinx/coroutines/flow/Flow; public static fun getJoinedPrivateArchivedThreads (Ldev/kord/core/behavior/channel/threads/PrivateThreadParentChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/Integer;)Lkotlinx/coroutines/flow/Flow; public static synthetic fun getJoinedPrivateArchivedThreads$default (Ldev/kord/core/behavior/channel/threads/PrivateThreadParentChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/Integer;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow; public static fun getMention (Ldev/kord/core/behavior/channel/threads/PrivateThreadParentChannelBehavior;)Ljava/lang/String; @@ -1600,7 +1634,7 @@ public final class dev/kord/core/behavior/channel/threads/ThreadChannelBehaviorK public static final fun edit (Ldev/kord/core/behavior/channel/threads/ThreadChannelBehavior;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; } -public abstract interface class dev/kord/core/behavior/channel/threads/ThreadParentChannelBehavior : dev/kord/core/behavior/channel/TopGuildChannelBehavior { +public abstract interface class dev/kord/core/behavior/channel/threads/ThreadParentChannelBehavior : dev/kord/core/behavior/channel/CategorizableChannelBehavior { public abstract fun asChannel (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public abstract fun asChannelOrNull (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public abstract fun fetchChannel (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; @@ -1622,6 +1656,7 @@ public final class dev/kord/core/behavior/channel/threads/ThreadParentChannelBeh public static fun getGuild (Ldev/kord/core/behavior/channel/threads/ThreadParentChannelBehavior;)Ldev/kord/core/behavior/GuildBehavior; public static fun getGuild (Ldev/kord/core/behavior/channel/threads/ThreadParentChannelBehavior;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun getGuildOrNull (Ldev/kord/core/behavior/channel/threads/ThreadParentChannelBehavior;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static fun getInvites (Ldev/kord/core/behavior/channel/threads/ThreadParentChannelBehavior;)Lkotlinx/coroutines/flow/Flow; public static fun getMention (Ldev/kord/core/behavior/channel/threads/ThreadParentChannelBehavior;)Ljava/lang/String; public static fun getPosition (Ldev/kord/core/behavior/channel/threads/ThreadParentChannelBehavior;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun getPublicArchivedThreads (Ldev/kord/core/behavior/channel/threads/ThreadParentChannelBehavior;Lkotlinx/datetime/Instant;Ljava/lang/Integer;)Lkotlinx/coroutines/flow/Flow; @@ -7783,6 +7818,8 @@ public final class dev/kord/core/entity/channel/ForumChannel : dev/kord/core/beh public fun fetchChannelOrNull (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun getActiveThreads ()Lkotlinx/coroutines/flow/Flow; public final fun getAvailableTags ()Ljava/util/List; + public fun getCategory ()Ldev/kord/core/behavior/channel/CategoryBehavior; + public fun getCategoryId ()Ldev/kord/common/entity/Snowflake; public fun getData ()Ldev/kord/core/cache/data/ChannelData; public final fun getDefaultForumLayout ()Ldev/kord/common/entity/ForumLayoutType; public final fun getDefaultReactionEmoji ()Ldev/kord/common/entity/DiscordDefaultReaction; @@ -7794,6 +7831,7 @@ public final class dev/kord/core/entity/channel/ForumChannel : dev/kord/core/beh public fun getGuildId ()Ldev/kord/common/entity/Snowflake; public fun getGuildOrNull (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun getId ()Ldev/kord/common/entity/Snowflake; + public fun getInvites ()Lkotlinx/coroutines/flow/Flow; public fun getKord ()Ldev/kord/core/Kord; public fun getMention ()Ljava/lang/String; public fun getName ()Ljava/lang/String; @@ -7808,11 +7846,13 @@ public final class dev/kord/core/entity/channel/ForumChannel : dev/kord/core/beh public fun getType ()Ldev/kord/common/entity/ChannelType; public fun startPublicThread (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun toString ()Ljava/lang/String; + public synthetic fun withStrategy (Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/behavior/channel/CategorizableChannelBehavior; public synthetic fun withStrategy (Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/behavior/channel/ChannelBehavior; public synthetic fun withStrategy (Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/behavior/channel/GuildChannelBehavior; public synthetic fun withStrategy (Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/behavior/channel/TopGuildChannelBehavior; public synthetic fun withStrategy (Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/behavior/channel/threads/ThreadParentChannelBehavior; public synthetic fun withStrategy (Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/entity/Strategizable; + public synthetic fun withStrategy (Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/entity/channel/CategorizableChannel; public synthetic fun withStrategy (Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/entity/channel/Channel; public fun withStrategy (Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/entity/channel/ForumChannel; public synthetic fun withStrategy (Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/entity/channel/GuildChannel; @@ -8166,11 +8206,11 @@ public final class dev/kord/core/entity/channel/TextChannel : dev/kord/core/beha public fun getWebhooks ()Lkotlinx/coroutines/flow/Flow; public fun hashCode ()I public final fun isNsfw ()Z - public fun startPrivateThread (Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun startPrivateThread (Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun startPrivateThread (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public fun startPublicThread (Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun startPublicThread (Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun startPublicThread (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun startPublicThreadWithMessage (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun toString ()Ljava/lang/String; public fun type (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; @@ -8197,11 +8237,7 @@ public final class dev/kord/core/entity/channel/TextChannel : dev/kord/core/beha public synthetic fun withStrategy (Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/entity/channel/TopGuildMessageChannel; } -public abstract interface class dev/kord/core/entity/channel/ThreadParentChannel : dev/kord/core/behavior/channel/threads/ThreadParentChannelBehavior, dev/kord/core/entity/channel/TopGuildChannel { - public abstract fun asChannel (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public abstract fun asChannelOrNull (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public abstract fun fetchChannel (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public abstract fun fetchChannelOrNull (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; +public abstract interface class dev/kord/core/entity/channel/ThreadParentChannel : dev/kord/core/behavior/channel/threads/ThreadParentChannelBehavior, dev/kord/core/entity/channel/CategorizableChannel { public abstract fun withStrategy (Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/entity/channel/ThreadParentChannel; } @@ -8214,6 +8250,8 @@ public final class dev/kord/core/entity/channel/ThreadParentChannel$DefaultImpls public static fun fetchChannel (Ldev/kord/core/entity/channel/ThreadParentChannel;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun fetchChannelOrNull (Ldev/kord/core/entity/channel/ThreadParentChannel;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun getActiveThreads (Ldev/kord/core/entity/channel/ThreadParentChannel;)Lkotlinx/coroutines/flow/Flow; + public static fun getCategory (Ldev/kord/core/entity/channel/ThreadParentChannel;)Ldev/kord/core/behavior/channel/CategoryBehavior; + public static fun getCategoryId (Ldev/kord/core/entity/channel/ThreadParentChannel;)Ldev/kord/common/entity/Snowflake; public static fun getEffectivePermissions (Ldev/kord/core/entity/channel/ThreadParentChannel;Ldev/kord/common/entity/Snowflake;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun getFlags (Ldev/kord/core/entity/channel/ThreadParentChannel;)Ldev/kord/common/entity/ChannelFlags; public static fun getGuild (Ldev/kord/core/entity/channel/ThreadParentChannel;)Ldev/kord/core/behavior/GuildBehavior; @@ -8221,6 +8259,7 @@ public final class dev/kord/core/entity/channel/ThreadParentChannel$DefaultImpls public static fun getGuildId (Ldev/kord/core/entity/channel/ThreadParentChannel;)Ldev/kord/common/entity/Snowflake; public static fun getGuildOrNull (Ldev/kord/core/entity/channel/ThreadParentChannel;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun getId (Ldev/kord/core/entity/channel/ThreadParentChannel;)Ldev/kord/common/entity/Snowflake; + public static fun getInvites (Ldev/kord/core/entity/channel/ThreadParentChannel;)Lkotlinx/coroutines/flow/Flow; public static fun getMention (Ldev/kord/core/entity/channel/ThreadParentChannel;)Ljava/lang/String; public static fun getName (Ldev/kord/core/entity/channel/ThreadParentChannel;)Ljava/lang/String; public static fun getPermissionOverwrites (Ldev/kord/core/entity/channel/ThreadParentChannel;)Ljava/util/Set; diff --git a/core/src/main/kotlin/behavior/channel/NewsChannelBehavior.kt b/core/src/main/kotlin/behavior/channel/NewsChannelBehavior.kt index 3d9ba48a3477..7d2ae5e9a698 100644 --- a/core/src/main/kotlin/behavior/channel/NewsChannelBehavior.kt +++ b/core/src/main/kotlin/behavior/channel/NewsChannelBehavior.kt @@ -33,7 +33,7 @@ import kotlin.contracts.contract /** * The behavior of a Discord News Channel associated to a guild. */ -public interface NewsChannelBehavior : ThreadParentChannelBehavior { +public interface NewsChannelBehavior : TopGuildMessageChannelBehavior, ThreadParentChannelBehavior { override val activeThreads: Flow get() = super.activeThreads.filterIsInstance() @@ -45,7 +45,7 @@ public interface NewsChannelBehavior : ThreadParentChannelBehavior { * @throws [EntityNotFoundException] if the channel wasn't present. * @throws [ClassCastException] if the channel isn't a [NewsChannel]. */ - override suspend fun asChannel(): NewsChannel = super.asChannel() as NewsChannel + override suspend fun asChannel(): NewsChannel = super.asChannel() as NewsChannel /** * Requests to get this behavior as a [NewsChannel], @@ -53,7 +53,7 @@ public interface NewsChannelBehavior : ThreadParentChannelBehavior { * * @throws [RequestException] if something went wrong during the request. */ - override suspend fun asChannelOrNull(): NewsChannel? = super.asChannelOrNull() as? NewsChannel + override suspend fun asChannelOrNull(): NewsChannel? = super.asChannelOrNull() as? NewsChannel /** * Retrieve the [NewsChannel] associated with this behaviour from the provided [EntitySupplier] @@ -61,7 +61,7 @@ public interface NewsChannelBehavior : ThreadParentChannelBehavior { * @throws [RequestException] if anything went wrong during the request. * @throws [EntityNotFoundException] if the user wasn't present. */ - override suspend fun fetchChannel(): NewsChannel = super.fetchChannel() as NewsChannel + override suspend fun fetchChannel(): NewsChannel = super.fetchChannel() as NewsChannel /** @@ -70,7 +70,7 @@ public interface NewsChannelBehavior : ThreadParentChannelBehavior { * * @throws [RequestException] if anything went wrong during the request. */ - override suspend fun fetchChannelOrNull(): NewsChannel? = super.fetchChannelOrNull() as? NewsChannel + override suspend fun fetchChannelOrNull(): NewsChannel? = super.fetchChannelOrNull() as? NewsChannel /** diff --git a/core/src/main/kotlin/behavior/channel/TextChannelBehavior.kt b/core/src/main/kotlin/behavior/channel/TextChannelBehavior.kt index 2916bb43ffdd..0c137cccbeb3 100644 --- a/core/src/main/kotlin/behavior/channel/TextChannelBehavior.kt +++ b/core/src/main/kotlin/behavior/channel/TextChannelBehavior.kt @@ -28,7 +28,7 @@ import kotlin.DeprecationLevel.WARNING import kotlin.contracts.InvocationKind import kotlin.contracts.contract -public interface TextChannelBehavior : PrivateThreadParentChannelBehavior { +public interface TextChannelBehavior : TopGuildMessageChannelBehavior, PrivateThreadParentChannelBehavior { override val activeThreads: Flow get() = super.activeThreads.filterIsInstance() @@ -40,7 +40,7 @@ public interface TextChannelBehavior : PrivateThreadParentChannelBehavior { * @throws [EntityNotFoundException] if the channel wasn't present. * @throws [ClassCastException] if the channel isn't a [TextChannel]. */ - override suspend fun asChannel(): TextChannel = super.asChannel() as TextChannel + override suspend fun asChannel(): TextChannel = super.asChannel() as TextChannel /** * Requests to get this behavior as a [TextChannel], @@ -48,7 +48,7 @@ public interface TextChannelBehavior : PrivateThreadParentChannelBehavior { * * @throws [RequestException] if anything went wrong during the request. */ - override suspend fun asChannelOrNull(): TextChannel? = super.asChannelOrNull() as? TextChannel + override suspend fun asChannelOrNull(): TextChannel? = super.asChannelOrNull() as? TextChannel /** * Retrieve the [TextChannel] associated with this behaviour from the provided [EntitySupplier] @@ -56,7 +56,7 @@ public interface TextChannelBehavior : PrivateThreadParentChannelBehavior { * @throws [RequestException] if anything went wrong during the request. * @throws [EntityNotFoundException] if the user wasn't present. */ - override suspend fun fetchChannel(): TextChannel = super.fetchChannel() as TextChannel + override suspend fun fetchChannel(): TextChannel = super.fetchChannel() as TextChannel /** @@ -65,16 +65,19 @@ public interface TextChannelBehavior : PrivateThreadParentChannelBehavior { * * @throws [RequestException] if anything went wrong during the request. */ - override suspend fun fetchChannelOrNull(): TextChannel? = super.fetchChannelOrNull() as? TextChannel + override suspend fun fetchChannelOrNull(): TextChannel? = super.fetchChannelOrNull() as? TextChannel + @Deprecated( + "Replaced by overload with autoArchiveDuration in builder lambda", + ReplaceWith("this.startPublicThread(name) {\nautoArchiveDuration = archiveDuration\nbuilder()\n}"), + level = WARNING, + ) public suspend fun startPublicThread( name: String, archiveDuration: ArchiveDuration = ArchiveDuration.Day, - reason: String? = null, builder: StartThreadWithoutMessageBuilder.() -> Unit = {} ): TextChannelThread { return startPublicThread(name) { - this.reason = reason this.autoArchiveDuration = archiveDuration builder() } @@ -91,14 +94,17 @@ public interface TextChannelBehavior : PrivateThreadParentChannelBehavior { } as TextChannelThread } + @Deprecated( + "Replaced by overload with autoArchiveDuration in builder lambda", + ReplaceWith("this.startPrivateThread(name) {\nautoArchiveDuration = archiveDuration\nbuilder()\n}"), + level = WARNING, + ) public suspend fun startPrivateThread( name: String, archiveDuration: ArchiveDuration = ArchiveDuration.Day, - reason: String? = null, builder: StartThreadWithoutMessageBuilder.() -> Unit = {} ): TextChannelThread { return startPrivateThread(name) { - this.reason = reason this.autoArchiveDuration = archiveDuration builder() } @@ -116,15 +122,17 @@ public interface TextChannelBehavior : PrivateThreadParentChannelBehavior { @Deprecated( "Replaced by builder overload", - ReplaceWith("this.startPublicThreadWithMessage(messageId, name) { this@startPublicThreadWithMessage.reason = reason }"), + ReplaceWith("this.startPublicThreadWithMessage(messageId, name) {\nautoArchiveDuration = archiveDuration\nthis@startPublicThreadWithMessage.reason = reason\n}"), level = WARNING, ) public suspend fun startPublicThreadWithMessage( messageId: Snowflake, name: String, + archiveDuration: ArchiveDuration = ArchiveDuration.Day, reason: String? = null ): TextChannelThread { return startPublicThreadWithMessage(messageId, name) { + this.autoArchiveDuration = archiveDuration this.reason = reason } } diff --git a/core/src/main/kotlin/behavior/channel/threads/ThreadParentChannelBehavior.kt b/core/src/main/kotlin/behavior/channel/threads/ThreadParentChannelBehavior.kt index 0cab4209a53f..76461fda46e4 100644 --- a/core/src/main/kotlin/behavior/channel/threads/ThreadParentChannelBehavior.kt +++ b/core/src/main/kotlin/behavior/channel/threads/ThreadParentChannelBehavior.kt @@ -3,9 +3,9 @@ package dev.kord.core.behavior.channel.threads import dev.kord.common.entity.Snowflake import dev.kord.common.exception.RequestException import dev.kord.core.Kord +import dev.kord.core.behavior.channel.CategorizableChannelBehavior import dev.kord.core.behavior.channel.ChannelBehavior import dev.kord.core.behavior.channel.GuildChannelBehavior -import dev.kord.core.behavior.channel.TopGuildChannelBehavior import dev.kord.core.cache.data.ChannelData import dev.kord.core.entity.channel.Channel import dev.kord.core.entity.channel.ThreadParentChannel @@ -23,7 +23,7 @@ import java.util.* /** * Behavior of channels that can contain public threads. */ -public interface ThreadParentChannelBehavior : TopGuildChannelBehavior { +public interface ThreadParentChannelBehavior : CategorizableChannelBehavior { /** * Returns all active public and private threads in the channel. * Threads are ordered by their id, in descending order. diff --git a/core/src/main/kotlin/entity/channel/ThreadParentChannel.kt b/core/src/main/kotlin/entity/channel/ThreadParentChannel.kt index 8f3bd89e1da6..e777c0d23cbb 100644 --- a/core/src/main/kotlin/entity/channel/ThreadParentChannel.kt +++ b/core/src/main/kotlin/entity/channel/ThreadParentChannel.kt @@ -3,22 +3,6 @@ package dev.kord.core.entity.channel import dev.kord.core.behavior.channel.threads.ThreadParentChannelBehavior import dev.kord.core.supplier.EntitySupplyStrategy -public interface ThreadParentChannel : ThreadParentChannelBehavior, TopGuildChannel { - override suspend fun asChannel(): ThreadParentChannel { - return super.asChannel() - } - - override suspend fun asChannelOrNull(): ThreadParentChannel? { - return super.asChannelOrNull() - } - - override suspend fun fetchChannel(): ThreadParentChannel { - return super.fetchChannel() - } - - override suspend fun fetchChannelOrNull(): ThreadParentChannel? { - return super.fetchChannelOrNull() - } - +public interface ThreadParentChannel : ThreadParentChannelBehavior, CategorizableChannel { override fun withStrategy(strategy: EntitySupplyStrategy<*>): ThreadParentChannel } From 129847d832847e1622fa804b314bcb27ed3c3e7e Mon Sep 17 00:00:00 2001 From: Lukellmann Date: Fri, 24 Mar 2023 15:23:19 +0100 Subject: [PATCH 07/42] Fix integration issues in core There was binary incompatibility in Integration and missing Optional default values in IntegrationData. --- core/api/core.api | 2 ++ .../main/kotlin/cache/data/IntegrationData.kt | 18 +++++++++--------- core/src/main/kotlin/entity/Integration.kt | 12 ++++++++++-- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/core/api/core.api b/core/api/core.api index 32c10e248453..6212cc5b917b 100644 --- a/core/api/core.api +++ b/core/api/core.api @@ -6371,6 +6371,7 @@ public final class dev/kord/core/entity/Integration : dev/kord/core/entity/KordE public final fun getEnablesEmoticons ()Z public final fun getExpireBehavior ()Ldev/kord/common/entity/IntegrationExpireBehavior; public final fun getExpireGracePeriod-FghU774 ()Lkotlin/time/Duration; + public final synthetic fun getExpireGracePeriod-UwyO8pc ()J public final fun getGuild ()Ldev/kord/core/behavior/GuildBehavior; public final fun getGuild (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public final fun getGuildId ()Ldev/kord/common/entity/Snowflake; @@ -6390,6 +6391,7 @@ public final class dev/kord/core/entity/Integration : dev/kord/core/entity/KordE public fun hashCode ()I public final fun isEnabled ()Z public final fun isSyncing ()Ljava/lang/Boolean; + public final synthetic fun isSyncing ()Z public final fun sync (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun toString ()Ljava/lang/String; public fun withStrategy (Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/entity/Integration; diff --git a/core/src/main/kotlin/cache/data/IntegrationData.kt b/core/src/main/kotlin/cache/data/IntegrationData.kt index 2506dc97792d..c3d43c104147 100644 --- a/core/src/main/kotlin/cache/data/IntegrationData.kt +++ b/core/src/main/kotlin/cache/data/IntegrationData.kt @@ -16,17 +16,17 @@ public data class IntegrationData( val name: String, val type: String, val enabled: Boolean, - val syncing: OptionalBoolean, - val roleId: OptionalSnowflake, + val syncing: OptionalBoolean = OptionalBoolean.Missing, + val roleId: OptionalSnowflake = OptionalSnowflake.Missing, val enableEmoticons: OptionalBoolean = OptionalBoolean.Missing, - val expireBehavior: Optional, - val expireGracePeriod: Optional, - val user: Optional, + val expireBehavior: Optional = Optional.Missing(), + val expireGracePeriod: Optional = Optional.Missing(), + val user: Optional = Optional.Missing(), val account: IntegrationsAccountData, - val syncedAt: Optional, - val subscriberCount: OptionalInt, - val revoked: OptionalBoolean, - val application: Optional, + val syncedAt: Optional = Optional.Missing(), + val subscriberCount: OptionalInt = OptionalInt.Missing, + val revoked: OptionalBoolean = OptionalBoolean.Missing, + val application: Optional = Optional.Missing(), ) { public companion object { diff --git a/core/src/main/kotlin/entity/Integration.kt b/core/src/main/kotlin/entity/Integration.kt index 02afff456b76..8facaf2cc94b 100644 --- a/core/src/main/kotlin/entity/Integration.kt +++ b/core/src/main/kotlin/entity/Integration.kt @@ -4,7 +4,6 @@ import dev.kord.common.entity.IntegrationExpireBehavior import dev.kord.common.entity.Snowflake import dev.kord.common.entity.optional.value import dev.kord.common.exception.RequestException -import dev.kord.common.serialization.DurationInDays import dev.kord.core.Kord import dev.kord.core.behavior.GuildBehavior import dev.kord.core.behavior.RoleBehavior @@ -17,8 +16,10 @@ import dev.kord.rest.builder.integration.IntegrationModifyBuilder import dev.kord.rest.request.RestRequestException import kotlinx.datetime.Instant import java.util.* +import kotlin.DeprecationLevel.HIDDEN import kotlin.contracts.InvocationKind import kotlin.contracts.contract +import kotlin.time.Duration /** * A [Discord integration](https://discord.com/developers/docs/resources/guild#get-guild-integrations). @@ -50,6 +51,9 @@ public class Integration( public val isEnabled: Boolean get() = data.enabled + @Deprecated("Binary compatibility, was non-nullable before. Keep for some releases.", level = HIDDEN) + public fun isSyncing(): Boolean = isSyncing!! + /** * Whether this integrations is syncing. */ @@ -93,10 +97,14 @@ public class Integration( public val expireBehavior: IntegrationExpireBehavior? get() = data.expireBehavior.value + @Deprecated("Binary compatibility, was non-nullable before. Keep for some releases.", level = HIDDEN) + @JvmName("getExpireGracePeriod-UwyO8pc") + public fun expireGracePeriod0(): Duration = expireGracePeriod!! + /** * The grace period before expiring subscribers. */ - public val expireGracePeriod: DurationInDays? get() = data.expireGracePeriod.value + public val expireGracePeriod: Duration? get() = data.expireGracePeriod.value /** * The id of the [user][User] for this integration. From b9fe4cb1f115d3bd210af4134451680c8a693d70 Mon Sep 17 00:00:00 2001 From: Lukellmann Date: Fri, 24 Mar 2023 15:46:00 +0100 Subject: [PATCH 08/42] Fix test --- core/src/test/kotlin/rest/RestTest.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/test/kotlin/rest/RestTest.kt b/core/src/test/kotlin/rest/RestTest.kt index 1bda36fce985..17de2bbd1dd7 100644 --- a/core/src/test/kotlin/rest/RestTest.kt +++ b/core/src/test/kotlin/rest/RestTest.kt @@ -500,14 +500,14 @@ class RestServiceTest { @Disabled("Requires Community Guild") fun `create thread`() = runBlocking { - val publicThread = channel.startPublicThread("TEST THREAD") + val publicThread = channel.startPublicThread("TEST THREAD") {} val active = channel.activeThreads assertEquals(false, publicThread.isPrivate) assertTrue(active.toList().isNotEmpty()) publicThread.join() - val privateThread = channel.startPrivateThread("TEST PRIVATE THREAD") + val privateThread = channel.startPrivateThread("TEST PRIVATE THREAD") {} privateThread.join() From 4cc03971acb304d77f51f35fde69d889448e3155 Mon Sep 17 00:00:00 2001 From: Lukellmann Date: Fri, 24 Mar 2023 16:05:48 +0100 Subject: [PATCH 09/42] Remove unnecessary overrides --- core/src/main/kotlin/entity/channel/NewsChannel.kt | 7 ------- core/src/main/kotlin/entity/channel/TextChannel.kt | 7 ------- 2 files changed, 14 deletions(-) diff --git a/core/src/main/kotlin/entity/channel/NewsChannel.kt b/core/src/main/kotlin/entity/channel/NewsChannel.kt index 61bbb0116a6c..187e6e9ffdba 100644 --- a/core/src/main/kotlin/entity/channel/NewsChannel.kt +++ b/core/src/main/kotlin/entity/channel/NewsChannel.kt @@ -29,13 +29,6 @@ public class NewsChannel( override suspend fun asChannel(): NewsChannel = this override suspend fun asChannelOrNull(): NewsChannel = this - override suspend fun fetchChannel(): NewsChannel { - return super.fetchChannel() - } - - override suspend fun fetchChannelOrNull(): NewsChannel? { - return super.fetchChannelOrNull() - } /** * Returns a new [NewsChannel] with the given [strategy]. diff --git a/core/src/main/kotlin/entity/channel/TextChannel.kt b/core/src/main/kotlin/entity/channel/TextChannel.kt index 8aa3a3996087..4ef2c449fdf6 100644 --- a/core/src/main/kotlin/entity/channel/TextChannel.kt +++ b/core/src/main/kotlin/entity/channel/TextChannel.kt @@ -44,13 +44,6 @@ public class TextChannel( override suspend fun asChannel(): TextChannel = this override suspend fun asChannelOrNull(): TextChannel = this - override suspend fun fetchChannel(): TextChannel { - return super.fetchChannel() - } - - override suspend fun fetchChannelOrNull(): TextChannel? { - return super.fetchChannelOrNull() - } override fun hashCode(): Int = Objects.hash(id, guildId) From 695026549eca56f61e008048bedc04c0b240b262 Mon Sep 17 00:00:00 2001 From: Lukellmann Date: Fri, 24 Mar 2023 18:38:30 +0100 Subject: [PATCH 10/42] Emit ForumChannel events Before ForumChannels would take the else path resulting in UnknownChannel events. --- core/src/main/kotlin/gateway/handler/ChannelEventHandler.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/src/main/kotlin/gateway/handler/ChannelEventHandler.kt b/core/src/main/kotlin/gateway/handler/ChannelEventHandler.kt index ff74515733cf..1b742762f725 100644 --- a/core/src/main/kotlin/gateway/handler/ChannelEventHandler.kt +++ b/core/src/main/kotlin/gateway/handler/ChannelEventHandler.kt @@ -41,6 +41,7 @@ internal class ChannelEventHandler : BaseGatewayEventHandler() { is StageChannel -> StageChannelCreateEvent(channel, shard, context?.get()) is VoiceChannel -> VoiceChannelCreateEvent(channel, shard, context?.get()) is Category -> CategoryCreateEvent(channel, shard, context?.get()) + is ForumChannel -> ForumChannelCreateEvent(channel, shard, context?.get()) is ThreadChannel -> return null else -> UnknownChannelCreateEvent(channel, shard, context?.get()) @@ -61,6 +62,7 @@ internal class ChannelEventHandler : BaseGatewayEventHandler() { is StageChannel -> StageChannelUpdateEvent(channel, old as? StageChannel, shard, context?.get()) is VoiceChannel -> VoiceChannelUpdateEvent(channel, old as? VoiceChannel, shard, context?.get()) is Category -> CategoryUpdateEvent(channel, old as? Category, shard, context?.get()) + is ForumChannel -> ForumChannelUpdateEvent(channel, old as? ForumChannel, shard, context?.get()) is ThreadChannel -> return null else -> UnknownChannelUpdateEvent(channel, old, shard, context?.get()) @@ -80,6 +82,7 @@ internal class ChannelEventHandler : BaseGatewayEventHandler() { is StageChannel -> StageChannelDeleteEvent(channel, shard, context?.get()) is VoiceChannel -> VoiceChannelDeleteEvent(channel, shard, context?.get()) is Category -> CategoryDeleteEvent(channel, shard, context?.get()) + is ForumChannel -> ForumChannelDeleteEvent(channel, shard, context?.get()) is ThreadChannel -> return null else -> UnknownChannelDeleteEvent(channel, shard, context?.get()) } From bbb839757cab61f9d4858238ec349e8b880a07ed Mon Sep 17 00:00:00 2001 From: Lukellmann Date: Fri, 24 Mar 2023 18:42:04 +0100 Subject: [PATCH 11/42] Fix nullability of some fields --- .../builder/channel/EditGuildChannelBuilder.kt | 3 +-- .../channel/thread/StartForumThreadBuilder.kt | 2 +- .../main/kotlin/json/request/ChannelRequests.kt | 14 +++++++------- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/rest/src/main/kotlin/builder/channel/EditGuildChannelBuilder.kt b/rest/src/main/kotlin/builder/channel/EditGuildChannelBuilder.kt index 1370e5419e0c..3936a8c8369b 100644 --- a/rest/src/main/kotlin/builder/channel/EditGuildChannelBuilder.kt +++ b/rest/src/main/kotlin/builder/channel/EditGuildChannelBuilder.kt @@ -5,7 +5,6 @@ import dev.kord.common.entity.* import dev.kord.common.entity.optional.* import dev.kord.common.entity.optional.delegate.delegate import dev.kord.rest.builder.AuditRequestBuilder -import dev.kord.rest.builder.RequestBuilder import dev.kord.rest.json.request.ChannelModifyPatchRequest import dev.kord.rest.json.request.ForumTagRequest import kotlin.contracts.InvocationKind @@ -104,7 +103,7 @@ public class ForumChannelModifyBuilder : PermissionOverwritesModifyBuilder, public var defaultReactionEmojiId: Snowflake? = null public var defaultReactionEmojiName: String? = null - private var _availableTags: Optional?> = Optional.Missing() + private var _availableTags: Optional> = Optional.Missing() public var availableTags: MutableList? by ::_availableTags.delegate() public fun tag(name: String, builder: ForumTagBuilder.() -> Unit = {}) { diff --git a/rest/src/main/kotlin/builder/channel/thread/StartForumThreadBuilder.kt b/rest/src/main/kotlin/builder/channel/thread/StartForumThreadBuilder.kt index 5ca13daf8826..f35065f63cf7 100644 --- a/rest/src/main/kotlin/builder/channel/thread/StartForumThreadBuilder.kt +++ b/rest/src/main/kotlin/builder/channel/thread/StartForumThreadBuilder.kt @@ -24,7 +24,7 @@ public class StartForumThreadBuilder(public var name: String) : AuditRequestBuil private var _rateLimitPerUser: Optional = Optional.Missing() public var rateLimitPerUser: Duration? by ::_rateLimitPerUser.delegate() - private var _appliedTags: Optional?> = Optional.Missing() + private var _appliedTags: Optional> = Optional.Missing() public var appliedTags: MutableList? by ::_appliedTags.delegate() public var message: ForumMessageCreateBuilder? = null diff --git a/rest/src/main/kotlin/json/request/ChannelRequests.kt b/rest/src/main/kotlin/json/request/ChannelRequests.kt index 11176c0feaa2..18f98438c862 100644 --- a/rest/src/main/kotlin/json/request/ChannelRequests.kt +++ b/rest/src/main/kotlin/json/request/ChannelRequests.kt @@ -57,12 +57,12 @@ public data class ChannelModifyPatchRequest( @SerialName("default_reaction_emoji") val defaultReactionEmoji: Optional = Optional.Missing(), @SerialName("default_thread_rate_limit_per_user") - val defaultThreadRateLimitPerUser: Optional = Optional.Missing(), - val flags: Optional = Optional.Missing(), + val defaultThreadRateLimitPerUser: Optional = Optional.Missing(), + val flags: Optional = Optional.Missing(), @SerialName("available_tags") - val availableTags: Optional?> = Optional.Missing(), + val availableTags: Optional> = Optional.Missing(), @SerialName("applied_tags") - val appliedTags: Optional?> = Optional.Missing(), + val appliedTags: Optional> = Optional.Missing(), @SerialName("default_sort_order") val defaultSortOrder: Optional = Optional.Missing(), @SerialName("default_forum_layout") @@ -85,9 +85,9 @@ public data class StartThreadRequest( val invitable: OptionalBoolean = OptionalBoolean.Missing, @SerialName("rate_limit_per_user") val rateLimitPerUser: Optional = Optional.Missing(), - val message: Optional = Optional.Missing(), + val message: Optional = Optional.Missing(), @SerialName("applied_tags") - val appliedTags: Optional?> = Optional.Missing() + val appliedTags: Optional> = Optional.Missing(), ) public data class MultipartStartThreadRequest( @@ -108,7 +108,7 @@ public data class ListThreadsByTimestampRequest( @Serializable public data class ForumTagRequest( val name: Optional = Optional.Missing(), - val moderated: OptionalBoolean? = OptionalBoolean.Missing, + val moderated: OptionalBoolean = OptionalBoolean.Missing, @SerialName("emoji_id") val emojiId: Optional = Optional.Missing(), @SerialName("emoji_name") From 3ef7e1fc5f8646f1f5833ee6795b82300024026b Mon Sep 17 00:00:00 2001 From: Lukellmann Date: Fri, 24 Mar 2023 18:46:04 +0100 Subject: [PATCH 12/42] Use plain List for MultipartStartThreadRequest It's not serialized, so making it optional and nullable is useless. --- .../kotlin/builder/channel/thread/StartForumThreadBuilder.kt | 2 +- rest/src/main/kotlin/json/request/ChannelRequests.kt | 2 +- rest/src/main/kotlin/service/ChannelService.kt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rest/src/main/kotlin/builder/channel/thread/StartForumThreadBuilder.kt b/rest/src/main/kotlin/builder/channel/thread/StartForumThreadBuilder.kt index f35065f63cf7..d9d53d759bb4 100644 --- a/rest/src/main/kotlin/builder/channel/thread/StartForumThreadBuilder.kt +++ b/rest/src/main/kotlin/builder/channel/thread/StartForumThreadBuilder.kt @@ -52,7 +52,7 @@ public class StartForumThreadBuilder(public var name: String) : AuditRequestBuil message = Optional(messageRequest?.request).coerceToMissing(), appliedTags = _appliedTags ), - Optional(messageRequest?.files).coerceToMissing() + files = messageRequest?.files ?: emptyList() ) } diff --git a/rest/src/main/kotlin/json/request/ChannelRequests.kt b/rest/src/main/kotlin/json/request/ChannelRequests.kt index 18f98438c862..6b5fd27bea87 100644 --- a/rest/src/main/kotlin/json/request/ChannelRequests.kt +++ b/rest/src/main/kotlin/json/request/ChannelRequests.kt @@ -92,7 +92,7 @@ public data class StartThreadRequest( public data class MultipartStartThreadRequest( val request: StartThreadRequest, - val files: Optional?> = Optional.Missing(), + val files: List = emptyList(), ) public data class ListThreadsBySnowflakeRequest( diff --git a/rest/src/main/kotlin/service/ChannelService.kt b/rest/src/main/kotlin/service/ChannelService.kt index a5c5f962cf68..f5cc51cab359 100644 --- a/rest/src/main/kotlin/service/ChannelService.kt +++ b/rest/src/main/kotlin/service/ChannelService.kt @@ -327,7 +327,7 @@ public class ChannelService(requestHandler: RequestHandler) : RestService(reques keys[Route.ChannelId] = channelId body(StartThreadRequest.serializer(), multipartRequest.request) auditLogReason(reason) - multipartRequest.files.value?.forEach { file(it) } + multipartRequest.files.forEach { file(it) } } public suspend fun startThread( From e78fdd2bcad05e7c8f26bda5a9fb1ffda4594117 Mon Sep 17 00:00:00 2001 From: Lukellmann Date: Fri, 24 Mar 2023 18:47:06 +0100 Subject: [PATCH 13/42] Remove unused DiscordIntegrations --- gateway/api/gateway.api | 31 ------------------------------- gateway/src/main/kotlin/Event.kt | 7 ------- 2 files changed, 38 deletions(-) diff --git a/gateway/api/gateway.api b/gateway/api/gateway.api index d7886eaf3839..d2f57551adb4 100644 --- a/gateway/api/gateway.api +++ b/gateway/api/gateway.api @@ -424,37 +424,6 @@ public final class dev/kord/gateway/DiscordDeletedInvite$Companion { public final fun serializer ()Lkotlinx/serialization/KSerializer; } -public final class dev/kord/gateway/DiscordIntegrations { - public static final field Companion Ldev/kord/gateway/DiscordIntegrations$Companion; - public synthetic fun (ILdev/kord/common/entity/DiscordIntegration;Ldev/kord/common/entity/Snowflake;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V - public fun (Ldev/kord/common/entity/DiscordIntegration;Ldev/kord/common/entity/Snowflake;)V - public final fun component1 ()Ldev/kord/common/entity/DiscordIntegration; - public final fun component2 ()Ldev/kord/common/entity/Snowflake; - public final fun copy (Ldev/kord/common/entity/DiscordIntegration;Ldev/kord/common/entity/Snowflake;)Ldev/kord/gateway/DiscordIntegrations; - public static synthetic fun copy$default (Ldev/kord/gateway/DiscordIntegrations;Ldev/kord/common/entity/DiscordIntegration;Ldev/kord/common/entity/Snowflake;ILjava/lang/Object;)Ldev/kord/gateway/DiscordIntegrations; - public fun equals (Ljava/lang/Object;)Z - public final fun getGuildId ()Ldev/kord/common/entity/Snowflake; - public final fun getIntegration ()Ldev/kord/common/entity/DiscordIntegration; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; - public static final fun write$Self (Ldev/kord/gateway/DiscordIntegrations;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V -} - -public final class dev/kord/gateway/DiscordIntegrations$$serializer : kotlinx/serialization/internal/GeneratedSerializer { - public static final field INSTANCE Ldev/kord/gateway/DiscordIntegrations$$serializer; - public fun childSerializers ()[Lkotlinx/serialization/KSerializer; - public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ldev/kord/gateway/DiscordIntegrations; - 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/gateway/DiscordIntegrations;)V - public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V - public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer; -} - -public final class dev/kord/gateway/DiscordIntegrations$Companion { - public final fun serializer ()Lkotlinx/serialization/KSerializer; -} - public final class dev/kord/gateway/DiscordPresence { public static final field Companion Ldev/kord/gateway/DiscordPresence$Companion; public synthetic fun (ILdev/kord/common/entity/PresenceStatus;ZLkotlinx/datetime/Instant;Ldev/kord/common/entity/DiscordBotActivity;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V diff --git a/gateway/src/main/kotlin/Event.kt b/gateway/src/main/kotlin/Event.kt index 7ec086219aa3..a47349a2a200 100644 --- a/gateway/src/main/kotlin/Event.kt +++ b/gateway/src/main/kotlin/Event.kt @@ -865,10 +865,3 @@ public data class DiscordThreadMembersUpdate( @SerialName("removed_member_ids") val removedMemberIds: Optional> = Optional.Missing() ) - -@Serializable -public data class DiscordIntegrations( - val integration: DiscordIntegration, - @SerialName("guild_id") - val guildId: Snowflake -) From 71dcede4f679a19d0cf83898cb85991cde2d8cc7 Mon Sep 17 00:00:00 2001 From: Lukellmann Date: Fri, 24 Mar 2023 18:48:23 +0100 Subject: [PATCH 14/42] Use core Integration for events --- core/api/core.api | 12 ++++++------ .../kotlin/event/guild/IntegrationCreateEvent.kt | 8 ++++---- .../kotlin/event/guild/IntegrationUpdateEvent.kt | 8 ++++---- .../main/kotlin/gateway/handler/GuildEventHandler.kt | 11 ++++++++--- 4 files changed, 22 insertions(+), 17 deletions(-) diff --git a/core/api/core.api b/core/api/core.api index 6212cc5b917b..9e52e456d6d9 100644 --- a/core/api/core.api +++ b/core/api/core.api @@ -11763,15 +11763,15 @@ public final class dev/kord/core/event/guild/GuildUpdateEvent : dev/kord/core/ev } public final class dev/kord/core/event/guild/IntegrationCreateEvent : dev/kord/core/entity/Strategizable, dev/kord/core/event/Event { - public fun (Ldev/kord/common/entity/DiscordIntegration;Ldev/kord/core/Kord;ILjava/lang/Object;Ldev/kord/core/supplier/EntitySupplier;)V - public synthetic fun (Ldev/kord/common/entity/DiscordIntegration;Ldev/kord/core/Kord;ILjava/lang/Object;Ldev/kord/core/supplier/EntitySupplier;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (Ldev/kord/core/entity/Integration;Ldev/kord/core/Kord;ILjava/lang/Object;Ldev/kord/core/supplier/EntitySupplier;)V + public synthetic fun (Ldev/kord/core/entity/Integration;Ldev/kord/core/Kord;ILjava/lang/Object;Ldev/kord/core/supplier/EntitySupplier;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public fun getCustomContext ()Ljava/lang/Object; public fun getGateway ()Ldev/kord/gateway/Gateway; public final fun getGuild ()Ldev/kord/core/behavior/GuildBehavior; public final fun getGuild (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public final fun getGuildId ()Ldev/kord/common/entity/Snowflake; public final fun getGuildOrNull (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public final fun getIntegration ()Ldev/kord/common/entity/DiscordIntegration; + public final fun getIntegration ()Ldev/kord/core/entity/Integration; public fun getKord ()Ldev/kord/core/Kord; public fun getShard ()I public fun getSupplier ()Ldev/kord/core/supplier/EntitySupplier; @@ -11800,15 +11800,15 @@ public final class dev/kord/core/event/guild/IntegrationDeleteEvent : dev/kord/c } public final class dev/kord/core/event/guild/IntegrationUpdateEvent : dev/kord/core/entity/Strategizable, dev/kord/core/event/Event { - public fun (Ldev/kord/common/entity/DiscordIntegration;Ldev/kord/core/Kord;ILjava/lang/Object;Ldev/kord/core/supplier/EntitySupplier;)V - public synthetic fun (Ldev/kord/common/entity/DiscordIntegration;Ldev/kord/core/Kord;ILjava/lang/Object;Ldev/kord/core/supplier/EntitySupplier;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (Ldev/kord/core/entity/Integration;Ldev/kord/core/Kord;ILjava/lang/Object;Ldev/kord/core/supplier/EntitySupplier;)V + public synthetic fun (Ldev/kord/core/entity/Integration;Ldev/kord/core/Kord;ILjava/lang/Object;Ldev/kord/core/supplier/EntitySupplier;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public fun getCustomContext ()Ljava/lang/Object; public fun getGateway ()Ldev/kord/gateway/Gateway; public final fun getGuild ()Ldev/kord/core/behavior/GuildBehavior; public final fun getGuild (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public final fun getGuildId ()Ldev/kord/common/entity/Snowflake; public final fun getGuildOrNull (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public final fun getIntegration ()Ldev/kord/common/entity/DiscordIntegration; + public final fun getIntegration ()Ldev/kord/core/entity/Integration; public fun getKord ()Ldev/kord/core/Kord; public fun getShard ()I public fun getSupplier ()Ldev/kord/core/supplier/EntitySupplier; diff --git a/core/src/main/kotlin/event/guild/IntegrationCreateEvent.kt b/core/src/main/kotlin/event/guild/IntegrationCreateEvent.kt index e8bbe57099c4..eb8d650f72fa 100644 --- a/core/src/main/kotlin/event/guild/IntegrationCreateEvent.kt +++ b/core/src/main/kotlin/event/guild/IntegrationCreateEvent.kt @@ -1,24 +1,24 @@ package dev.kord.core.event.guild -import dev.kord.common.entity.DiscordIntegration import dev.kord.common.entity.Snowflake import dev.kord.core.Kord import dev.kord.core.behavior.GuildBehavior import dev.kord.core.entity.Guild +import dev.kord.core.entity.Integration import dev.kord.core.entity.Strategizable import dev.kord.core.event.Event import dev.kord.core.supplier.EntitySupplier import dev.kord.core.supplier.EntitySupplyStrategy public class IntegrationCreateEvent( - public val integration: DiscordIntegration, + public val integration: Integration, override val kord: Kord, override val shard: Int, override val customContext: Any?, override val supplier: EntitySupplier = kord.defaultSupplier, ) : Event, Strategizable { - public val guildId: Snowflake = integration.guildId.value!! - public val guild: GuildBehavior get() = GuildBehavior(guildId, kord) + public val guildId: Snowflake get() = integration.guildId + public val guild: GuildBehavior get() = integration.guild public suspend fun getGuild(): Guild = supplier.getGuild(guildId) diff --git a/core/src/main/kotlin/event/guild/IntegrationUpdateEvent.kt b/core/src/main/kotlin/event/guild/IntegrationUpdateEvent.kt index a716ccc27ab6..954382708235 100644 --- a/core/src/main/kotlin/event/guild/IntegrationUpdateEvent.kt +++ b/core/src/main/kotlin/event/guild/IntegrationUpdateEvent.kt @@ -1,24 +1,24 @@ package dev.kord.core.event.guild -import dev.kord.common.entity.DiscordIntegration import dev.kord.common.entity.Snowflake import dev.kord.core.Kord import dev.kord.core.behavior.GuildBehavior import dev.kord.core.entity.Guild +import dev.kord.core.entity.Integration import dev.kord.core.entity.Strategizable import dev.kord.core.event.Event import dev.kord.core.supplier.EntitySupplier import dev.kord.core.supplier.EntitySupplyStrategy public class IntegrationUpdateEvent( - public val integration: DiscordIntegration, + public val integration: Integration, override val kord: Kord, override val shard: Int, override val customContext: Any?, override val supplier: EntitySupplier = kord.defaultSupplier, ) : Event, Strategizable { - public val guildId: Snowflake = integration.guildId.value!! - public val guild: GuildBehavior get() = GuildBehavior(guildId, kord) + public val guildId: Snowflake get() = integration.guildId + public val guild: GuildBehavior get() = integration.guild public suspend fun getGuild(): Guild = supplier.getGuild(guildId) diff --git a/core/src/main/kotlin/gateway/handler/GuildEventHandler.kt b/core/src/main/kotlin/gateway/handler/GuildEventHandler.kt index 3eb44a0cf318..dcc1b897e31a 100644 --- a/core/src/main/kotlin/gateway/handler/GuildEventHandler.kt +++ b/core/src/main/kotlin/gateway/handler/GuildEventHandler.kt @@ -196,7 +196,9 @@ internal class GuildEventHandler : BaseGatewayEventHandler() { kord: Kord, context: LazyContext?, ): IntegrationCreateEvent { - return IntegrationCreateEvent(event.integration, kord, shard, context?.get()) + val integration = event.integration + val data = IntegrationData.from(integration.guildId.value!!, integration) + return IntegrationCreateEvent(Integration(data, kord), kord, shard, context?.get()) } private suspend fun handle( @@ -205,7 +207,9 @@ internal class GuildEventHandler : BaseGatewayEventHandler() { kord: Kord, context: LazyContext? ): IntegrationUpdateEvent { - return IntegrationUpdateEvent(event.integration, kord, shard, context?.get()) + val integration = event.integration + val data = IntegrationData.from(integration.guildId.value!!, integration) + return IntegrationUpdateEvent(Integration(data, kord), kord, shard, context?.get()) } private suspend fun handle( @@ -214,7 +218,8 @@ internal class GuildEventHandler : BaseGatewayEventHandler() { kord: Kord, context: LazyContext?, ): IntegrationDeleteEvent { - return IntegrationDeleteEvent(event.integration.id, event.integration.guildId, event.integration.applicationId.value, kord, shard, context?.get()) + val integration = event.integration + return IntegrationDeleteEvent(integration.id, integration.guildId, integration.applicationId.value, kord, shard, context?.get()) } private suspend fun handle( From 98ed6f95f97403eed68663a79c9b64fe77890903 Mon Sep 17 00:00:00 2001 From: Lukellmann Date: Fri, 24 Mar 2023 18:50:24 +0100 Subject: [PATCH 15/42] Don't cache Audit Log Entries They aren't queried through cache so putting them there doesn't make sense. --- .../kotlin/event/guild/GuildAuditLogEntryCreateEvent.kt | 9 ++++----- .../src/main/kotlin/gateway/handler/GuildEventHandler.kt | 3 --- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/core/src/main/kotlin/event/guild/GuildAuditLogEntryCreateEvent.kt b/core/src/main/kotlin/event/guild/GuildAuditLogEntryCreateEvent.kt index b15cf326728a..33819944a28a 100644 --- a/core/src/main/kotlin/event/guild/GuildAuditLogEntryCreateEvent.kt +++ b/core/src/main/kotlin/event/guild/GuildAuditLogEntryCreateEvent.kt @@ -9,8 +9,7 @@ public class GuildAuditLogEntryCreateEvent( override val kord: Kord, override val shard: Int, override val customContext: Any? -): Event { - override fun toString(): String { - return "GuildAuditLogEntryCreate(auditLogEntry=$auditLogEntry, shard=$shard)" - } -} \ No newline at end of file +) : Event { + override fun toString(): String = "GuildAuditLogEntryCreateEvent(auditLogEntry=$auditLogEntry, kord=$kord, " + + "shard=$shard, customContext=$customContext)" +} diff --git a/core/src/main/kotlin/gateway/handler/GuildEventHandler.kt b/core/src/main/kotlin/gateway/handler/GuildEventHandler.kt index dcc1b897e31a..9da19e3ccd9e 100644 --- a/core/src/main/kotlin/gateway/handler/GuildEventHandler.kt +++ b/core/src/main/kotlin/gateway/handler/GuildEventHandler.kt @@ -93,9 +93,6 @@ internal class GuildEventHandler : BaseGatewayEventHandler() { context: LazyContext? ): GuildAuditLogEntryCreateEvent { val entry = AuditLogEntry(event.entry, kord) - - kord.cache.put(entry) - return GuildAuditLogEntryCreateEvent(entry, kord, shard, context?.get()) } From 46846e1539c875436851416f9e5d9c6e5d0ca707 Mon Sep 17 00:00:00 2001 From: Lukellmann Date: Fri, 24 Mar 2023 18:50:47 +0100 Subject: [PATCH 16/42] Remove wrong SerialName annotation for components --- rest/src/main/kotlin/json/request/MessageRequests.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/rest/src/main/kotlin/json/request/MessageRequests.kt b/rest/src/main/kotlin/json/request/MessageRequests.kt index 89e1ecbc0806..011f12cd6836 100644 --- a/rest/src/main/kotlin/json/request/MessageRequests.kt +++ b/rest/src/main/kotlin/json/request/MessageRequests.kt @@ -96,7 +96,6 @@ public data class ForumThreadMessageRequest( val embeds: Optional> = Optional.Missing(), @SerialName("allowed_mentions") val allowedMentions: Optional = Optional.Missing(), - @SerialName("message_reference") val components: Optional> = Optional.Missing(), @SerialName("sticker_ids") val stickerIds: Optional> = Optional.Missing(), From 09f55ff43d24f8211dbaae0c27e972ad6c191191 Mon Sep 17 00:00:00 2001 From: Lukellmann Date: Fri, 24 Mar 2023 18:51:45 +0100 Subject: [PATCH 17/42] Reintroduce old constructor of StartThreadWithMessageBuilder --- rest/api/rest.api | 3 ++- .../thread/StartThreadWithMessageBuilder.kt | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/rest/api/rest.api b/rest/api/rest.api index 319a6c05cfd1..b45b318f916a 100644 --- a/rest/api/rest.api +++ b/rest/api/rest.api @@ -829,8 +829,9 @@ public final class dev/kord/rest/builder/channel/thread/StartForumThreadBuilder public synthetic fun toRequest ()Ljava/lang/Object; } -public class dev/kord/rest/builder/channel/thread/StartThreadWithMessageBuilder : dev/kord/rest/builder/AuditRequestBuilder { +public final class dev/kord/rest/builder/channel/thread/StartThreadWithMessageBuilder : dev/kord/rest/builder/AuditRequestBuilder { public fun (Ljava/lang/String;)V + public fun (Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;)V public final fun getAutoArchiveDuration ()Ldev/kord/common/entity/ArchiveDuration; public final fun getName ()Ljava/lang/String; public final fun getRateLimitPerUser-FghU774 ()Lkotlin/time/Duration; diff --git a/rest/src/main/kotlin/builder/channel/thread/StartThreadWithMessageBuilder.kt b/rest/src/main/kotlin/builder/channel/thread/StartThreadWithMessageBuilder.kt index 420e59085c57..d2ea170f9c48 100644 --- a/rest/src/main/kotlin/builder/channel/thread/StartThreadWithMessageBuilder.kt +++ b/rest/src/main/kotlin/builder/channel/thread/StartThreadWithMessageBuilder.kt @@ -6,10 +6,23 @@ import dev.kord.common.entity.optional.Optional import dev.kord.common.entity.optional.delegate.delegate import dev.kord.rest.builder.AuditRequestBuilder import dev.kord.rest.json.request.StartThreadRequest +import kotlin.DeprecationLevel.WARNING import kotlin.time.Duration @KordDsl -public open class StartThreadWithMessageBuilder(public var name: String) : AuditRequestBuilder { +public class StartThreadWithMessageBuilder(public var name: String) : AuditRequestBuilder { + @Deprecated( + "'autoArchiveDuration' is no longer required, use other constructor instead.", + ReplaceWith( + "StartThreadWithMessageBuilder(name).apply { this@apply.autoArchiveDuration = autoArchiveDuration }", + imports = ["dev.kord.rest.builder.channel.thread.StartThreadWithMessageBuilder"] + ), + level = WARNING, + ) + public constructor(name: String, autoArchiveDuration: ArchiveDuration) : this(name) { + this.autoArchiveDuration = autoArchiveDuration + } + override var reason: String? = null private var _autoArchiveDuration: Optional = Optional.Missing() From 5fdf2af6e119bb72a040a47edae657dbb0146bc1 Mon Sep 17 00:00:00 2001 From: Lukellmann Date: Fri, 24 Mar 2023 18:57:33 +0100 Subject: [PATCH 18/42] Rename StartThreadWithoutMessageBuilder back to StartThreadBuilder This preserves binary compatibility. Also add the old constructor. --- .../behavior/channel/NewsChannelBehavior.kt | 10 +++----- .../behavior/channel/TextChannelBehavior.kt | 21 ++++++---------- .../threads/ThreadParentChannelBehavior.kt | 10 ++++---- rest/api/rest.api | 16 ++++++------- ...essageBuilder.kt => StartThreadBuilder.kt} | 24 +++++++++++++++---- .../thread/StartThreadWithMessageBuilder.kt | 3 --- .../src/main/kotlin/service/ChannelService.kt | 7 +++--- 7 files changed, 46 insertions(+), 45 deletions(-) rename rest/src/main/kotlin/builder/channel/thread/{StartThreadWithoutMessageBuilder.kt => StartThreadBuilder.kt} (58%) diff --git a/core/src/main/kotlin/behavior/channel/NewsChannelBehavior.kt b/core/src/main/kotlin/behavior/channel/NewsChannelBehavior.kt index 7d2ae5e9a698..bea59b7ade30 100644 --- a/core/src/main/kotlin/behavior/channel/NewsChannelBehavior.kt +++ b/core/src/main/kotlin/behavior/channel/NewsChannelBehavior.kt @@ -17,8 +17,8 @@ import dev.kord.core.exception.EntityNotFoundException import dev.kord.core.supplier.EntitySupplier import dev.kord.core.supplier.EntitySupplyStrategy import dev.kord.rest.builder.channel.NewsChannelModifyBuilder +import dev.kord.rest.builder.channel.thread.StartThreadBuilder import dev.kord.rest.builder.channel.thread.StartThreadWithMessageBuilder -import dev.kord.rest.builder.channel.thread.StartThreadWithoutMessageBuilder import dev.kord.rest.json.request.ChannelFollowRequest import dev.kord.rest.request.RestRequestException import dev.kord.rest.service.patchNewsChannel @@ -102,13 +102,9 @@ public interface NewsChannelBehavior : TopGuildMessageChannelBehavior, ThreadPar public suspend fun startPublicThread( name: String, - builder: StartThreadWithoutMessageBuilder.() -> Unit, // TODO add empty default when overload is deprecated HIDDEN + builder: StartThreadBuilder.() -> Unit, // TODO add empty default when overload is deprecated HIDDEN ): NewsChannelThread { - return unsafeStartThread(name) { - builder() - - type = ChannelType.PublicNewsThread - } as NewsChannelThread + return unsafeStartThread(name, type = ChannelType.PublicNewsThread, builder) as NewsChannelThread } @Deprecated( diff --git a/core/src/main/kotlin/behavior/channel/TextChannelBehavior.kt b/core/src/main/kotlin/behavior/channel/TextChannelBehavior.kt index 0c137cccbeb3..346f066f9baa 100644 --- a/core/src/main/kotlin/behavior/channel/TextChannelBehavior.kt +++ b/core/src/main/kotlin/behavior/channel/TextChannelBehavior.kt @@ -17,7 +17,7 @@ import dev.kord.core.supplier.EntitySupplier import dev.kord.core.supplier.EntitySupplyStrategy import dev.kord.rest.builder.channel.TextChannelModifyBuilder import dev.kord.rest.builder.channel.thread.StartThreadWithMessageBuilder -import dev.kord.rest.builder.channel.thread.StartThreadWithoutMessageBuilder +import dev.kord.rest.builder.channel.thread.StartThreadBuilder import dev.kord.rest.request.RestRequestException import dev.kord.rest.service.patchTextChannel import kotlinx.coroutines.flow.Flow @@ -75,7 +75,7 @@ public interface TextChannelBehavior : TopGuildMessageChannelBehavior, PrivateTh public suspend fun startPublicThread( name: String, archiveDuration: ArchiveDuration = ArchiveDuration.Day, - builder: StartThreadWithoutMessageBuilder.() -> Unit = {} + builder: StartThreadBuilder.() -> Unit = {} ): TextChannelThread { return startPublicThread(name) { this.autoArchiveDuration = archiveDuration @@ -85,13 +85,9 @@ public interface TextChannelBehavior : TopGuildMessageChannelBehavior, PrivateTh public suspend fun startPublicThread( name: String, - builder: StartThreadWithoutMessageBuilder.() -> Unit, + builder: StartThreadBuilder.() -> Unit, ): TextChannelThread { - return unsafeStartThread(name) { - builder() - - type = ChannelType.PublicGuildThread - } as TextChannelThread + return unsafeStartThread(name, type = ChannelType.PublicGuildThread, builder) as TextChannelThread } @Deprecated( @@ -102,7 +98,7 @@ public interface TextChannelBehavior : TopGuildMessageChannelBehavior, PrivateTh public suspend fun startPrivateThread( name: String, archiveDuration: ArchiveDuration = ArchiveDuration.Day, - builder: StartThreadWithoutMessageBuilder.() -> Unit = {} + builder: StartThreadBuilder.() -> Unit = {} ): TextChannelThread { return startPrivateThread(name) { this.autoArchiveDuration = archiveDuration @@ -112,12 +108,9 @@ public interface TextChannelBehavior : TopGuildMessageChannelBehavior, PrivateTh public suspend fun startPrivateThread( name: String, - builder: StartThreadWithoutMessageBuilder.() -> Unit, // TODO add empty default when overload is deprecated HIDDEN + builder: StartThreadBuilder.() -> Unit, // TODO add empty default when overload is deprecated HIDDEN ): TextChannelThread { - return unsafeStartThread(name) { - builder() - type = ChannelType.PrivateThread - } as TextChannelThread + return unsafeStartThread(name, type = ChannelType.PrivateThread, builder) as TextChannelThread } @Deprecated( diff --git a/core/src/main/kotlin/behavior/channel/threads/ThreadParentChannelBehavior.kt b/core/src/main/kotlin/behavior/channel/threads/ThreadParentChannelBehavior.kt index 76461fda46e4..75914d7e7a7a 100644 --- a/core/src/main/kotlin/behavior/channel/threads/ThreadParentChannelBehavior.kt +++ b/core/src/main/kotlin/behavior/channel/threads/ThreadParentChannelBehavior.kt @@ -1,5 +1,6 @@ package dev.kord.core.behavior.channel.threads +import dev.kord.common.entity.ChannelType import dev.kord.common.entity.Snowflake import dev.kord.common.exception.RequestException import dev.kord.core.Kord @@ -14,7 +15,7 @@ import dev.kord.core.exception.EntityNotFoundException import dev.kord.core.supplier.EntitySupplier import dev.kord.core.supplier.EntitySupplyStrategy import dev.kord.rest.builder.channel.thread.StartThreadWithMessageBuilder -import dev.kord.rest.builder.channel.thread.StartThreadWithoutMessageBuilder +import dev.kord.rest.builder.channel.thread.StartThreadBuilder import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filter import kotlinx.datetime.Instant @@ -126,9 +127,10 @@ public interface PrivateThreadParentChannelBehavior : ThreadParentChannelBehavio */ internal suspend fun ThreadParentChannelBehavior.unsafeStartThread( name: String, - builder: StartThreadWithoutMessageBuilder.() -> Unit + type: ChannelType, + builder: StartThreadBuilder.() -> Unit ): ThreadChannel { - val startBuilder = StartThreadWithoutMessageBuilder(name).apply(builder) + val startBuilder = StartThreadBuilder(name, type).apply(builder) val response = kord.rest.channel.startThread(id, startBuilder.toRequest(), startBuilder.reason) val data = ChannelData.from(response) @@ -138,7 +140,7 @@ internal suspend fun ThreadParentChannelBehavior.unsafeStartThread( internal suspend fun ThreadParentChannelBehavior.unsafeStartPublicThreadWithMessage( messageId: Snowflake, name: String, - builder: StartThreadWithMessageBuilder.() -> Unit = {} + builder: StartThreadWithMessageBuilder.() -> Unit, ): ThreadChannel { val startBuilder = StartThreadWithMessageBuilder(name).apply(builder) val response = kord.rest.channel.startThreadWithMessage(id, messageId, startBuilder.toRequest(), startBuilder.reason) diff --git a/rest/api/rest.api b/rest/api/rest.api index b45b318f916a..2c45ec3a1c9c 100644 --- a/rest/api/rest.api +++ b/rest/api/rest.api @@ -829,14 +829,17 @@ public final class dev/kord/rest/builder/channel/thread/StartForumThreadBuilder public synthetic fun toRequest ()Ljava/lang/Object; } -public final class dev/kord/rest/builder/channel/thread/StartThreadWithMessageBuilder : dev/kord/rest/builder/AuditRequestBuilder { - public fun (Ljava/lang/String;)V - public fun (Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;)V +public final class dev/kord/rest/builder/channel/thread/StartThreadBuilder : dev/kord/rest/builder/AuditRequestBuilder { + public fun (Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;Ldev/kord/common/entity/ChannelType;)V + public fun (Ljava/lang/String;Ldev/kord/common/entity/ChannelType;)V public final fun getAutoArchiveDuration ()Ldev/kord/common/entity/ArchiveDuration; + public final fun getInvitable ()Ljava/lang/Boolean; public final fun getName ()Ljava/lang/String; public final fun getRateLimitPerUser-FghU774 ()Lkotlin/time/Duration; public fun getReason ()Ljava/lang/String; + public final fun getType ()Ldev/kord/common/entity/ChannelType; public final fun setAutoArchiveDuration (Ldev/kord/common/entity/ArchiveDuration;)V + public final fun setInvitable (Ljava/lang/Boolean;)V public final fun setName (Ljava/lang/String;)V public final fun setRateLimitPerUser-BwNAW2A (Lkotlin/time/Duration;)V public fun setReason (Ljava/lang/String;)V @@ -844,20 +847,17 @@ public final class dev/kord/rest/builder/channel/thread/StartThreadWithMessageBu public synthetic fun toRequest ()Ljava/lang/Object; } -public final class dev/kord/rest/builder/channel/thread/StartThreadWithoutMessageBuilder : dev/kord/rest/builder/AuditRequestBuilder { +public final class dev/kord/rest/builder/channel/thread/StartThreadWithMessageBuilder : dev/kord/rest/builder/AuditRequestBuilder { public fun (Ljava/lang/String;)V + public fun (Ljava/lang/String;Ldev/kord/common/entity/ArchiveDuration;)V public final fun getAutoArchiveDuration ()Ldev/kord/common/entity/ArchiveDuration; - public final fun getInvitable ()Ljava/lang/Boolean; public final fun getName ()Ljava/lang/String; public final fun getRateLimitPerUser-FghU774 ()Lkotlin/time/Duration; public fun getReason ()Ljava/lang/String; - public final fun getType ()Ldev/kord/common/entity/ChannelType; public final fun setAutoArchiveDuration (Ldev/kord/common/entity/ArchiveDuration;)V - public final fun setInvitable (Ljava/lang/Boolean;)V public final fun setName (Ljava/lang/String;)V public final fun setRateLimitPerUser-BwNAW2A (Lkotlin/time/Duration;)V public fun setReason (Ljava/lang/String;)V - public final fun setType (Ldev/kord/common/entity/ChannelType;)V public fun toRequest ()Ldev/kord/rest/json/request/StartThreadRequest; public synthetic fun toRequest ()Ljava/lang/Object; } diff --git a/rest/src/main/kotlin/builder/channel/thread/StartThreadWithoutMessageBuilder.kt b/rest/src/main/kotlin/builder/channel/thread/StartThreadBuilder.kt similarity index 58% rename from rest/src/main/kotlin/builder/channel/thread/StartThreadWithoutMessageBuilder.kt rename to rest/src/main/kotlin/builder/channel/thread/StartThreadBuilder.kt index 73aeef18e3d0..55733895a5d2 100644 --- a/rest/src/main/kotlin/builder/channel/thread/StartThreadWithoutMessageBuilder.kt +++ b/rest/src/main/kotlin/builder/channel/thread/StartThreadBuilder.kt @@ -6,12 +6,29 @@ import dev.kord.common.entity.ChannelType import dev.kord.common.entity.optional.Optional import dev.kord.common.entity.optional.OptionalBoolean import dev.kord.common.entity.optional.delegate.delegate +import dev.kord.common.entity.optional.optional import dev.kord.rest.builder.AuditRequestBuilder import dev.kord.rest.json.request.StartThreadRequest +import kotlin.DeprecationLevel.WARNING import kotlin.time.Duration @KordDsl -public class StartThreadWithoutMessageBuilder(public var name: String) : AuditRequestBuilder { +public class StartThreadBuilder( + public var name: String, + public val type: ChannelType, +) : AuditRequestBuilder { + @Deprecated( + "'autoArchiveDuration' is no longer required, use other constructor instead.", + ReplaceWith( + "StartThreadBuilder(name, type).apply { this@apply.autoArchiveDuration = autoArchiveDuration }", + imports = ["dev.kord.rest.builder.channel.thread.StartThreadBuilder"] + ), + level = WARNING, + ) + public constructor(name: String, autoArchiveDuration: ArchiveDuration, type: ChannelType) : this(name, type) { + this.autoArchiveDuration = autoArchiveDuration + } + override var reason: String? = null private var _autoArchiveDuration: Optional = Optional.Missing() @@ -23,14 +40,11 @@ public class StartThreadWithoutMessageBuilder(public var name: String) : AuditRe private var _invitable: OptionalBoolean = OptionalBoolean.Missing public var invitable: Boolean? by ::_invitable.delegate() - private var _type: Optional = Optional.Missing() - public var type: ChannelType? by ::_type.delegate() - override fun toRequest(): StartThreadRequest { return StartThreadRequest( name = name, autoArchiveDuration = _autoArchiveDuration, - type = _type, + type = type.optional(), // currently optional, will be required in the future according to Discord's docs invitable = _invitable, rateLimitPerUser = _rateLimitPerUser ) diff --git a/rest/src/main/kotlin/builder/channel/thread/StartThreadWithMessageBuilder.kt b/rest/src/main/kotlin/builder/channel/thread/StartThreadWithMessageBuilder.kt index d2ea170f9c48..82fcb009314f 100644 --- a/rest/src/main/kotlin/builder/channel/thread/StartThreadWithMessageBuilder.kt +++ b/rest/src/main/kotlin/builder/channel/thread/StartThreadWithMessageBuilder.kt @@ -39,6 +39,3 @@ public class StartThreadWithMessageBuilder(public var name: String) : AuditReque ) } } - -@Deprecated("Renamed to StartThreadWithMessageBuilder", replaceWith = ReplaceWith("dev.kord.rest.builder.channel.thread.StartThreadWithMessageBuilder")) -public typealias StartThreadBuilder = StartThreadWithMessageBuilder diff --git a/rest/src/main/kotlin/service/ChannelService.kt b/rest/src/main/kotlin/service/ChannelService.kt index f5cc51cab359..9f37389b64a7 100644 --- a/rest/src/main/kotlin/service/ChannelService.kt +++ b/rest/src/main/kotlin/service/ChannelService.kt @@ -5,7 +5,7 @@ import dev.kord.common.entity.optional.orEmpty import dev.kord.rest.builder.channel.* import dev.kord.rest.builder.channel.thread.StartForumThreadBuilder import dev.kord.rest.builder.channel.thread.StartThreadWithMessageBuilder -import dev.kord.rest.builder.channel.thread.StartThreadWithoutMessageBuilder +import dev.kord.rest.builder.channel.thread.StartThreadBuilder import dev.kord.rest.builder.message.create.UserMessageCreateBuilder import dev.kord.rest.builder.message.modify.UserMessageModifyBuilder import dev.kord.rest.json.request.* @@ -343,12 +343,11 @@ public class ChannelService(requestHandler: RequestHandler) : RestService(reques name: String, archiveDuration: ArchiveDuration, type: ChannelType, - builder: StartThreadWithoutMessageBuilder.() -> Unit = {} + builder: StartThreadBuilder.() -> Unit = {} ): DiscordChannel { contract { callsInPlace(builder, InvocationKind.EXACTLY_ONCE) } - val startBuilder = StartThreadWithoutMessageBuilder(name).apply { + val startBuilder = StartThreadBuilder(name, type).apply { this.autoArchiveDuration = archiveDuration - this.type = type } return startThread(channelId, startBuilder.toRequest(), startBuilder.reason) } From 2334b0967b74fb7b5992e5d688804be16dcfe1f1 Mon Sep 17 00:00:00 2001 From: Lukellmann Date: Fri, 24 Mar 2023 18:57:54 +0100 Subject: [PATCH 19/42] Missing API Dump --- rest/api/rest.api | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/rest/api/rest.api b/rest/api/rest.api index 2c45ec3a1c9c..afd8351796fc 100644 --- a/rest/api/rest.api +++ b/rest/api/rest.api @@ -4997,14 +4997,14 @@ public final class dev/kord/rest/json/request/MultipartMessagePatchRequest { } public final class dev/kord/rest/json/request/MultipartStartThreadRequest { - public fun (Ldev/kord/rest/json/request/StartThreadRequest;Ldev/kord/common/entity/optional/Optional;)V - public synthetic fun (Ldev/kord/rest/json/request/StartThreadRequest;Ldev/kord/common/entity/optional/Optional;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (Ldev/kord/rest/json/request/StartThreadRequest;Ljava/util/List;)V + public synthetic fun (Ldev/kord/rest/json/request/StartThreadRequest;Ljava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()Ldev/kord/rest/json/request/StartThreadRequest; - public final fun component2 ()Ldev/kord/common/entity/optional/Optional; - public final fun copy (Ldev/kord/rest/json/request/StartThreadRequest;Ldev/kord/common/entity/optional/Optional;)Ldev/kord/rest/json/request/MultipartStartThreadRequest; - public static synthetic fun copy$default (Ldev/kord/rest/json/request/MultipartStartThreadRequest;Ldev/kord/rest/json/request/StartThreadRequest;Ldev/kord/common/entity/optional/Optional;ILjava/lang/Object;)Ldev/kord/rest/json/request/MultipartStartThreadRequest; + public final fun component2 ()Ljava/util/List; + public final fun copy (Ldev/kord/rest/json/request/StartThreadRequest;Ljava/util/List;)Ldev/kord/rest/json/request/MultipartStartThreadRequest; + public static synthetic fun copy$default (Ldev/kord/rest/json/request/MultipartStartThreadRequest;Ldev/kord/rest/json/request/StartThreadRequest;Ljava/util/List;ILjava/lang/Object;)Ldev/kord/rest/json/request/MultipartStartThreadRequest; public fun equals (Ljava/lang/Object;)Z - public final fun getFiles ()Ldev/kord/common/entity/optional/Optional; + public final fun getFiles ()Ljava/util/List; public final fun getRequest ()Ldev/kord/rest/json/request/StartThreadRequest; public fun hashCode ()I public fun toString ()Ljava/lang/String; From 643a45b27d40015a4e24f038c06a6efd05dd083e Mon Sep 17 00:00:00 2001 From: Lukellmann Date: Fri, 24 Mar 2023 19:07:55 +0100 Subject: [PATCH 20/42] Remove Forum Tag routes They are not documented in Discord's docs and have odd behavior. --- core/api/core.api | 11 ---- .../behavior/channel/ForumChannelBehavior.kt | 28 +---------- rest/api/rest.api | 41 --------------- .../channel/EditGuildChannelBuilder.kt | 26 ---------- rest/src/main/kotlin/route/Route.kt | 23 --------- .../src/main/kotlin/service/ChannelService.kt | 50 ------------------- 6 files changed, 2 insertions(+), 177 deletions(-) diff --git a/core/api/core.api b/core/api/core.api index 9e52e456d6d9..ad5eb9ae6d18 100644 --- a/core/api/core.api +++ b/core/api/core.api @@ -1079,9 +1079,6 @@ public final class dev/kord/core/behavior/channel/ChannelBehaviorKt { } public abstract interface class dev/kord/core/behavior/channel/ForumChannelBehavior : dev/kord/core/behavior/channel/threads/ThreadParentChannelBehavior { - public abstract fun createTag (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public abstract fun deleteTag (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public abstract fun editTag (Ldev/kord/common/entity/Snowflake;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public abstract fun getActiveThreads ()Lkotlinx/coroutines/flow/Flow; public abstract fun getPublicArchivedThreads (Lkotlinx/datetime/Instant;Ljava/lang/Integer;)Lkotlinx/coroutines/flow/Flow; public abstract fun startPublicThread (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; @@ -1092,12 +1089,7 @@ public final class dev/kord/core/behavior/channel/ForumChannelBehavior$DefaultIm public static fun asChannel (Ldev/kord/core/behavior/channel/ForumChannelBehavior;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun asChannelOrNull (Ldev/kord/core/behavior/channel/ForumChannelBehavior;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun compareTo (Ldev/kord/core/behavior/channel/ForumChannelBehavior;Ldev/kord/core/entity/Entity;)I - public static fun createTag (Ldev/kord/core/behavior/channel/ForumChannelBehavior;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static synthetic fun createTag$default (Ldev/kord/core/behavior/channel/ForumChannelBehavior;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; public static fun delete (Ldev/kord/core/behavior/channel/ForumChannelBehavior;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static fun deleteTag (Ldev/kord/core/behavior/channel/ForumChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static synthetic fun deleteTag$default (Ldev/kord/core/behavior/channel/ForumChannelBehavior;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; - public static fun editTag (Ldev/kord/core/behavior/channel/ForumChannelBehavior;Ldev/kord/common/entity/Snowflake;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun fetchChannel (Ldev/kord/core/behavior/channel/ForumChannelBehavior;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun fetchChannelOrNull (Ldev/kord/core/behavior/channel/ForumChannelBehavior;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun getActiveThreads (Ldev/kord/core/behavior/channel/ForumChannelBehavior;)Lkotlinx/coroutines/flow/Flow; @@ -7812,10 +7804,7 @@ public final class dev/kord/core/entity/channel/ForumChannel : dev/kord/core/beh public fun asChannelOrNull (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun compareTo (Ldev/kord/core/entity/Entity;)I public synthetic fun compareTo (Ljava/lang/Object;)I - public fun createTag (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun delete (Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public fun deleteTag (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public fun editTag (Ldev/kord/common/entity/Snowflake;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun fetchChannel (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun fetchChannelOrNull (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun getActiveThreads ()Lkotlinx/coroutines/flow/Flow; diff --git a/core/src/main/kotlin/behavior/channel/ForumChannelBehavior.kt b/core/src/main/kotlin/behavior/channel/ForumChannelBehavior.kt index cdad1ba6ca34..7bb05277250a 100644 --- a/core/src/main/kotlin/behavior/channel/ForumChannelBehavior.kt +++ b/core/src/main/kotlin/behavior/channel/ForumChannelBehavior.kt @@ -1,14 +1,11 @@ package dev.kord.core.behavior.channel -import dev.kord.common.entity.Snowflake import dev.kord.core.behavior.channel.threads.ThreadParentChannelBehavior import dev.kord.core.cache.data.ChannelData import dev.kord.core.entity.channel.Channel import dev.kord.core.entity.channel.ForumChannel import dev.kord.core.entity.channel.thread.TextChannelThread import dev.kord.rest.builder.channel.ForumChannelModifyBuilder -import dev.kord.rest.builder.channel.ForumTagBuilder -import dev.kord.rest.builder.channel.ModifyForumTagBuilder import dev.kord.rest.builder.channel.thread.StartForumThreadBuilder import dev.kord.rest.service.patchForumChannel import kotlinx.coroutines.flow.Flow @@ -26,30 +23,9 @@ public interface ForumChannelBehavior : ThreadParentChannelBehavior { return super.getPublicArchivedThreads(before, limit).filterIsInstance() } - public suspend fun createTag(name: String, builder: ForumTagBuilder.() -> Unit = {}): ForumChannel { - val request = kord.rest.channel.createForumTag(id, name, builder) - val data = ChannelData.from(request) - - return Channel.from(data, kord) as ForumChannel - } - - public suspend fun deleteTag(tagId: Snowflake, reason: String? = null): ForumChannel { - val request = kord.rest.channel.deleteForumTag(id, tagId, reason) - val data = ChannelData.from(request) - - return Channel.from(data, kord) as ForumChannel - } - - public suspend fun editTag(tagId: Snowflake, builder: ModifyForumTagBuilder.() -> Unit): ForumChannel { - val request = kord.rest.channel.editForumTag(id, tagId, builder) - val data = ChannelData.from(request) - - return Channel.from(data, kord) as ForumChannel - } - public suspend fun startPublicThread( name: String, - builder: StartForumThreadBuilder.() -> Unit = {} + builder: StartForumThreadBuilder.() -> Unit = {}, ): TextChannelThread { return unsafeStartThread(name, builder) } @@ -57,7 +33,7 @@ public interface ForumChannelBehavior : ThreadParentChannelBehavior { internal suspend fun ThreadParentChannelBehavior.unsafeStartThread( name: String, - builder: StartForumThreadBuilder.() -> Unit + builder: StartForumThreadBuilder.() -> Unit, ): TextChannelThread { contract { callsInPlace(builder, InvocationKind.EXACTLY_ONCE) } diff --git a/rest/api/rest.api b/rest/api/rest.api index afd8351796fc..53bd412623df 100644 --- a/rest/api/rest.api +++ b/rest/api/rest.api @@ -554,22 +554,6 @@ public final class dev/kord/rest/builder/channel/InviteCreateBuilder : dev/kord/ public synthetic fun toRequest ()Ljava/lang/Object; } -public final class dev/kord/rest/builder/channel/ModifyForumTagBuilder : dev/kord/rest/builder/AuditRequestBuilder { - public fun ()V - public final fun getModerated ()Ljava/lang/Boolean; - public final fun getName ()Ljava/lang/String; - public final fun getReactionEmojiId ()Ldev/kord/common/entity/Snowflake; - public final fun getReactionEmojiName ()Ljava/lang/String; - public fun getReason ()Ljava/lang/String; - public final fun setModerated (Ljava/lang/Boolean;)V - public final fun setName (Ljava/lang/String;)V - public final fun setReactionEmojiId (Ldev/kord/common/entity/Snowflake;)V - public final fun setReactionEmojiName (Ljava/lang/String;)V - public fun setReason (Ljava/lang/String;)V - public fun toRequest ()Ldev/kord/rest/json/request/ForumTagRequest; - public synthetic fun toRequest ()Ljava/lang/Object; -} - public final class dev/kord/rest/builder/channel/NewsChannelCreateBuilder : dev/kord/rest/builder/AuditRequestBuilder, dev/kord/rest/builder/channel/PermissionOverwritesCreateBuilder { public fun (Ljava/lang/String;)V public fun addOverwrite (Ldev/kord/common/entity/Overwrite;)V @@ -6402,18 +6386,6 @@ public final class dev/kord/rest/route/Route$FollowupMessageModify : dev/kord/re public static final field INSTANCE Ldev/kord/rest/route/Route$FollowupMessageModify; } -public final class dev/kord/rest/route/Route$ForumTagDelete : dev/kord/rest/route/Route { - public static final field INSTANCE Ldev/kord/rest/route/Route$ForumTagDelete; -} - -public final class dev/kord/rest/route/Route$ForumTagPost : dev/kord/rest/route/Route { - public static final field INSTANCE Ldev/kord/rest/route/Route$ForumTagPost; -} - -public final class dev/kord/rest/route/Route$ForumTagPut : dev/kord/rest/route/Route { - public static final field INSTANCE Ldev/kord/rest/route/Route$ForumTagPut; -} - public final class dev/kord/rest/route/Route$GatewayBotGet : dev/kord/rest/route/Route { public static final field INSTANCE Ldev/kord/rest/route/Route$GatewayBotGet; } @@ -6934,10 +6906,6 @@ public final class dev/kord/rest/route/Route$StickerId : dev/kord/rest/route/Rou public static final field INSTANCE Ldev/kord/rest/route/Route$StickerId; } -public final class dev/kord/rest/route/Route$TagId : dev/kord/rest/route/Route$Key { - public static final field INSTANCE Ldev/kord/rest/route/Route$TagId; -} - public final class dev/kord/rest/route/Route$TemplateCode : dev/kord/rest/route/Route$Key { public static final field INSTANCE Ldev/kord/rest/route/Route$TemplateCode; } @@ -7058,10 +7026,6 @@ public final class dev/kord/rest/service/ChannelService : dev/kord/rest/service/ public final fun addUserToThread (Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/Snowflake;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public final fun bulkDelete (Ldev/kord/common/entity/Snowflake;Ldev/kord/rest/json/request/BulkDeleteRequest;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static synthetic fun bulkDelete$default (Ldev/kord/rest/service/ChannelService;Ldev/kord/common/entity/Snowflake;Ldev/kord/rest/json/request/BulkDeleteRequest;Ljava/lang/String;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; - public final fun createForumTag (Ldev/kord/common/entity/Snowflake;Ldev/kord/rest/json/request/ForumTagRequest;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public final fun createForumTag (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static synthetic fun createForumTag$default (Ldev/kord/rest/service/ChannelService;Ldev/kord/common/entity/Snowflake;Ldev/kord/rest/json/request/ForumTagRequest;Ljava/lang/String;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; - public static synthetic fun createForumTag$default (Ldev/kord/rest/service/ChannelService;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; public final fun createInvite (Ldev/kord/common/entity/Snowflake;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static synthetic fun createInvite$default (Ldev/kord/rest/service/ChannelService;Ldev/kord/common/entity/Snowflake;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; public final fun createMessage (Ldev/kord/common/entity/Snowflake;Ldev/kord/rest/json/request/MultipartMessageCreateRequest;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; @@ -7074,8 +7038,6 @@ public final class dev/kord/rest/service/ChannelService : dev/kord/rest/service/ public static synthetic fun deleteChannel$default (Ldev/kord/rest/service/ChannelService;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; public final fun deleteChannelPermission (Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static synthetic fun deleteChannelPermission$default (Ldev/kord/rest/service/ChannelService;Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; - public final fun deleteForumTag (Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static synthetic fun deleteForumTag$default (Ldev/kord/rest/service/ChannelService;Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; public final fun deleteMessage (Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static synthetic fun deleteMessage$default (Ldev/kord/rest/service/ChannelService;Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; public final fun deleteOwnReaction (Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; @@ -7084,9 +7046,6 @@ public final class dev/kord/rest/service/ChannelService : dev/kord/rest/service/ public final fun deleteReaction (Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public final fun editChannelPermissions (Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/Snowflake;Ldev/kord/rest/json/request/ChannelPermissionEditRequest;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static synthetic fun editChannelPermissions$default (Ldev/kord/rest/service/ChannelService;Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/Snowflake;Ldev/kord/rest/json/request/ChannelPermissionEditRequest;Ljava/lang/String;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; - public final fun editForumTag (Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/Snowflake;Ldev/kord/rest/json/request/ForumTagRequest;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public final fun editForumTag (Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/Snowflake;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static synthetic fun editForumTag$default (Ldev/kord/rest/service/ChannelService;Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/Snowflake;Ldev/kord/rest/json/request/ForumTagRequest;Ljava/lang/String;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; public final fun editMessage (Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/Snowflake;Ldev/kord/rest/json/request/MessageEditPatchRequest;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public final fun editMessage (Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/Snowflake;Ldev/kord/rest/json/request/MultipartMessagePatchRequest;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public final fun editMessage (Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/Snowflake;Ldev/kord/rest/json/request/MultipartWebhookEditMessageRequest;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; diff --git a/rest/src/main/kotlin/builder/channel/EditGuildChannelBuilder.kt b/rest/src/main/kotlin/builder/channel/EditGuildChannelBuilder.kt index 3936a8c8369b..12b74f561ded 100644 --- a/rest/src/main/kotlin/builder/channel/EditGuildChannelBuilder.kt +++ b/rest/src/main/kotlin/builder/channel/EditGuildChannelBuilder.kt @@ -286,29 +286,3 @@ public class NewsChannelModifyBuilder : PermissionOverwritesModifyBuilder, defaultAutoArchiveDuration = _defaultAutoArchiveDuration, ) } - -@KordDsl -public class ModifyForumTagBuilder : AuditRequestBuilder { - private var _name: Optional = Optional.Missing() - public var name: String? by ::_name.delegate() - - private var _moderated: OptionalBoolean = OptionalBoolean.Missing - public var moderated: Boolean? by ::_moderated.delegate() - - private var _reactionEmojiId: Optional = Optional.Missing() - public var reactionEmojiId: Snowflake? by ::_reactionEmojiId.delegate() - - private var _reactionEmojiName: Optional = Optional.Missing() - public var reactionEmojiName: String? by ::_reactionEmojiName.delegate() - - override var reason: String? = null - - override fun toRequest(): ForumTagRequest { - return ForumTagRequest( - name = _name, - moderated = _moderated, - emojiId = _reactionEmojiId, - emojiName = _reactionEmojiName - ) - } -} diff --git a/rest/src/main/kotlin/route/Route.kt b/rest/src/main/kotlin/route/Route.kt index 88b6ec914383..72fcbb70066e 100644 --- a/rest/src/main/kotlin/route/Route.kt +++ b/rest/src/main/kotlin/route/Route.kt @@ -3,7 +3,6 @@ package dev.kord.rest.route import dev.kord.common.KordConfiguration import dev.kord.common.annotation.KordExperimental import dev.kord.common.entity.* -import dev.kord.rest.json.request.ForumTagRequest import dev.kord.rest.json.request.GuildScheduledEventUsersResponse import dev.kord.rest.json.response.* import io.ktor.http.* @@ -82,7 +81,6 @@ public sealed class Route( public object ScheduledEventId : Key("{event.id}", true) public object StickerId : Key("{sticker.id}") public object AutoModerationRuleId : Key("{auto_moderation_rule.id}") - public object TagId : Key("{tag.id}") protected constructor( @@ -1014,25 +1012,4 @@ public sealed class Route( "/guilds/$GuildId/stickers/$StickerId", DiscordMessageSticker.serializer() ) - - public object ForumTagPost : - Route( - HttpMethod.Post, - "/channels/$ChannelId/tags", - DiscordChannel.serializer() - ) - - public object ForumTagDelete : - Route( - HttpMethod.Delete, - "/channels/$ChannelId/tags/$TagId", - DiscordChannel.serializer() - ) - - public object ForumTagPut : - Route( - HttpMethod.Put, - "/channels/$ChannelId/tags/$TagId", - DiscordChannel.serializer() - ) } diff --git a/rest/src/main/kotlin/service/ChannelService.kt b/rest/src/main/kotlin/service/ChannelService.kt index 9f37389b64a7..7f3bc16d9b8d 100644 --- a/rest/src/main/kotlin/service/ChannelService.kt +++ b/rest/src/main/kotlin/service/ChannelService.kt @@ -425,56 +425,6 @@ public class ChannelService(requestHandler: RequestHandler) : RestService(reques if (before != null) parameter("before", before) if (limit != null) parameter("limit", limit) } - - public suspend fun createForumTag( - channelId: Snowflake, - name: String, - builder: ForumTagBuilder.() -> Unit = {} - ): DiscordChannel { - val forumTagBuilder = ForumTagBuilder(name).apply(builder) - return createForumTag(channelId, forumTagBuilder.toRequest(), forumTagBuilder.reason) - } - - public suspend fun createForumTag( - channelId: Snowflake, - request: ForumTagRequest, - reason: String? = null - ): DiscordChannel = call(Route.ForumTagPost) { - keys[Route.ChannelId] = channelId - - body(ForumTagRequest.serializer(), request) - auditLogReason(reason) - } - - public suspend fun deleteForumTag(channelId: Snowflake, tagId: Snowflake, reason: String? = null): DiscordChannel = - call(Route.ForumTagDelete) { - keys[Route.ChannelId] = channelId - keys[Route.TagId] = tagId - - auditLogReason(reason) - } - - public suspend fun editForumTag( - channelId: Snowflake, - tagId: Snowflake, - builder: ModifyForumTagBuilder.() -> Unit - ): DiscordChannel { - val forumTagBuilder = ModifyForumTagBuilder().apply(builder) - return editForumTag(channelId, tagId, forumTagBuilder.toRequest(), forumTagBuilder.reason) - } - - public suspend fun editForumTag( - channelId: Snowflake, - tagId: Snowflake, - request: ForumTagRequest, - reason: String? = null - ): DiscordChannel = call(Route.ForumTagPut) { - keys[Route.ChannelId] = channelId - keys[Route.TagId] = tagId - - body(ForumTagRequest.serializer(), request) - auditLogReason(reason) - } } public suspend inline fun ChannelService.patchTextChannel( From 5b5bac0606afc0f9429ae51f5c7e8a0ad7bd6323 Mon Sep 17 00:00:00 2001 From: Lukellmann Date: Fri, 24 Mar 2023 20:41:36 +0100 Subject: [PATCH 21/42] Make GuildMemberFlags serializer internal --- common/api/common.api | 7 +------ common/src/main/kotlin/entity/Member.kt | 4 ++-- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/common/api/common.api b/common/api/common.api index 849275f7d66c..69c674c6b217 100644 --- a/common/api/common.api +++ b/common/api/common.api @@ -6515,12 +6515,7 @@ public final class dev/kord/common/entity/GuildMemberFlags { public fun toString ()Ljava/lang/String; } -public final class dev/kord/common/entity/GuildMemberFlags$Companion : kotlinx/serialization/KSerializer { - public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ldev/kord/common/entity/GuildMemberFlags; - 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/entity/GuildMemberFlags;)V - public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V +public final class dev/kord/common/entity/GuildMemberFlags$Companion { public final fun serializer ()Lkotlinx/serialization/KSerializer; } diff --git a/common/src/main/kotlin/entity/Member.kt b/common/src/main/kotlin/entity/Member.kt index a821b5c8fa41..62703207944d 100644 --- a/common/src/main/kotlin/entity/Member.kt +++ b/common/src/main/kotlin/entity/Member.kt @@ -114,14 +114,14 @@ public data class DiscordThreadMember( val flags: Int ) -@Serializable(with = GuildMemberFlags.Companion::class) +@Serializable(with = GuildMemberFlags.Serializer::class) public data class GuildMemberFlags(val code: Int) { public operator fun contains(flag: GuildMemberFlags): Boolean { return this.code and flag.code == flag.code } - public companion object : KSerializer { + internal object Serializer : KSerializer { override val descriptor: SerialDescriptor get() = PrimitiveSerialDescriptor("flags", PrimitiveKind.INT) From aeb5cb7ea19a6ce4cac44c6776e40cfb669f0a9c Mon Sep 17 00:00:00 2001 From: Lukellmann Date: Fri, 24 Mar 2023 21:03:13 +0100 Subject: [PATCH 22/42] Override methods in ForumChannel and ForumChannelBehavior --- .../behavior/channel/ForumChannelBehavior.kt | 39 +++++++++++++++++++ .../kotlin/entity/channel/ForumChannel.kt | 15 ++++--- 2 files changed, 46 insertions(+), 8 deletions(-) diff --git a/core/src/main/kotlin/behavior/channel/ForumChannelBehavior.kt b/core/src/main/kotlin/behavior/channel/ForumChannelBehavior.kt index 7bb05277250a..393cd7bc91b2 100644 --- a/core/src/main/kotlin/behavior/channel/ForumChannelBehavior.kt +++ b/core/src/main/kotlin/behavior/channel/ForumChannelBehavior.kt @@ -1,10 +1,14 @@ package dev.kord.core.behavior.channel +import dev.kord.common.exception.RequestException import dev.kord.core.behavior.channel.threads.ThreadParentChannelBehavior import dev.kord.core.cache.data.ChannelData import dev.kord.core.entity.channel.Channel import dev.kord.core.entity.channel.ForumChannel import dev.kord.core.entity.channel.thread.TextChannelThread +import dev.kord.core.exception.EntityNotFoundException +import dev.kord.core.supplier.EntitySupplier +import dev.kord.core.supplier.EntitySupplyStrategy import dev.kord.rest.builder.channel.ForumChannelModifyBuilder import dev.kord.rest.builder.channel.thread.StartForumThreadBuilder import dev.kord.rest.service.patchForumChannel @@ -29,6 +33,41 @@ public interface ForumChannelBehavior : ThreadParentChannelBehavior { ): TextChannelThread { return unsafeStartThread(name, builder) } + + /** + * Requests to get this behavior as a [ForumChannel]. + * + * @throws RequestException if anything went wrong during the request. + * @throws EntityNotFoundException if the channel wasn't present. + * @throws ClassCastException if the channel isn't a [ForumChannel]. + */ + override suspend fun asChannel(): ForumChannel = super.asChannel() as ForumChannel + + /** + * Requests to get this behavior as a [ForumChannel], + * returns null if the channel isn't present or if the channel isn't a [ForumChannel]. + * + * @throws RequestException if anything went wrong during the request. + */ + override suspend fun asChannelOrNull(): ForumChannel? = super.asChannelOrNull() as? ForumChannel + + /** + * Retrieve the [ForumChannel] associated with this behaviour from the provided [EntitySupplier]. + * + * @throws RequestException if anything went wrong during the request. + * @throws EntityNotFoundException if the user wasn't present. + */ + override suspend fun fetchChannel(): ForumChannel = super.fetchChannel() as ForumChannel + + /** + * Retrieve the [ForumChannel] associated with this behaviour from the provided [EntitySupplier] + * returns null if the [ForumChannel] isn't present. + * + * @throws RequestException if anything went wrong during the request. + */ + override suspend fun fetchChannelOrNull(): ForumChannel? = super.fetchChannelOrNull() as? ForumChannel + + override fun withStrategy(strategy: EntitySupplyStrategy<*>): ForumChannelBehavior } internal suspend fun ThreadParentChannelBehavior.unsafeStartThread( diff --git a/core/src/main/kotlin/entity/channel/ForumChannel.kt b/core/src/main/kotlin/entity/channel/ForumChannel.kt index ff5b6bc2a3f3..4c738dab8170 100644 --- a/core/src/main/kotlin/entity/channel/ForumChannel.kt +++ b/core/src/main/kotlin/entity/channel/ForumChannel.kt @@ -34,11 +34,10 @@ public class ForumChannel( */ public val defaultForumLayout: ForumLayoutType? get() = data.defaultForumLayout.value - override fun withStrategy(strategy: EntitySupplyStrategy<*>): ForumChannel { - return ForumChannel(data,kord, strategy.supply(kord)) - } - - override fun toString(): String { - return "ForumChannel(data=$data, kord=$kord, supplier=$supplier)" - } -} \ No newline at end of file + override suspend fun asChannel(): ForumChannel = this + override suspend fun asChannelOrNull(): ForumChannel = this + override fun withStrategy(strategy: EntitySupplyStrategy<*>): ForumChannel = + ForumChannel(data, kord, strategy.supply(kord)) + + override fun toString(): String = "ForumChannel(data=$data, kord=$kord, supplier=$supplier)" +} From e40114abc5f5f03913a062b0cba1778dc2c4fdd1 Mon Sep 17 00:00:00 2001 From: Lukellmann Date: Fri, 24 Mar 2023 21:09:04 +0100 Subject: [PATCH 23/42] Dump API --- core/api/core.api | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/api/core.api b/core/api/core.api index ad5eb9ae6d18..83ff1533fe6b 100644 --- a/core/api/core.api +++ b/core/api/core.api @@ -1079,9 +1079,14 @@ public final class dev/kord/core/behavior/channel/ChannelBehaviorKt { } public abstract interface class dev/kord/core/behavior/channel/ForumChannelBehavior : dev/kord/core/behavior/channel/threads/ThreadParentChannelBehavior { + public abstract fun asChannel (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public abstract fun asChannelOrNull (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public abstract fun fetchChannel (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public abstract fun fetchChannelOrNull (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public abstract fun getActiveThreads ()Lkotlinx/coroutines/flow/Flow; public abstract fun getPublicArchivedThreads (Lkotlinx/datetime/Instant;Ljava/lang/Integer;)Lkotlinx/coroutines/flow/Flow; public abstract fun startPublicThread (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public abstract fun withStrategy (Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/behavior/channel/ForumChannelBehavior; } public final class dev/kord/core/behavior/channel/ForumChannelBehavior$DefaultImpls { @@ -7839,6 +7844,7 @@ public final class dev/kord/core/entity/channel/ForumChannel : dev/kord/core/beh public fun toString ()Ljava/lang/String; public synthetic fun withStrategy (Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/behavior/channel/CategorizableChannelBehavior; public synthetic fun withStrategy (Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/behavior/channel/ChannelBehavior; + public synthetic fun withStrategy (Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/behavior/channel/ForumChannelBehavior; public synthetic fun withStrategy (Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/behavior/channel/GuildChannelBehavior; public synthetic fun withStrategy (Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/behavior/channel/TopGuildChannelBehavior; public synthetic fun withStrategy (Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/behavior/channel/threads/ThreadParentChannelBehavior; From 95a0ecad5684e91197f53cd807671e0b9b8e1e40 Mon Sep 17 00:00:00 2001 From: Lukellmann Date: Fri, 24 Mar 2023 22:08:22 +0100 Subject: [PATCH 24/42] Consider ForumChannel events in enableEvent --- core/src/main/kotlin/Util.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/src/main/kotlin/Util.kt b/core/src/main/kotlin/Util.kt index 3bf78e25a2e5..2fb540cedb99 100644 --- a/core/src/main/kotlin/Util.kt +++ b/core/src/main/kotlin/Util.kt @@ -334,6 +334,7 @@ public fun Intents.IntentsBuilder.enableEvent(event: KClass): Unit = NewsChannelCreateEvent::class, StageChannelCreateEvent::class, TextChannelCreateEvent::class, + ForumChannelCreateEvent::class, UnknownChannelCreateEvent::class, VoiceChannelCreateEvent::class, @@ -343,6 +344,7 @@ public fun Intents.IntentsBuilder.enableEvent(event: KClass): Unit = NewsChannelUpdateEvent::class, StageChannelUpdateEvent::class, TextChannelUpdateEvent::class, + ForumChannelUpdateEvent::class, UnknownChannelUpdateEvent::class, VoiceChannelUpdateEvent::class, @@ -352,6 +354,7 @@ public fun Intents.IntentsBuilder.enableEvent(event: KClass): Unit = NewsChannelDeleteEvent::class, StageChannelDeleteEvent::class, TextChannelDeleteEvent::class, + ForumChannelDeleteEvent::class, UnknownChannelDeleteEvent::class, VoiceChannelDeleteEvent::class, From dba13c067382963085c87ab6edb8030e85332dfb Mon Sep 17 00:00:00 2001 From: Lukellmann Date: Sat, 25 Mar 2023 02:02:19 +0100 Subject: [PATCH 25/42] Move webhooks to CategorizableChannelBehavior It was in TopGuildMessageChannelBehavior before but ForumChannels also support webhooks. In fact the only concrete Channel type that receives webhook support through this change is ForumChannel. --- core/api/core.api | 14 ++++++- .../channel/CategorizableChannelBehavior.kt | 38 +++++++++++++++++++ .../channel/TopGuildMessageChannelBehavior.kt | 38 +++---------------- 3 files changed, 56 insertions(+), 34 deletions(-) diff --git a/core/api/core.api b/core/api/core.api index 83ff1533fe6b..e1a6206af9dd 100644 --- a/core/api/core.api +++ b/core/api/core.api @@ -979,6 +979,7 @@ public final class dev/kord/core/behavior/channel/BaseVoiceChannelBehavior$Defau public static fun getMention (Ldev/kord/core/behavior/channel/BaseVoiceChannelBehavior;)Ljava/lang/String; public static fun getPosition (Ldev/kord/core/behavior/channel/BaseVoiceChannelBehavior;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun getVoiceStates (Ldev/kord/core/behavior/channel/BaseVoiceChannelBehavior;)Lkotlinx/coroutines/flow/Flow; + public static fun getWebhooks (Ldev/kord/core/behavior/channel/BaseVoiceChannelBehavior;)Lkotlinx/coroutines/flow/Flow; public static fun withStrategy (Ldev/kord/core/behavior/channel/BaseVoiceChannelBehavior;Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/behavior/channel/CategorizableChannelBehavior; } @@ -988,6 +989,7 @@ public abstract interface class dev/kord/core/behavior/channel/CategorizableChan public abstract fun fetchChannel (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public abstract fun fetchChannelOrNull (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public abstract fun getInvites ()Lkotlinx/coroutines/flow/Flow; + public abstract fun getWebhooks ()Lkotlinx/coroutines/flow/Flow; public abstract fun withStrategy (Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/behavior/channel/CategorizableChannelBehavior; } @@ -1005,12 +1007,15 @@ public final class dev/kord/core/behavior/channel/CategorizableChannelBehavior$D public static fun getInvites (Ldev/kord/core/behavior/channel/CategorizableChannelBehavior;)Lkotlinx/coroutines/flow/Flow; public static fun getMention (Ldev/kord/core/behavior/channel/CategorizableChannelBehavior;)Ljava/lang/String; public static fun getPosition (Ldev/kord/core/behavior/channel/CategorizableChannelBehavior;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static fun getWebhooks (Ldev/kord/core/behavior/channel/CategorizableChannelBehavior;)Lkotlinx/coroutines/flow/Flow; public static fun withStrategy (Ldev/kord/core/behavior/channel/CategorizableChannelBehavior;Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/behavior/channel/CategorizableChannelBehavior; } public final class dev/kord/core/behavior/channel/CategorizableChannelBehaviorKt { public static final fun createInvite (Ldev/kord/core/behavior/channel/CategorizableChannelBehavior;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static synthetic fun createInvite$default (Ldev/kord/core/behavior/channel/CategorizableChannelBehavior;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static final fun createWebhook (Ldev/kord/core/behavior/channel/CategorizableChannelBehavior;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun createWebhook$default (Ldev/kord/core/behavior/channel/CategorizableChannelBehavior;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; } public abstract interface class dev/kord/core/behavior/channel/CategoryBehavior : dev/kord/core/behavior/channel/TopGuildChannelBehavior { @@ -1105,6 +1110,7 @@ public final class dev/kord/core/behavior/channel/ForumChannelBehavior$DefaultIm public static fun getMention (Ldev/kord/core/behavior/channel/ForumChannelBehavior;)Ljava/lang/String; public static fun getPosition (Ldev/kord/core/behavior/channel/ForumChannelBehavior;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun getPublicArchivedThreads (Ldev/kord/core/behavior/channel/ForumChannelBehavior;Lkotlinx/datetime/Instant;Ljava/lang/Integer;)Lkotlinx/coroutines/flow/Flow; + public static fun getWebhooks (Ldev/kord/core/behavior/channel/ForumChannelBehavior;)Lkotlinx/coroutines/flow/Flow; public static fun startPublicThread (Ldev/kord/core/behavior/channel/ForumChannelBehavior;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static synthetic fun startPublicThread$default (Ldev/kord/core/behavior/channel/ForumChannelBehavior;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; } @@ -1460,7 +1466,6 @@ public abstract interface class dev/kord/core/behavior/channel/TopGuildMessageCh public abstract fun asChannelOrNull (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public abstract fun fetchChannel (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public abstract fun fetchChannelOrNull (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public abstract fun getWebhooks ()Lkotlinx/coroutines/flow/Flow; public abstract fun withStrategy (Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/behavior/channel/TopGuildMessageChannelBehavior; } @@ -1497,7 +1502,7 @@ public final class dev/kord/core/behavior/channel/TopGuildMessageChannelBehavior } public final class dev/kord/core/behavior/channel/TopGuildMessageChannelBehaviorKt { - public static final fun createWebhook (Ldev/kord/core/behavior/channel/TopGuildMessageChannelBehavior;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static final synthetic fun createWebhook (Ldev/kord/core/behavior/channel/TopGuildMessageChannelBehavior;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static synthetic fun createWebhook$default (Ldev/kord/core/behavior/channel/TopGuildMessageChannelBehavior;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; } @@ -1573,6 +1578,7 @@ public final class dev/kord/core/behavior/channel/threads/PrivateThreadParentCha public static fun getPrivateArchivedThreads (Ldev/kord/core/behavior/channel/threads/PrivateThreadParentChannelBehavior;Lkotlinx/datetime/Instant;Ljava/lang/Integer;)Lkotlinx/coroutines/flow/Flow; public static synthetic fun getPrivateArchivedThreads$default (Ldev/kord/core/behavior/channel/threads/PrivateThreadParentChannelBehavior;Lkotlinx/datetime/Instant;Ljava/lang/Integer;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow; public static fun getPublicArchivedThreads (Ldev/kord/core/behavior/channel/threads/PrivateThreadParentChannelBehavior;Lkotlinx/datetime/Instant;Ljava/lang/Integer;)Lkotlinx/coroutines/flow/Flow; + public static fun getWebhooks (Ldev/kord/core/behavior/channel/threads/PrivateThreadParentChannelBehavior;)Lkotlinx/coroutines/flow/Flow; } public abstract interface class dev/kord/core/behavior/channel/threads/ThreadChannelBehavior : dev/kord/core/behavior/channel/GuildMessageChannelBehavior { @@ -1658,6 +1664,7 @@ public final class dev/kord/core/behavior/channel/threads/ThreadParentChannelBeh public static fun getPosition (Ldev/kord/core/behavior/channel/threads/ThreadParentChannelBehavior;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun getPublicArchivedThreads (Ldev/kord/core/behavior/channel/threads/ThreadParentChannelBehavior;Lkotlinx/datetime/Instant;Ljava/lang/Integer;)Lkotlinx/coroutines/flow/Flow; public static synthetic fun getPublicArchivedThreads$default (Ldev/kord/core/behavior/channel/threads/ThreadParentChannelBehavior;Lkotlinx/datetime/Instant;Ljava/lang/Integer;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow; + public static fun getWebhooks (Ldev/kord/core/behavior/channel/threads/ThreadParentChannelBehavior;)Lkotlinx/coroutines/flow/Flow; } public abstract interface class dev/kord/core/behavior/interaction/ActionInteractionBehavior : dev/kord/core/behavior/interaction/InteractionBehavior { @@ -7675,6 +7682,7 @@ public final class dev/kord/core/entity/channel/CategorizableChannel$DefaultImpl public static fun getPosition (Ldev/kord/core/entity/channel/CategorizableChannel;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun getRawPosition (Ldev/kord/core/entity/channel/CategorizableChannel;)I public static fun getType (Ldev/kord/core/entity/channel/CategorizableChannel;)Ldev/kord/common/entity/ChannelType; + public static fun getWebhooks (Ldev/kord/core/entity/channel/CategorizableChannel;)Lkotlinx/coroutines/flow/Flow; } public final class dev/kord/core/entity/channel/Category : dev/kord/core/behavior/channel/CategoryBehavior, dev/kord/core/entity/channel/TopGuildChannel { @@ -7840,6 +7848,7 @@ public final class dev/kord/core/entity/channel/ForumChannel : dev/kord/core/beh public fun getSupplier ()Ldev/kord/core/supplier/EntitySupplier; public final fun getTopic ()Ljava/lang/String; public fun getType ()Ldev/kord/common/entity/ChannelType; + public fun getWebhooks ()Lkotlinx/coroutines/flow/Flow; public fun startPublicThread (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun toString ()Ljava/lang/String; public synthetic fun withStrategy (Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/behavior/channel/CategorizableChannelBehavior; @@ -8266,6 +8275,7 @@ public final class dev/kord/core/entity/channel/ThreadParentChannel$DefaultImpls public static fun getPublicArchivedThreads (Ldev/kord/core/entity/channel/ThreadParentChannel;Lkotlinx/datetime/Instant;Ljava/lang/Integer;)Lkotlinx/coroutines/flow/Flow; public static fun getRawPosition (Ldev/kord/core/entity/channel/ThreadParentChannel;)I public static fun getType (Ldev/kord/core/entity/channel/ThreadParentChannel;)Ldev/kord/common/entity/ChannelType; + public static fun getWebhooks (Ldev/kord/core/entity/channel/ThreadParentChannel;)Lkotlinx/coroutines/flow/Flow; } public abstract interface class dev/kord/core/entity/channel/TopGuildChannel : dev/kord/core/behavior/channel/TopGuildChannelBehavior, dev/kord/core/entity/channel/GuildChannel { diff --git a/core/src/main/kotlin/behavior/channel/CategorizableChannelBehavior.kt b/core/src/main/kotlin/behavior/channel/CategorizableChannelBehavior.kt index 0da6da8b3725..21c4a0d5297e 100644 --- a/core/src/main/kotlin/behavior/channel/CategorizableChannelBehavior.kt +++ b/core/src/main/kotlin/behavior/channel/CategorizableChannelBehavior.kt @@ -4,12 +4,15 @@ import dev.kord.common.entity.Snowflake import dev.kord.common.exception.RequestException import dev.kord.core.Kord import dev.kord.core.cache.data.InviteWithMetadataData +import dev.kord.core.cache.data.WebhookData import dev.kord.core.entity.InviteWithMetadata +import dev.kord.core.entity.Webhook import dev.kord.core.entity.channel.CategorizableChannel import dev.kord.core.exception.EntityNotFoundException import dev.kord.core.supplier.EntitySupplier import dev.kord.core.supplier.EntitySupplyStrategy import dev.kord.rest.builder.channel.InviteCreateBuilder +import dev.kord.rest.builder.webhook.WebhookCreateBuilder import dev.kord.rest.request.RestRequestException import dev.kord.rest.service.RestClient import kotlinx.coroutines.flow.Flow @@ -39,6 +42,22 @@ public interface CategorizableChannelBehavior : TopGuildChannelBehavior { } } + /** + * Requests to get all webhooks for this channel. + * + * This property is not resolvable through cache and will always use the [RestClient] instead. + * + * The returned flow is lazily executed, any [RequestException] will be thrown on + * [terminal operators](https://kotlinlang.org/docs/reference/coroutines/flow.html#terminal-flow-operators) instead. + */ + public val webhooks: Flow + get() = flow { + for (response in kord.rest.webhook.getChannelWebhooks(id)) { + val data = WebhookData.from(response) + emit(Webhook(data, kord)) + } + } + /** * Requests to get this behavior as a [CategorizableChannel]. * @@ -116,3 +135,22 @@ public suspend inline fun CategorizableChannelBehavior.createInvite(builder: Inv return InviteWithMetadata(data, kord) } + +/** + * Requests to create a new webhook configured by the [builder]. + * + * @return The created [Webhook] with the [Webhook.token] field present. + * + * @throws [RestRequestException] if something went wrong during the request. + */ +public suspend inline fun CategorizableChannelBehavior.createWebhook( + name: String, + builder: WebhookCreateBuilder.() -> Unit = {}, +): Webhook { + contract { callsInPlace(builder, InvocationKind.EXACTLY_ONCE) } + + val response = kord.rest.webhook.createWebhook(id, name, builder) + val data = WebhookData.from(response) + + return Webhook(data, kord) +} diff --git a/core/src/main/kotlin/behavior/channel/TopGuildMessageChannelBehavior.kt b/core/src/main/kotlin/behavior/channel/TopGuildMessageChannelBehavior.kt index 0b6de8faaead..8a930746d006 100644 --- a/core/src/main/kotlin/behavior/channel/TopGuildMessageChannelBehavior.kt +++ b/core/src/main/kotlin/behavior/channel/TopGuildMessageChannelBehavior.kt @@ -3,18 +3,14 @@ package dev.kord.core.behavior.channel import dev.kord.common.entity.Snowflake import dev.kord.common.exception.RequestException import dev.kord.core.Kord -import dev.kord.core.cache.data.WebhookData import dev.kord.core.entity.Webhook import dev.kord.core.entity.channel.TopGuildMessageChannel import dev.kord.core.exception.EntityNotFoundException import dev.kord.core.supplier.EntitySupplier import dev.kord.core.supplier.EntitySupplyStrategy import dev.kord.rest.builder.webhook.WebhookCreateBuilder -import dev.kord.rest.request.RestRequestException -import dev.kord.rest.service.RestClient -import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.flow import java.util.* +import kotlin.DeprecationLevel.HIDDEN import kotlin.contracts.InvocationKind import kotlin.contracts.contract @@ -26,22 +22,6 @@ import kotlin.contracts.contract */ public interface TopGuildMessageChannelBehavior : CategorizableChannelBehavior, GuildMessageChannelBehavior { - /** - * Requests to get all webhooks for this channel. - * - * This property is not resolvable through cache and will always use the [RestClient] instead. - * - * The returned flow is lazily executed, any [RequestException] will be thrown on - * [terminal operators](https://kotlinlang.org/docs/reference/coroutines/flow.html#terminal-flow-operators) instead. - */ - public val webhooks: Flow - get() = flow { - for (response in kord.rest.webhook.getChannelWebhooks(id)) { - val data = WebhookData.from(response) - emit(Webhook(data, kord)) - } - } - /** * Requests to get the this behavior as a [TopGuildMessageChannel]. * @@ -112,13 +92,10 @@ internal fun TopGuildMessageChannelBehavior( } -/** - * Requests to create a new webhook configured by the [builder]. - * - * @return The created [Webhook] with the [Webhook.token] field present. - * - * @throws [RestRequestException] if something went wrong during the request. - */ +@Deprecated( + "Binary compatibility, this is now available on the CategorizableChannelBehavior supertype. Keep for some releases.", + level = HIDDEN, +) public suspend inline fun TopGuildMessageChannelBehavior.createWebhook( name: String, builder: WebhookCreateBuilder.() -> Unit = {} @@ -126,8 +103,5 @@ public suspend inline fun TopGuildMessageChannelBehavior.createWebhook( contract { callsInPlace(builder, InvocationKind.EXACTLY_ONCE) } - val response = kord.rest.webhook.createWebhook(id, name, builder) - val data = WebhookData.from(response) - - return Webhook(data, kord) + return (this as CategorizableChannelBehavior).createWebhook(name, builder) } From eed9f3bcff3dfbebd298de3fe876047f60d09bf7 Mon Sep 17 00:00:00 2001 From: Lukellmann Date: Sat, 25 Mar 2023 02:05:04 +0100 Subject: [PATCH 26/42] Rename DiscordForumTag to ForumTag It is used in core and does not contain any optional fields. --- common/api/common.api | 74 +++++++++---------- .../src/main/kotlin/entity/DiscordChannel.kt | 4 +- .../src/main/kotlin/cache/data/ChannelData.kt | 2 +- .../kotlin/entity/channel/ForumChannel.kt | 4 +- 4 files changed, 42 insertions(+), 42 deletions(-) diff --git a/common/api/common.api b/common/api/common.api index 69c674c6b217..4344a6247e82 100644 --- a/common/api/common.api +++ b/common/api/common.api @@ -3482,43 +3482,6 @@ public final class dev/kord/common/entity/DiscordEmoji$Companion { public final fun serializer ()Lkotlinx/serialization/KSerializer; } -public final class dev/kord/common/entity/DiscordForumTag { - public static final field Companion Ldev/kord/common/entity/DiscordForumTag$Companion; - public synthetic fun (ILdev/kord/common/entity/Snowflake;Ljava/lang/String;ZLdev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V - public fun (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;ZLdev/kord/common/entity/Snowflake;Ljava/lang/String;)V - public final fun component1 ()Ldev/kord/common/entity/Snowflake; - public final fun component2 ()Ljava/lang/String; - public final fun component3 ()Z - public final fun component4 ()Ldev/kord/common/entity/Snowflake; - public final fun component5 ()Ljava/lang/String; - public final fun copy (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;ZLdev/kord/common/entity/Snowflake;Ljava/lang/String;)Ldev/kord/common/entity/DiscordForumTag; - public static synthetic fun copy$default (Ldev/kord/common/entity/DiscordForumTag;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;ZLdev/kord/common/entity/Snowflake;Ljava/lang/String;ILjava/lang/Object;)Ldev/kord/common/entity/DiscordForumTag; - public fun equals (Ljava/lang/Object;)Z - public final fun getEmojiId ()Ldev/kord/common/entity/Snowflake; - public final fun getEmojiName ()Ljava/lang/String; - public final fun getId ()Ldev/kord/common/entity/Snowflake; - public final fun getModerated ()Z - public final fun getName ()Ljava/lang/String; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; - public static final fun write$Self (Ldev/kord/common/entity/DiscordForumTag;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V -} - -public final class dev/kord/common/entity/DiscordForumTag$$serializer : kotlinx/serialization/internal/GeneratedSerializer { - public static final field INSTANCE Ldev/kord/common/entity/DiscordForumTag$$serializer; - public fun childSerializers ()[Lkotlinx/serialization/KSerializer; - public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ldev/kord/common/entity/DiscordForumTag; - 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/entity/DiscordForumTag;)V - public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V - public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer; -} - -public final class dev/kord/common/entity/DiscordForumTag$Companion { - public final fun serializer ()Lkotlinx/serialization/KSerializer; -} - public final class dev/kord/common/entity/DiscordGuild { public static final field Companion Ldev/kord/common/entity/DiscordGuild$Companion; public synthetic fun (IILdev/kord/common/entity/Snowflake;Ljava/lang/String;Ljava/lang/String;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/common/entity/Snowflake;Ldev/kord/common/entity/optional/Optional;Ljava/lang/String;Ldev/kord/common/entity/Snowflake;Lkotlin/time/Duration;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/OptionalSnowflake;Ldev/kord/common/entity/VerificationLevel;Ldev/kord/common/entity/DefaultMessageNotificationLevel;Ldev/kord/common/entity/ExplicitContentFilter;Ljava/util/List;Ljava/util/List;Ljava/util/List;Ldev/kord/common/entity/MFALevel;Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/SystemChannelFlags;Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/OptionalInt;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/OptionalInt;Ldev/kord/common/entity/optional/OptionalInt;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ldev/kord/common/entity/PremiumTier;Ldev/kord/common/entity/optional/OptionalInt;Ljava/lang/String;Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/optional/OptionalInt;Ldev/kord/common/entity/optional/OptionalInt;Ldev/kord/common/entity/optional/OptionalInt;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/NsfwLevel;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;ZLkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V @@ -6345,6 +6308,43 @@ public final class dev/kord/common/entity/ForumLayoutType$Unknown : dev/kord/com public fun (I)V } +public final class dev/kord/common/entity/ForumTag { + public static final field Companion Ldev/kord/common/entity/ForumTag$Companion; + public synthetic fun (ILdev/kord/common/entity/Snowflake;Ljava/lang/String;ZLdev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V + public fun (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;ZLdev/kord/common/entity/Snowflake;Ljava/lang/String;)V + public final fun component1 ()Ldev/kord/common/entity/Snowflake; + public final fun component2 ()Ljava/lang/String; + public final fun component3 ()Z + public final fun component4 ()Ldev/kord/common/entity/Snowflake; + public final fun component5 ()Ljava/lang/String; + public final fun copy (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;ZLdev/kord/common/entity/Snowflake;Ljava/lang/String;)Ldev/kord/common/entity/ForumTag; + public static synthetic fun copy$default (Ldev/kord/common/entity/ForumTag;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;ZLdev/kord/common/entity/Snowflake;Ljava/lang/String;ILjava/lang/Object;)Ldev/kord/common/entity/ForumTag; + public fun equals (Ljava/lang/Object;)Z + public final fun getEmojiId ()Ldev/kord/common/entity/Snowflake; + public final fun getEmojiName ()Ljava/lang/String; + public final fun getId ()Ldev/kord/common/entity/Snowflake; + public final fun getModerated ()Z + public final fun getName ()Ljava/lang/String; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; + public static final fun write$Self (Ldev/kord/common/entity/ForumTag;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V +} + +public final class dev/kord/common/entity/ForumTag$$serializer : kotlinx/serialization/internal/GeneratedSerializer { + public static final field INSTANCE Ldev/kord/common/entity/ForumTag$$serializer; + public fun childSerializers ()[Lkotlinx/serialization/KSerializer; + public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ldev/kord/common/entity/ForumTag; + 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/entity/ForumTag;)V + public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V + public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer; +} + +public final class dev/kord/common/entity/ForumTag$Companion { + public final fun serializer ()Lkotlinx/serialization/KSerializer; +} + public abstract class dev/kord/common/entity/GuildFeature { public static final field Companion Ldev/kord/common/entity/GuildFeature$Companion; public synthetic fun (Ljava/lang/String;Lkotlin/jvm/internal/DefaultConstructorMarker;)V diff --git a/common/src/main/kotlin/entity/DiscordChannel.kt b/common/src/main/kotlin/entity/DiscordChannel.kt index 724780651480..7e5d52f99ebb 100644 --- a/common/src/main/kotlin/entity/DiscordChannel.kt +++ b/common/src/main/kotlin/entity/DiscordChannel.kt @@ -149,7 +149,7 @@ public data class DiscordChannel( @SerialName("total_message_sent") val totalMessageSent: OptionalInt = OptionalInt.Missing, @SerialName("available_tags") - val availableTags: Optional> = Optional.Missing(), + val availableTags: Optional> = Optional.Missing(), @SerialName("applied_tags") val appliedTags: Optional> = Optional.Missing(), @SerialName("default_reaction_emoji") @@ -340,7 +340,7 @@ public data class DiscordDefaultReaction( ) @Serializable -public data class DiscordForumTag( +public data class ForumTag( val id: Snowflake, val name: String, val moderated: Boolean, diff --git a/core/src/main/kotlin/cache/data/ChannelData.kt b/core/src/main/kotlin/cache/data/ChannelData.kt index f98e9500d44b..9a54f2112161 100644 --- a/core/src/main/kotlin/cache/data/ChannelData.kt +++ b/core/src/main/kotlin/cache/data/ChannelData.kt @@ -40,7 +40,7 @@ public data class ChannelData( val defaultSortOrder: Optional = Optional.Missing(), val totalMessageSent: OptionalInt = OptionalInt.Missing, val defaultForumLayout: Optional = Optional.Missing(), - val availableTags: Optional> = Optional.Missing(), + val availableTags: Optional> = Optional.Missing(), val appliedTags: Optional> = Optional.Missing(), val defaultReactionEmoji: Optional = Optional.Missing(), val defaultThreadRateLimitPerUser: Optional = Optional.Missing(), diff --git a/core/src/main/kotlin/entity/channel/ForumChannel.kt b/core/src/main/kotlin/entity/channel/ForumChannel.kt index 4c738dab8170..f41713efae8c 100644 --- a/core/src/main/kotlin/entity/channel/ForumChannel.kt +++ b/core/src/main/kotlin/entity/channel/ForumChannel.kt @@ -1,7 +1,7 @@ package dev.kord.core.entity.channel import dev.kord.common.entity.DiscordDefaultReaction -import dev.kord.common.entity.DiscordForumTag +import dev.kord.common.entity.ForumTag import dev.kord.common.entity.ForumLayoutType import dev.kord.core.Kord import dev.kord.core.behavior.channel.ForumChannelBehavior @@ -22,7 +22,7 @@ public class ForumChannel( */ public val topic: String? get() = data.topic.value - public val availableTags: List? get() = data.availableTags.value + public val availableTags: List? get() = data.availableTags.value public val defaultReactionEmoji: DiscordDefaultReaction? get() = data.defaultReactionEmoji.value From afdf76f863c7dc4f678df64b3e9a3218eaeb259a Mon Sep 17 00:00:00 2001 From: Lukellmann Date: Sat, 25 Mar 2023 02:08:35 +0100 Subject: [PATCH 27/42] Fix some optionalities and nullabilities --- .../main/kotlin/entity/channel/ForumChannel.kt | 2 +- .../kotlin/entity/channel/thread/ThreadChannel.kt | 2 +- rest/api/rest.api | 15 +++++++-------- .../builder/channel/ForumChannelCreateBuilder.kt | 4 ++-- .../main/kotlin/json/request/ChannelRequests.kt | 2 +- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/core/src/main/kotlin/entity/channel/ForumChannel.kt b/core/src/main/kotlin/entity/channel/ForumChannel.kt index f41713efae8c..5b2e709e1188 100644 --- a/core/src/main/kotlin/entity/channel/ForumChannel.kt +++ b/core/src/main/kotlin/entity/channel/ForumChannel.kt @@ -22,7 +22,7 @@ public class ForumChannel( */ public val topic: String? get() = data.topic.value - public val availableTags: List? get() = data.availableTags.value + public val availableTags: List get() = data.availableTags.value ?: emptyList() public val defaultReactionEmoji: DiscordDefaultReaction? get() = data.defaultReactionEmoji.value diff --git a/core/src/main/kotlin/entity/channel/thread/ThreadChannel.kt b/core/src/main/kotlin/entity/channel/thread/ThreadChannel.kt index f7e8aeae8004..d57e73988afd 100644 --- a/core/src/main/kotlin/entity/channel/thread/ThreadChannel.kt +++ b/core/src/main/kotlin/entity/channel/thread/ThreadChannel.kt @@ -114,7 +114,7 @@ public interface ThreadChannel : GuildMessageChannel, ThreadChannelBehavior { /** * Only available when creating a thread in a forum channel */ - public val appliedTags: List? get() = data.appliedTags.value + public val appliedTags: List get() = data.appliedTags.value ?: emptyList() override fun withStrategy(strategy: EntitySupplyStrategy<*>): ThreadChannel { return ThreadChannel(data, kord, strategy.supply(kord)) diff --git a/rest/api/rest.api b/rest/api/rest.api index 53bd412623df..abaaa62409b5 100644 --- a/rest/api/rest.api +++ b/rest/api/rest.api @@ -3623,21 +3623,20 @@ public final class dev/kord/rest/json/request/FollowupMessageModifyRequest$Compa public final class dev/kord/rest/json/request/ForumTagRequest { public static final field Companion Ldev/kord/rest/json/request/ForumTagRequest$Companion; - public fun ()V - public synthetic fun (ILdev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V - public fun (Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;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/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public final fun component1 ()Ldev/kord/common/entity/optional/Optional; + public synthetic fun (ILjava/lang/String;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V + public fun (Ljava/lang/String;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;)V + public synthetic fun (Ljava/lang/String;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public final fun component1 ()Ljava/lang/String; public final fun component2 ()Ldev/kord/common/entity/optional/OptionalBoolean; public final fun component3 ()Ldev/kord/common/entity/optional/Optional; public final fun component4 ()Ldev/kord/common/entity/optional/Optional; - public final fun copy (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/rest/json/request/ForumTagRequest; - public static synthetic fun copy$default (Ldev/kord/rest/json/request/ForumTagRequest;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;ILjava/lang/Object;)Ldev/kord/rest/json/request/ForumTagRequest; + public final fun copy (Ljava/lang/String;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;)Ldev/kord/rest/json/request/ForumTagRequest; + public static synthetic fun copy$default (Ldev/kord/rest/json/request/ForumTagRequest;Ljava/lang/String;Ldev/kord/common/entity/optional/OptionalBoolean;Ldev/kord/common/entity/optional/Optional;Ldev/kord/common/entity/optional/Optional;ILjava/lang/Object;)Ldev/kord/rest/json/request/ForumTagRequest; public fun equals (Ljava/lang/Object;)Z public final fun getEmojiId ()Ldev/kord/common/entity/optional/Optional; public final fun getEmojiName ()Ldev/kord/common/entity/optional/Optional; public final fun getModerated ()Ldev/kord/common/entity/optional/OptionalBoolean; - public final fun getName ()Ldev/kord/common/entity/optional/Optional; + public final fun getName ()Ljava/lang/String; public fun hashCode ()I public fun toString ()Ljava/lang/String; public static final fun write$Self (Ldev/kord/rest/json/request/ForumTagRequest;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V diff --git a/rest/src/main/kotlin/builder/channel/ForumChannelCreateBuilder.kt b/rest/src/main/kotlin/builder/channel/ForumChannelCreateBuilder.kt index cbb52e8b5d69..df4b4a5f85e4 100644 --- a/rest/src/main/kotlin/builder/channel/ForumChannelCreateBuilder.kt +++ b/rest/src/main/kotlin/builder/channel/ForumChannelCreateBuilder.kt @@ -113,10 +113,10 @@ public class ForumTagBuilder(private val name: String) : AuditRequestBuilder = Optional.Missing(), + val name: String, val moderated: OptionalBoolean = OptionalBoolean.Missing, @SerialName("emoji_id") val emojiId: Optional = Optional.Missing(), From 1c4deaba4b692bf70db5466f711c3e023c1a2683 Mon Sep 17 00:00:00 2001 From: Lukellmann Date: Sat, 25 Mar 2023 02:09:48 +0100 Subject: [PATCH 28/42] Remove unnecessary ThreadParentChannelBehavior supertype --- core/api/core.api | 2 +- core/src/main/kotlin/entity/channel/ForumChannel.kt | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/core/api/core.api b/core/api/core.api index e1a6206af9dd..01bea70cecae 100644 --- a/core/api/core.api +++ b/core/api/core.api @@ -7809,7 +7809,7 @@ public final class dev/kord/core/entity/channel/DmChannel : dev/kord/core/entity public synthetic fun withStrategy (Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/entity/channel/MessageChannel; } -public final class dev/kord/core/entity/channel/ForumChannel : dev/kord/core/behavior/channel/ForumChannelBehavior, dev/kord/core/behavior/channel/threads/ThreadParentChannelBehavior, dev/kord/core/entity/channel/ThreadParentChannel { +public final class dev/kord/core/entity/channel/ForumChannel : dev/kord/core/behavior/channel/ForumChannelBehavior, dev/kord/core/entity/channel/ThreadParentChannel { public fun (Ldev/kord/core/cache/data/ChannelData;Ldev/kord/core/Kord;Ldev/kord/core/supplier/EntitySupplier;)V public synthetic fun (Ldev/kord/core/cache/data/ChannelData;Ldev/kord/core/Kord;Ldev/kord/core/supplier/EntitySupplier;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public fun addOverwrite (Ldev/kord/core/entity/PermissionOverwrite;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; diff --git a/core/src/main/kotlin/entity/channel/ForumChannel.kt b/core/src/main/kotlin/entity/channel/ForumChannel.kt index 5b2e709e1188..b846a8b16dae 100644 --- a/core/src/main/kotlin/entity/channel/ForumChannel.kt +++ b/core/src/main/kotlin/entity/channel/ForumChannel.kt @@ -5,7 +5,6 @@ import dev.kord.common.entity.ForumTag import dev.kord.common.entity.ForumLayoutType import dev.kord.core.Kord import dev.kord.core.behavior.channel.ForumChannelBehavior -import dev.kord.core.behavior.channel.threads.ThreadParentChannelBehavior import dev.kord.core.cache.data.ChannelData import dev.kord.core.supplier.EntitySupplier import dev.kord.core.supplier.EntitySupplyStrategy @@ -15,7 +14,7 @@ public class ForumChannel( override val data: ChannelData, override val kord: Kord, override val supplier: EntitySupplier = kord.defaultSupplier -) : ThreadParentChannel, ThreadParentChannelBehavior, ForumChannelBehavior { +) : ThreadParentChannel, ForumChannelBehavior { /** * The channel topic, if present. From 2297364318b5a55f77dd95e038df13482094f7a6 Mon Sep 17 00:00:00 2001 From: Lukellmann Date: Sat, 25 Mar 2023 02:12:08 +0100 Subject: [PATCH 29/42] Changes to ForumTagBuilder ForumTagBuilder is no longer a AuditRequestBuilder, its reason was unused. The name property was also made var and public. --- rest/api/rest.api | 6 +++--- .../kotlin/builder/channel/ForumChannelCreateBuilder.kt | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/rest/api/rest.api b/rest/api/rest.api index abaaa62409b5..a124c42038ae 100644 --- a/rest/api/rest.api +++ b/rest/api/rest.api @@ -494,16 +494,16 @@ public final class dev/kord/rest/builder/channel/ForumChannelModifyBuilder : dev public synthetic fun toRequest ()Ljava/lang/Object; } -public final class dev/kord/rest/builder/channel/ForumTagBuilder : dev/kord/rest/builder/AuditRequestBuilder { +public final class dev/kord/rest/builder/channel/ForumTagBuilder : dev/kord/rest/builder/RequestBuilder { public fun (Ljava/lang/String;)V public final fun getModerated ()Ljava/lang/Boolean; + public final fun getName ()Ljava/lang/String; public final fun getReactionEmojiId ()Ldev/kord/common/entity/Snowflake; public final fun getReactionEmojiName ()Ljava/lang/String; - public fun getReason ()Ljava/lang/String; public final fun setModerated (Ljava/lang/Boolean;)V + public final fun setName (Ljava/lang/String;)V public final fun setReactionEmojiId (Ldev/kord/common/entity/Snowflake;)V public final fun setReactionEmojiName (Ljava/lang/String;)V - public fun setReason (Ljava/lang/String;)V public fun toRequest ()Ldev/kord/rest/json/request/ForumTagRequest; public synthetic fun toRequest ()Ljava/lang/Object; } diff --git a/rest/src/main/kotlin/builder/channel/ForumChannelCreateBuilder.kt b/rest/src/main/kotlin/builder/channel/ForumChannelCreateBuilder.kt index df4b4a5f85e4..bf4e75ad964c 100644 --- a/rest/src/main/kotlin/builder/channel/ForumChannelCreateBuilder.kt +++ b/rest/src/main/kotlin/builder/channel/ForumChannelCreateBuilder.kt @@ -99,7 +99,7 @@ public class ForumChannelCreateBuilder(public var name: String) : } @KordDsl -public class ForumTagBuilder(private val name: String) : AuditRequestBuilder { +public class ForumTagBuilder(public var name: String) : RequestBuilder { private var _moderated: OptionalBoolean = OptionalBoolean.Missing public var moderated: Boolean? by ::_moderated.delegate() @@ -109,8 +109,6 @@ public class ForumTagBuilder(private val name: String) : AuditRequestBuilder = Optional.Missing() public var reactionEmojiName: String? by ::_reactionEmojiName.delegate() - override var reason: String? = null - override fun toRequest(): ForumTagRequest { return ForumTagRequest( name = name, From df2b775f06af6d78e3fc870e87b0e3bb6134c939 Mon Sep 17 00:00:00 2001 From: Lukellmann Date: Sat, 25 Mar 2023 02:13:06 +0100 Subject: [PATCH 30/42] Clarify name of ThreadParentChannelBehavior.unsafeStartThread It's an internal function anyway, but make it more clear that it is starting a forum thread. --- core/src/main/kotlin/behavior/channel/ForumChannelBehavior.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/kotlin/behavior/channel/ForumChannelBehavior.kt b/core/src/main/kotlin/behavior/channel/ForumChannelBehavior.kt index 393cd7bc91b2..b5e2b66fc670 100644 --- a/core/src/main/kotlin/behavior/channel/ForumChannelBehavior.kt +++ b/core/src/main/kotlin/behavior/channel/ForumChannelBehavior.kt @@ -31,7 +31,7 @@ public interface ForumChannelBehavior : ThreadParentChannelBehavior { name: String, builder: StartForumThreadBuilder.() -> Unit = {}, ): TextChannelThread { - return unsafeStartThread(name, builder) + return unsafeStartForumThread(name, builder) } /** @@ -70,7 +70,7 @@ public interface ForumChannelBehavior : ThreadParentChannelBehavior { override fun withStrategy(strategy: EntitySupplyStrategy<*>): ForumChannelBehavior } -internal suspend fun ThreadParentChannelBehavior.unsafeStartThread( +internal suspend fun ThreadParentChannelBehavior.unsafeStartForumThread( name: String, builder: StartForumThreadBuilder.() -> Unit, ): TextChannelThread { From f9b244864a3349e0020bce7c9573ce9143af4442 Mon Sep 17 00:00:00 2001 From: Lukellmann Date: Sat, 25 Mar 2023 02:13:24 +0100 Subject: [PATCH 31/42] Fix mistake in replacement --- core/src/main/kotlin/behavior/channel/NewsChannelBehavior.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/kotlin/behavior/channel/NewsChannelBehavior.kt b/core/src/main/kotlin/behavior/channel/NewsChannelBehavior.kt index bea59b7ade30..0de5bf343800 100644 --- a/core/src/main/kotlin/behavior/channel/NewsChannelBehavior.kt +++ b/core/src/main/kotlin/behavior/channel/NewsChannelBehavior.kt @@ -86,7 +86,7 @@ public interface NewsChannelBehavior : TopGuildMessageChannelBehavior, ThreadPar @Deprecated( "Replaced by builder overload", - ReplaceWith("this.startPublicThread(name) {\nautoArchiveDuration = archiveDuration\nthis@startPublicThreadWithMessage.reason = reason\n}"), + ReplaceWith("this.startPublicThread(name) {\nautoArchiveDuration = archiveDuration\nthis@startPublicThread.reason = reason\n}"), level = WARNING, ) public suspend fun startPublicThread( From 4193815743c4407b50aef7e38a2c41b43572ba5d Mon Sep 17 00:00:00 2001 From: Lukellmann Date: Sat, 25 Mar 2023 02:15:42 +0100 Subject: [PATCH 32/42] Align order with intents documentation --- core/src/main/kotlin/Util.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/kotlin/Util.kt b/core/src/main/kotlin/Util.kt index 2fb540cedb99..b3ef60f594f6 100644 --- a/core/src/main/kotlin/Util.kt +++ b/core/src/main/kotlin/Util.kt @@ -382,7 +382,7 @@ public fun Intents.IntentsBuilder.enableEvent(event: KClass): Unit = MemberJoinEvent::class, MemberUpdateEvent::class, MemberLeaveEvent::class -> +GuildMembers - BanAddEvent::class, BanRemoveEvent::class, GuildAuditLogEntryCreateEvent::class -> +GuildBans + GuildAuditLogEntryCreateEvent::class, BanAddEvent::class, BanRemoveEvent::class -> +GuildBans EmojisUpdateEvent::class -> +GuildEmojis From b2f07130536564f65c64e05820e43c43a3ce7222 Mon Sep 17 00:00:00 2001 From: Lukellmann Date: Sat, 25 Mar 2023 02:57:52 +0100 Subject: [PATCH 33/42] Rename DiscordDefaultReaction to DefaultReaction It is used in core and does not contain any optional fields. --- common/api/common.api | 62 +++++++++---------- .../src/main/kotlin/entity/DiscordChannel.kt | 4 +- core/api/core.api | 2 +- .../src/main/kotlin/cache/data/ChannelData.kt | 2 +- .../kotlin/entity/channel/ForumChannel.kt | 4 +- rest/api/rest.api | 8 +-- .../channel/EditGuildChannelBuilder.kt | 6 +- .../channel/ForumChannelCreateBuilder.kt | 6 +- .../kotlin/json/request/ChannelRequests.kt | 2 +- .../main/kotlin/json/request/GuildRequests.kt | 2 +- 10 files changed, 49 insertions(+), 49 deletions(-) diff --git a/common/api/common.api b/common/api/common.api index 4344a6247e82..146e2828ab48 100644 --- a/common/api/common.api +++ b/common/api/common.api @@ -1917,6 +1917,37 @@ public final class dev/kord/common/entity/DefaultMessageNotificationLevel$Unknow public fun (I)V } +public final class dev/kord/common/entity/DefaultReaction { + public static final field Companion Ldev/kord/common/entity/DefaultReaction$Companion; + public synthetic fun (ILdev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V + public fun (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;)V + public final fun component1 ()Ldev/kord/common/entity/Snowflake; + public final fun component2 ()Ljava/lang/String; + public final fun copy (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;)Ldev/kord/common/entity/DefaultReaction; + public static synthetic fun copy$default (Ldev/kord/common/entity/DefaultReaction;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;ILjava/lang/Object;)Ldev/kord/common/entity/DefaultReaction; + public fun equals (Ljava/lang/Object;)Z + public final fun getEmojiId ()Ldev/kord/common/entity/Snowflake; + public final fun getEmojiName ()Ljava/lang/String; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; + public static final fun write$Self (Ldev/kord/common/entity/DefaultReaction;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V +} + +public final class dev/kord/common/entity/DefaultReaction$$serializer : kotlinx/serialization/internal/GeneratedSerializer { + public static final field INSTANCE Ldev/kord/common/entity/DefaultReaction$$serializer; + public fun childSerializers ()[Lkotlinx/serialization/KSerializer; + public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ldev/kord/common/entity/DefaultReaction; + 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/entity/DefaultReaction;)V + public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V + public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer; +} + +public final class dev/kord/common/entity/DefaultReaction$Companion { + public final fun serializer ()Lkotlinx/serialization/KSerializer; +} + public final class dev/kord/common/entity/DeletedMessage { public static final field Companion Ldev/kord/common/entity/DeletedMessage$Companion; public synthetic fun (ILdev/kord/common/entity/Snowflake;Ldev/kord/common/entity/Snowflake;Ldev/kord/common/entity/optional/OptionalSnowflake;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V @@ -3074,37 +3105,6 @@ public final class dev/kord/common/entity/DiscordConnectionVisibility$Unknown : public fun (I)V } -public final class dev/kord/common/entity/DiscordDefaultReaction { - public static final field Companion Ldev/kord/common/entity/DiscordDefaultReaction$Companion; - public synthetic fun (ILdev/kord/common/entity/Snowflake;Ljava/lang/String;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V - public fun (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;)V - public final fun component1 ()Ldev/kord/common/entity/Snowflake; - public final fun component2 ()Ljava/lang/String; - public final fun copy (Ldev/kord/common/entity/Snowflake;Ljava/lang/String;)Ldev/kord/common/entity/DiscordDefaultReaction; - public static synthetic fun copy$default (Ldev/kord/common/entity/DiscordDefaultReaction;Ldev/kord/common/entity/Snowflake;Ljava/lang/String;ILjava/lang/Object;)Ldev/kord/common/entity/DiscordDefaultReaction; - public fun equals (Ljava/lang/Object;)Z - public final fun getEmojiId ()Ldev/kord/common/entity/Snowflake; - public final fun getEmojiName ()Ljava/lang/String; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; - public static final fun write$Self (Ldev/kord/common/entity/DiscordDefaultReaction;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V -} - -public final class dev/kord/common/entity/DiscordDefaultReaction$$serializer : kotlinx/serialization/internal/GeneratedSerializer { - public static final field INSTANCE Ldev/kord/common/entity/DiscordDefaultReaction$$serializer; - public fun childSerializers ()[Lkotlinx/serialization/KSerializer; - public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ldev/kord/common/entity/DiscordDefaultReaction; - 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/entity/DiscordDefaultReaction;)V - public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V - public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer; -} - -public final class dev/kord/common/entity/DiscordDefaultReaction$Companion { - public final fun serializer ()Lkotlinx/serialization/KSerializer; -} - public final class dev/kord/common/entity/DiscordDeletedGuildRole { public static final field Companion Ldev/kord/common/entity/DiscordDeletedGuildRole$Companion; public synthetic fun (ILdev/kord/common/entity/Snowflake;Ldev/kord/common/entity/Snowflake;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V diff --git a/common/src/main/kotlin/entity/DiscordChannel.kt b/common/src/main/kotlin/entity/DiscordChannel.kt index 7e5d52f99ebb..6e6b533b736d 100644 --- a/common/src/main/kotlin/entity/DiscordChannel.kt +++ b/common/src/main/kotlin/entity/DiscordChannel.kt @@ -153,7 +153,7 @@ public data class DiscordChannel( @SerialName("applied_tags") val appliedTags: Optional> = Optional.Missing(), @SerialName("default_reaction_emoji") - val defaultReactionEmoji: Optional = Optional.Missing(), + val defaultReactionEmoji: Optional = Optional.Missing(), @SerialName("default_thread_rate_limit_per_user") val defaultThreadRateLimitPerUser: Optional = Optional.Missing(), @SerialName("default_sort_order") @@ -332,7 +332,7 @@ public sealed class ArchiveDuration( } @Serializable -public data class DiscordDefaultReaction( +public data class DefaultReaction( @SerialName("emoji_id") val emojiId: Snowflake?, @SerialName("emoji_name") diff --git a/core/api/core.api b/core/api/core.api index 01bea70cecae..b65e8b2b05d6 100644 --- a/core/api/core.api +++ b/core/api/core.api @@ -7826,7 +7826,7 @@ public final class dev/kord/core/entity/channel/ForumChannel : dev/kord/core/beh public fun getCategoryId ()Ldev/kord/common/entity/Snowflake; public fun getData ()Ldev/kord/core/cache/data/ChannelData; public final fun getDefaultForumLayout ()Ldev/kord/common/entity/ForumLayoutType; - public final fun getDefaultReactionEmoji ()Ldev/kord/common/entity/DiscordDefaultReaction; + public final fun getDefaultReactionEmoji ()Ldev/kord/common/entity/DefaultReaction; public final fun getDefaultThreadRateLimitPerUser-FghU774 ()Lkotlin/time/Duration; public fun getEffectivePermissions (Ldev/kord/common/entity/Snowflake;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun getFlags ()Ldev/kord/common/entity/ChannelFlags; diff --git a/core/src/main/kotlin/cache/data/ChannelData.kt b/core/src/main/kotlin/cache/data/ChannelData.kt index 9a54f2112161..aca695c204f2 100644 --- a/core/src/main/kotlin/cache/data/ChannelData.kt +++ b/core/src/main/kotlin/cache/data/ChannelData.kt @@ -42,7 +42,7 @@ public data class ChannelData( val defaultForumLayout: Optional = Optional.Missing(), val availableTags: Optional> = Optional.Missing(), val appliedTags: Optional> = Optional.Missing(), - val defaultReactionEmoji: Optional = Optional.Missing(), + val defaultReactionEmoji: Optional = Optional.Missing(), val defaultThreadRateLimitPerUser: Optional = Optional.Missing(), val message: Optional = Optional.Missing() ) { diff --git a/core/src/main/kotlin/entity/channel/ForumChannel.kt b/core/src/main/kotlin/entity/channel/ForumChannel.kt index b846a8b16dae..aa2786e64ff3 100644 --- a/core/src/main/kotlin/entity/channel/ForumChannel.kt +++ b/core/src/main/kotlin/entity/channel/ForumChannel.kt @@ -1,6 +1,6 @@ package dev.kord.core.entity.channel -import dev.kord.common.entity.DiscordDefaultReaction +import dev.kord.common.entity.DefaultReaction import dev.kord.common.entity.ForumTag import dev.kord.common.entity.ForumLayoutType import dev.kord.core.Kord @@ -23,7 +23,7 @@ public class ForumChannel( public val availableTags: List get() = data.availableTags.value ?: emptyList() - public val defaultReactionEmoji: DiscordDefaultReaction? get() = data.defaultReactionEmoji.value + public val defaultReactionEmoji: DefaultReaction? get() = data.defaultReactionEmoji.value public val defaultThreadRateLimitPerUser: Duration? get() = data.defaultThreadRateLimitPerUser.value diff --git a/rest/api/rest.api b/rest/api/rest.api index a124c42038ae..04b42435911b 100644 --- a/rest/api/rest.api +++ b/rest/api/rest.api @@ -414,7 +414,7 @@ public final class dev/kord/rest/builder/channel/ForumChannelCreateBuilder : dev public final fun getAvailableTags ()Ljava/util/List; public final fun getDefaultAutoArchiveDuration ()Ldev/kord/common/entity/ArchiveDuration; public final fun getDefaultForumLayout ()Ldev/kord/common/entity/ForumLayoutType; - public final fun getDefaultReactionEmoji ()Ldev/kord/common/entity/DiscordDefaultReaction; + public final fun getDefaultReactionEmoji ()Ldev/kord/common/entity/DefaultReaction; public final fun getDefaultReactionEmojiId ()Ldev/kord/common/entity/Snowflake; public final fun getDefaultReactionEmojiName ()Ljava/lang/String; public final fun getDefaultSortOrder ()Ldev/kord/common/entity/SortOrderType; @@ -431,7 +431,7 @@ public final class dev/kord/rest/builder/channel/ForumChannelCreateBuilder : dev public final fun setAvailableTags (Ljava/util/List;)V public final fun setDefaultAutoArchiveDuration (Ldev/kord/common/entity/ArchiveDuration;)V public final fun setDefaultForumLayout (Ldev/kord/common/entity/ForumLayoutType;)V - public final fun setDefaultReactionEmoji (Ldev/kord/common/entity/DiscordDefaultReaction;)V + public final fun setDefaultReactionEmoji (Ldev/kord/common/entity/DefaultReaction;)V public final fun setDefaultReactionEmojiId (Ldev/kord/common/entity/Snowflake;)V public final fun setDefaultReactionEmojiName (Ljava/lang/String;)V public final fun setDefaultSortOrder (Ldev/kord/common/entity/SortOrderType;)V @@ -457,7 +457,7 @@ public final class dev/kord/rest/builder/channel/ForumChannelModifyBuilder : dev public final fun getAvailableTags ()Ljava/util/List; public final fun getDefaultAutoArchiveDuration ()Ldev/kord/common/entity/ArchiveDuration; public final fun getDefaultForumLayout ()Ldev/kord/common/entity/ForumLayoutType; - public final fun getDefaultReactionEmoji ()Ldev/kord/common/entity/DiscordDefaultReaction; + public final fun getDefaultReactionEmoji ()Ldev/kord/common/entity/DefaultReaction; public final fun getDefaultReactionEmojiId ()Ldev/kord/common/entity/Snowflake; public final fun getDefaultReactionEmojiName ()Ljava/lang/String; public final fun getDefaultSortOrder ()Ldev/kord/common/entity/SortOrderType; @@ -474,7 +474,7 @@ public final class dev/kord/rest/builder/channel/ForumChannelModifyBuilder : dev public final fun setAvailableTags (Ljava/util/List;)V public final fun setDefaultAutoArchiveDuration (Ldev/kord/common/entity/ArchiveDuration;)V public final fun setDefaultForumLayout (Ldev/kord/common/entity/ForumLayoutType;)V - public final fun setDefaultReactionEmoji (Ldev/kord/common/entity/DiscordDefaultReaction;)V + public final fun setDefaultReactionEmoji (Ldev/kord/common/entity/DefaultReaction;)V public final fun setDefaultReactionEmojiId (Ldev/kord/common/entity/Snowflake;)V public final fun setDefaultReactionEmojiName (Ljava/lang/String;)V public final fun setDefaultSortOrder (Ldev/kord/common/entity/SortOrderType;)V diff --git a/rest/src/main/kotlin/builder/channel/EditGuildChannelBuilder.kt b/rest/src/main/kotlin/builder/channel/EditGuildChannelBuilder.kt index 12b74f561ded..99c46dcf48ae 100644 --- a/rest/src/main/kotlin/builder/channel/EditGuildChannelBuilder.kt +++ b/rest/src/main/kotlin/builder/channel/EditGuildChannelBuilder.kt @@ -98,8 +98,8 @@ public class ForumChannelModifyBuilder : PermissionOverwritesModifyBuilder, private var _flags: Optional = Optional.Missing() public var flags: ChannelFlags? by ::_flags.delegate() - private var _defaultReactionEmoji: Optional = Optional.Missing() - public var defaultReactionEmoji: DiscordDefaultReaction? by ::_defaultReactionEmoji.delegate() + private var _defaultReactionEmoji: Optional = Optional.Missing() + public var defaultReactionEmoji: DefaultReaction? by ::_defaultReactionEmoji.delegate() public var defaultReactionEmojiId: Snowflake? = null public var defaultReactionEmojiName: String? = null @@ -135,7 +135,7 @@ public class ForumChannelModifyBuilder : PermissionOverwritesModifyBuilder, defaultAutoArchiveDuration = _defaultAutoArchiveDuration, defaultReactionEmoji = when { defaultReactionEmojiId != null || defaultReactionEmojiName != null -> - DiscordDefaultReaction( + DefaultReaction( emojiId = defaultReactionEmojiId, emojiName = defaultReactionEmojiName, ).optional() diff --git a/rest/src/main/kotlin/builder/channel/ForumChannelCreateBuilder.kt b/rest/src/main/kotlin/builder/channel/ForumChannelCreateBuilder.kt index bf4e75ad964c..00d58a8a6d8a 100644 --- a/rest/src/main/kotlin/builder/channel/ForumChannelCreateBuilder.kt +++ b/rest/src/main/kotlin/builder/channel/ForumChannelCreateBuilder.kt @@ -43,8 +43,8 @@ public class ForumChannelCreateBuilder(public var name: String) : override var permissionOverwrites: MutableSet = mutableSetOf() - private var _defaultReactionEmoji: Optional = Optional.Missing() - public var defaultReactionEmoji: DiscordDefaultReaction? by ::_defaultReactionEmoji.delegate() + private var _defaultReactionEmoji: Optional = Optional.Missing() + public var defaultReactionEmoji: DefaultReaction? by ::_defaultReactionEmoji.delegate() public var defaultReactionEmojiId: Snowflake? = null public var defaultReactionEmojiName: String? = null @@ -84,7 +84,7 @@ public class ForumChannelCreateBuilder(public var name: String) : defaultAutoArchiveDuration = _defaultAutoArchiveDuration, defaultReactionEmoji = when { defaultReactionEmojiId != null || defaultReactionEmojiName != null -> - DiscordDefaultReaction( + DefaultReaction( emojiId = defaultReactionEmojiId, emojiName = defaultReactionEmojiName, ).optional() diff --git a/rest/src/main/kotlin/json/request/ChannelRequests.kt b/rest/src/main/kotlin/json/request/ChannelRequests.kt index 98b03c795109..449bf1a4965c 100644 --- a/rest/src/main/kotlin/json/request/ChannelRequests.kt +++ b/rest/src/main/kotlin/json/request/ChannelRequests.kt @@ -55,7 +55,7 @@ public data class ChannelModifyPatchRequest( @SerialName("default_auto_archive_duration") val defaultAutoArchiveDuration: Optional = Optional.Missing(), @SerialName("default_reaction_emoji") - val defaultReactionEmoji: Optional = Optional.Missing(), + val defaultReactionEmoji: Optional = Optional.Missing(), @SerialName("default_thread_rate_limit_per_user") val defaultThreadRateLimitPerUser: Optional = Optional.Missing(), val flags: Optional = Optional.Missing(), diff --git a/rest/src/main/kotlin/json/request/GuildRequests.kt b/rest/src/main/kotlin/json/request/GuildRequests.kt index 1591a5fd193e..61178fa86425 100644 --- a/rest/src/main/kotlin/json/request/GuildRequests.kt +++ b/rest/src/main/kotlin/json/request/GuildRequests.kt @@ -60,7 +60,7 @@ public data class GuildChannelCreateRequest( @SerialName("default_auto_archive_duration") val defaultAutoArchiveDuration: Optional = Optional.Missing(), @SerialName("default_reaction_emoji") - val defaultReactionEmoji: Optional = Optional.Missing(), + val defaultReactionEmoji: Optional = Optional.Missing(), @SerialName("default_thread_rate_limit_per_user") val defaultThreadRateLimitPerUser: Optional = Optional.Missing(), val flags: Optional = Optional.Missing(), From 568176e4995e9ccf6edd1f4a64195e51e8466c90 Mon Sep 17 00:00:00 2001 From: Lukellmann Date: Sat, 25 Mar 2023 03:00:48 +0100 Subject: [PATCH 34/42] Add missing properties to ForumChannel and TextChannel --- core/api/core.api | 5 +++++ .../kotlin/entity/channel/ForumChannel.kt | 20 ++++++++++++++++--- .../main/kotlin/entity/channel/TextChannel.kt | 2 ++ 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/core/api/core.api b/core/api/core.api index b65e8b2b05d6..e1db183a7400 100644 --- a/core/api/core.api +++ b/core/api/core.api @@ -7825,8 +7825,10 @@ public final class dev/kord/core/entity/channel/ForumChannel : dev/kord/core/beh public fun getCategory ()Ldev/kord/core/behavior/channel/CategoryBehavior; public fun getCategoryId ()Ldev/kord/common/entity/Snowflake; public fun getData ()Ldev/kord/core/cache/data/ChannelData; + public final fun getDefaultAutoArchiveDuration ()Ldev/kord/common/entity/ArchiveDuration; public final fun getDefaultForumLayout ()Ldev/kord/common/entity/ForumLayoutType; public final fun getDefaultReactionEmoji ()Ldev/kord/common/entity/DefaultReaction; + public final fun getDefaultSortOrder ()Ldev/kord/common/entity/SortOrderType; public final fun getDefaultThreadRateLimitPerUser-FghU774 ()Lkotlin/time/Duration; public fun getEffectivePermissions (Ldev/kord/common/entity/Snowflake;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun getFlags ()Ldev/kord/common/entity/ChannelFlags; @@ -7844,11 +7846,13 @@ public final class dev/kord/core/entity/channel/ForumChannel : dev/kord/core/beh public fun getPermissionOverwritesForRole (Ldev/kord/common/entity/Snowflake;)Ldev/kord/core/entity/PermissionOverwriteEntity; public fun getPosition (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun getPublicArchivedThreads (Lkotlinx/datetime/Instant;Ljava/lang/Integer;)Lkotlinx/coroutines/flow/Flow; + public final fun getRateLimitPerUser-FghU774 ()Lkotlin/time/Duration; public fun getRawPosition ()I public fun getSupplier ()Ldev/kord/core/supplier/EntitySupplier; public final fun getTopic ()Ljava/lang/String; public fun getType ()Ldev/kord/common/entity/ChannelType; public fun getWebhooks ()Lkotlinx/coroutines/flow/Flow; + public final fun isNsfw ()Z public fun startPublicThread (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun toString ()Ljava/lang/String; public synthetic fun withStrategy (Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/behavior/channel/CategorizableChannelBehavior; @@ -8175,6 +8179,7 @@ public final class dev/kord/core/entity/channel/TextChannel : dev/kord/core/beha public fun getCategory ()Ldev/kord/core/behavior/channel/CategoryBehavior; public fun getCategoryId ()Ldev/kord/common/entity/Snowflake; public fun getData ()Ldev/kord/core/cache/data/ChannelData; + public final fun getDefaultThreadRateLimitPerUser-FghU774 ()Lkotlin/time/Duration; public fun getEffectivePermissions (Ldev/kord/common/entity/Snowflake;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun getFlags ()Ldev/kord/common/entity/ChannelFlags; public fun getGuild ()Ldev/kord/core/behavior/GuildBehavior; diff --git a/core/src/main/kotlin/entity/channel/ForumChannel.kt b/core/src/main/kotlin/entity/channel/ForumChannel.kt index aa2786e64ff3..e2acb0121680 100644 --- a/core/src/main/kotlin/entity/channel/ForumChannel.kt +++ b/core/src/main/kotlin/entity/channel/ForumChannel.kt @@ -1,8 +1,8 @@ package dev.kord.core.entity.channel -import dev.kord.common.entity.DefaultReaction -import dev.kord.common.entity.ForumTag -import dev.kord.common.entity.ForumLayoutType +import dev.kord.common.entity.* +import dev.kord.common.entity.Permission.ManageChannels +import dev.kord.common.entity.Permission.ManageMessages import dev.kord.core.Kord import dev.kord.core.behavior.channel.ForumChannelBehavior import dev.kord.core.cache.data.ChannelData @@ -21,12 +21,26 @@ public class ForumChannel( */ public val topic: String? get() = data.topic.value + /** Whether the channel is nsfw. */ + public val isNsfw: Boolean get() = data.nsfw.orElse(false) + public val availableTags: List get() = data.availableTags.value ?: emptyList() public val defaultReactionEmoji: DefaultReaction? get() = data.defaultReactionEmoji.value + /** + * The amount of time a user has to wait before creating another thread. + * + * Bots, as well as users with the permission [ManageMessages] or [ManageChannels], are unaffected. + */ + public val rateLimitPerUser: Duration? get() = data.rateLimitPerUser.value + public val defaultThreadRateLimitPerUser: Duration? get() = data.defaultThreadRateLimitPerUser.value + public val defaultAutoArchiveDuration: ArchiveDuration? get() = data.defaultAutoArchiveDuration.value + + /** The default sort order type used to order posts in this forum channel. */ + public val defaultSortOrder: SortOrderType? get() = data.defaultSortOrder.value /** * The default layout of the forum, if present. diff --git a/core/src/main/kotlin/entity/channel/TextChannel.kt b/core/src/main/kotlin/entity/channel/TextChannel.kt index 4ef2c449fdf6..4bb53c2b6f69 100644 --- a/core/src/main/kotlin/entity/channel/TextChannel.kt +++ b/core/src/main/kotlin/entity/channel/TextChannel.kt @@ -33,6 +33,8 @@ public class TextChannel( */ public val userRateLimit: Duration? get() = data.rateLimitPerUser.value + public val defaultThreadRateLimitPerUser: Duration? get() = data.defaultThreadRateLimitPerUser.value + /** * returns a new [TextChannel] with the given [strategy]. * From 28919a113da31430bd0527b0ca5b5f38262fe0cd Mon Sep 17 00:00:00 2001 From: Lukellmann Date: Sat, 25 Mar 2023 03:41:01 +0100 Subject: [PATCH 35/42] Update message count caching Updating lastMessageId and message counts was combined into one update operation for MessageCreate. totalMessageSent is no longer decremented on MessageDelete and MessageDeleteBulk, the whole point of it is to not decrement. --- .../gateway/handler/MessageEventHandler.kt | 44 ++++++------------- 1 file changed, 13 insertions(+), 31 deletions(-) diff --git a/core/src/main/kotlin/gateway/handler/MessageEventHandler.kt b/core/src/main/kotlin/gateway/handler/MessageEventHandler.kt index 134f1fa29211..372b99a5bc6f 100644 --- a/core/src/main/kotlin/gateway/handler/MessageEventHandler.kt +++ b/core/src/main/kotlin/gateway/handler/MessageEventHandler.kt @@ -9,7 +9,6 @@ import dev.kord.core.cache.idEq import dev.kord.core.entity.Member import dev.kord.core.entity.Message import dev.kord.core.entity.ReactionEmoji -import dev.kord.core.entity.channel.Channel import dev.kord.core.event.message.* import dev.kord.gateway.* import kotlinx.coroutines.flow.map @@ -44,11 +43,14 @@ internal class MessageEventHandler : BaseGatewayEventHandler() { val data = MessageData.from(this) kord.cache.put(data) - val query = kord.cache.query { idEq(ChannelData::id, channelId) } - - query.update { - it.copy(lastMessageId = data.id.optionalSnowflake()) + kord.cache.query { idEq(ChannelData::id, channelId) }.update { channel -> + channel.copy( + lastMessageId = data.id.optionalSnowflake(), + messageCount = channel.messageCount.map { it + 1 }, + totalMessageSent = channel.totalMessageSent.map { it + 1 }, + ) } + //get the user data only if it exists and the user isn't a webhook val userData = if (webhookId is OptionalSnowflake.Missing) { UserData.from(author).also { kord.cache.put(it) } @@ -67,16 +69,6 @@ internal class MessageEventHandler : BaseGatewayEventHandler() { kord.cache.put(interactionUserData) } - // Cache message count and total messages sent if present. - query.update { - if (it.messageCount is OptionalInt.Value && it.totalMessageSent is OptionalInt.Value) { - val newMessageCount = it.messageCount.value + 1 - val newTotalSent = it.totalMessageSent.value + 1 - it.copy(messageCount = newMessageCount.optionalInt(), totalMessageSent = newTotalSent.optionalInt()) - } else it.copy(messageCount = it.messageCount, totalMessageSent = it.totalMessageSent) - } - - mentions.forEach { val user = UserData.from(it) kord.cache.put(user) @@ -117,17 +109,12 @@ internal class MessageEventHandler : BaseGatewayEventHandler() { context: LazyContext?, ): MessageDeleteEvent = with(event.message) { val query = kord.cache.query { idEq(MessageData::id, id) } - val channelQuery = kord.cache.query { idEq(ChannelData::id, channelId)} val removed = query.singleOrNull()?.let { Message(it, kord) } query.remove() - channelQuery.update { - if (it.messageCount is OptionalInt.Value && it.totalMessageSent is OptionalInt.Value) { - val newMessageCount = it.messageCount.value - 1 - val newTotalSent = it.totalMessageSent.value - 1 - it.copy(messageCount = newMessageCount.optionalInt(), totalMessageSent = newTotalSent.optionalInt()) - } else it.copy(messageCount = it.messageCount, totalMessageSent = it.totalMessageSent) + kord.cache.query { idEq(ChannelData::id, channelId) }.update { channel -> + channel.copy(messageCount = channel.messageCount.map { it - 1 }) } MessageDeleteEvent(id, channelId, guildId.value, removed, kord, shard, context?.get()) @@ -140,22 +127,17 @@ internal class MessageEventHandler : BaseGatewayEventHandler() { context: LazyContext?, ): MessageBulkDeleteEvent = with(event.messageBulk) { + val ids = ids.toSet() + val query = kord.cache.query { MessageData::id `in` ids } - val channelQuery = kord.cache.query { idEq(ChannelData::id, channelId)} val removed = query.asFlow().map { Message(it, kord) }.toSet() query.remove() - channelQuery.update { - if (it.messageCount is OptionalInt.Value && it.totalMessageSent is OptionalInt.Value) { - val newMessageCount = it.messageCount.value - ids.size - val newTotalSent = it.totalMessageSent.value - ids.size - it.copy(messageCount = newMessageCount.optionalInt(), totalMessageSent = newTotalSent.optionalInt()) - } else it.copy(messageCount = it.messageCount, totalMessageSent = it.totalMessageSent) + kord.cache.query { idEq(ChannelData::id, channelId) }.update { channel -> + channel.copy(messageCount = channel.messageCount.map { it - ids.size }) } - val ids = ids.asSequence().map { it }.toSet() - MessageBulkDeleteEvent( ids, removed, From 0044885e7476218e66fb584ae1bb3e204906df73 Mon Sep 17 00:00:00 2001 From: Lukellmann Date: Sat, 25 Mar 2023 04:49:18 +0100 Subject: [PATCH 36/42] Add changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c20894e1185..ece138be6dc2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ * Make `Snowflake`'s ordering consistent with `equals` (by @Lukellmann in #773) * Fix various bugs in `DiscordBitSet` (by @Lukellmann in #772) * Use 74 byte ip discovery packet instead of the deprecated 70 byte discovery packet (by @lost-illusi0n in #776) +* Fix breaking changes and bugs before release (by @Lukellmann in #793) ## Dependencies From 107ddab9400d0249e980ded5f5345d55a6dac8a3 Mon Sep 17 00:00:00 2001 From: Lukellmann Date: Sat, 25 Mar 2023 06:02:24 +0100 Subject: [PATCH 37/42] Remove default value for builder Not having a default empty builder lambda in ForumChannelBehavior.startPublicThread will nudge users into thinking about what belongs in there. This is needed because you have to provide a message in that lambda to successfully create a forum post. --- core/api/core.api | 1 - core/src/main/kotlin/behavior/channel/ForumChannelBehavior.kt | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/core/api/core.api b/core/api/core.api index e1db183a7400..6d24418d87d9 100644 --- a/core/api/core.api +++ b/core/api/core.api @@ -1112,7 +1112,6 @@ public final class dev/kord/core/behavior/channel/ForumChannelBehavior$DefaultIm public static fun getPublicArchivedThreads (Ldev/kord/core/behavior/channel/ForumChannelBehavior;Lkotlinx/datetime/Instant;Ljava/lang/Integer;)Lkotlinx/coroutines/flow/Flow; public static fun getWebhooks (Ldev/kord/core/behavior/channel/ForumChannelBehavior;)Lkotlinx/coroutines/flow/Flow; public static fun startPublicThread (Ldev/kord/core/behavior/channel/ForumChannelBehavior;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static synthetic fun startPublicThread$default (Ldev/kord/core/behavior/channel/ForumChannelBehavior;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; } public final class dev/kord/core/behavior/channel/ForumChannelBehaviorKt { diff --git a/core/src/main/kotlin/behavior/channel/ForumChannelBehavior.kt b/core/src/main/kotlin/behavior/channel/ForumChannelBehavior.kt index b5e2b66fc670..cc633399bae6 100644 --- a/core/src/main/kotlin/behavior/channel/ForumChannelBehavior.kt +++ b/core/src/main/kotlin/behavior/channel/ForumChannelBehavior.kt @@ -29,7 +29,7 @@ public interface ForumChannelBehavior : ThreadParentChannelBehavior { public suspend fun startPublicThread( name: String, - builder: StartForumThreadBuilder.() -> Unit = {}, + builder: StartForumThreadBuilder.() -> Unit, ): TextChannelThread { return unsafeStartForumThread(name, builder) } From 1a7d5db5d447e87eab6bfcf036dd437e4f140f7d Mon Sep 17 00:00:00 2001 From: Lukellmann Date: Sat, 25 Mar 2023 06:04:36 +0100 Subject: [PATCH 38/42] Add ThreadChannel.totalMessageSent --- core/api/core.api | 28 +++++++++++++------ .../entity/channel/thread/ThreadChannel.kt | 23 +++++++++++---- 2 files changed, 37 insertions(+), 14 deletions(-) diff --git a/core/api/core.api b/core/api/core.api index 6d24418d87d9..c5af897aee9e 100644 --- a/core/api/core.api +++ b/core/api/core.api @@ -8526,12 +8526,14 @@ public final class dev/kord/core/entity/channel/thread/NewsChannelThread : dev/k public fun getLastMessageId ()Ldev/kord/common/entity/Snowflake; public fun getLastPinTimestamp ()Lkotlinx/datetime/Instant; public fun getMember ()Ldev/kord/core/entity/channel/thread/ThreadMember; - public fun getMemberCount ()Ldev/kord/common/entity/optional/OptionalInt; + public synthetic fun getMemberCount ()Ldev/kord/common/entity/optional/OptionalInt; + public fun getMemberCount ()Ljava/lang/Integer; public fun getMembers ()Lkotlinx/coroutines/flow/Flow; public fun getMention ()Ljava/lang/String; public fun getMessage ()Ldev/kord/core/entity/Message; public fun getMessage (Ldev/kord/common/entity/Snowflake;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public fun getMessageCount ()Ldev/kord/common/entity/optional/OptionalInt; + public synthetic fun getMessageCount ()Ldev/kord/common/entity/optional/OptionalInt; + public fun getMessageCount ()Ljava/lang/Integer; public fun getMessageOrNull (Ldev/kord/common/entity/Snowflake;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun getMessages ()Lkotlinx/coroutines/flow/Flow; public fun getMessagesAfter (Ldev/kord/common/entity/Snowflake;Ljava/lang/Integer;)Lkotlinx/coroutines/flow/Flow; @@ -8547,6 +8549,7 @@ public final class dev/kord/core/entity/channel/thread/NewsChannelThread : dev/k public fun getPinnedMessages ()Lkotlinx/coroutines/flow/Flow; public fun getRateLimitPerUser-FghU774 ()Lkotlin/time/Duration; public fun getSupplier ()Ldev/kord/core/supplier/EntitySupplier; + public fun getTotalMessageSent ()Ljava/lang/Integer; public fun getType ()Ldev/kord/common/entity/ChannelType; public fun isArchived ()Z public fun isLocked ()Z @@ -8604,12 +8607,14 @@ public final class dev/kord/core/entity/channel/thread/TextChannelThread : dev/k public fun getLastMessageId ()Ldev/kord/common/entity/Snowflake; public fun getLastPinTimestamp ()Lkotlinx/datetime/Instant; public fun getMember ()Ldev/kord/core/entity/channel/thread/ThreadMember; - public fun getMemberCount ()Ldev/kord/common/entity/optional/OptionalInt; + public synthetic fun getMemberCount ()Ldev/kord/common/entity/optional/OptionalInt; + public fun getMemberCount ()Ljava/lang/Integer; public fun getMembers ()Lkotlinx/coroutines/flow/Flow; public fun getMention ()Ljava/lang/String; public fun getMessage ()Ldev/kord/core/entity/Message; public fun getMessage (Ldev/kord/common/entity/Snowflake;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public fun getMessageCount ()Ldev/kord/common/entity/optional/OptionalInt; + public synthetic fun getMessageCount ()Ldev/kord/common/entity/optional/OptionalInt; + public fun getMessageCount ()Ljava/lang/Integer; public fun getMessageOrNull (Ldev/kord/common/entity/Snowflake;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun getMessages ()Lkotlinx/coroutines/flow/Flow; public fun getMessagesAfter (Ldev/kord/common/entity/Snowflake;Ljava/lang/Integer;)Lkotlinx/coroutines/flow/Flow; @@ -8625,6 +8630,7 @@ public final class dev/kord/core/entity/channel/thread/TextChannelThread : dev/k public fun getPinnedMessages ()Lkotlinx/coroutines/flow/Flow; public fun getRateLimitPerUser-FghU774 ()Lkotlin/time/Duration; public fun getSupplier ()Ldev/kord/core/supplier/EntitySupplier; + public fun getTotalMessageSent ()Ljava/lang/Integer; public fun getType ()Ldev/kord/common/entity/ChannelType; public fun isArchived ()Z public final fun isInvitable ()Z @@ -8658,13 +8664,16 @@ public abstract interface class dev/kord/core/entity/channel/thread/ThreadChanne public abstract fun getCreateTimestamp ()Lkotlinx/datetime/Instant; public abstract fun getDefaultAutoArchiveDuration ()Ldev/kord/common/entity/ArchiveDuration; public abstract fun getMember ()Ldev/kord/core/entity/channel/thread/ThreadMember; - public abstract fun getMemberCount ()Ldev/kord/common/entity/optional/OptionalInt; + public abstract synthetic fun getMemberCount ()Ldev/kord/common/entity/optional/OptionalInt; + public abstract fun getMemberCount ()Ljava/lang/Integer; public abstract fun getMessage ()Ldev/kord/core/entity/Message; - public abstract fun getMessageCount ()Ldev/kord/common/entity/optional/OptionalInt; + public abstract synthetic fun getMessageCount ()Ldev/kord/common/entity/optional/OptionalInt; + public abstract fun getMessageCount ()Ljava/lang/Integer; public abstract fun getOwner ()Ldev/kord/core/behavior/UserBehavior; public abstract fun getOwnerId ()Ldev/kord/common/entity/Snowflake; public abstract fun getParentId ()Ldev/kord/common/entity/Snowflake; public abstract fun getRateLimitPerUser-FghU774 ()Lkotlin/time/Duration; + public abstract fun getTotalMessageSent ()Ljava/lang/Integer; public abstract fun isArchived ()Z public abstract fun isLocked ()Z public abstract fun isNsfw ()Z @@ -8699,12 +8708,14 @@ public final class dev/kord/core/entity/channel/thread/ThreadChannel$DefaultImpl public static fun getLastMessageId (Ldev/kord/core/entity/channel/thread/ThreadChannel;)Ldev/kord/common/entity/Snowflake; public static fun getLastPinTimestamp (Ldev/kord/core/entity/channel/thread/ThreadChannel;)Lkotlinx/datetime/Instant; public static fun getMember (Ldev/kord/core/entity/channel/thread/ThreadChannel;)Ldev/kord/core/entity/channel/thread/ThreadMember; - public static fun getMemberCount (Ldev/kord/core/entity/channel/thread/ThreadChannel;)Ldev/kord/common/entity/optional/OptionalInt; + public static synthetic fun getMemberCount (Ldev/kord/core/entity/channel/thread/ThreadChannel;)Ldev/kord/common/entity/optional/OptionalInt; + public static fun getMemberCount (Ldev/kord/core/entity/channel/thread/ThreadChannel;)Ljava/lang/Integer; public static fun getMembers (Ldev/kord/core/entity/channel/thread/ThreadChannel;)Lkotlinx/coroutines/flow/Flow; public static fun getMention (Ldev/kord/core/entity/channel/thread/ThreadChannel;)Ljava/lang/String; public static fun getMessage (Ldev/kord/core/entity/channel/thread/ThreadChannel;)Ldev/kord/core/entity/Message; public static fun getMessage (Ldev/kord/core/entity/channel/thread/ThreadChannel;Ldev/kord/common/entity/Snowflake;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static fun getMessageCount (Ldev/kord/core/entity/channel/thread/ThreadChannel;)Ldev/kord/common/entity/optional/OptionalInt; + public static synthetic fun getMessageCount (Ldev/kord/core/entity/channel/thread/ThreadChannel;)Ldev/kord/common/entity/optional/OptionalInt; + public static fun getMessageCount (Ldev/kord/core/entity/channel/thread/ThreadChannel;)Ljava/lang/Integer; public static fun getMessageOrNull (Ldev/kord/core/entity/channel/thread/ThreadChannel;Ldev/kord/common/entity/Snowflake;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun getMessages (Ldev/kord/core/entity/channel/thread/ThreadChannel;)Lkotlinx/coroutines/flow/Flow; public static fun getMessagesAfter (Ldev/kord/core/entity/channel/thread/ThreadChannel;Ldev/kord/common/entity/Snowflake;Ljava/lang/Integer;)Lkotlinx/coroutines/flow/Flow; @@ -8719,6 +8730,7 @@ public final class dev/kord/core/entity/channel/thread/ThreadChannel$DefaultImpl public static fun getParentOrNull (Ldev/kord/core/entity/channel/thread/ThreadChannel;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static fun getPinnedMessages (Ldev/kord/core/entity/channel/thread/ThreadChannel;)Lkotlinx/coroutines/flow/Flow; public static fun getRateLimitPerUser-FghU774 (Ldev/kord/core/entity/channel/thread/ThreadChannel;)Lkotlin/time/Duration; + public static fun getTotalMessageSent (Ldev/kord/core/entity/channel/thread/ThreadChannel;)Ljava/lang/Integer; public static fun getType (Ldev/kord/core/entity/channel/thread/ThreadChannel;)Ldev/kord/common/entity/ChannelType; public static fun isArchived (Ldev/kord/core/entity/channel/thread/ThreadChannel;)Z public static fun isLocked (Ldev/kord/core/entity/channel/thread/ThreadChannel;)Z diff --git a/core/src/main/kotlin/entity/channel/thread/ThreadChannel.kt b/core/src/main/kotlin/entity/channel/thread/ThreadChannel.kt index d57e73988afd..b61b91df179a 100644 --- a/core/src/main/kotlin/entity/channel/thread/ThreadChannel.kt +++ b/core/src/main/kotlin/entity/channel/thread/ThreadChannel.kt @@ -19,6 +19,7 @@ import dev.kord.core.supplier.EntitySupplier import dev.kord.core.supplier.EntitySupplyStrategy import dev.kord.rest.builder.channel.thread.ForumThreadModifyBuilder import kotlinx.datetime.Instant +import kotlin.DeprecationLevel.HIDDEN import kotlin.contracts.InvocationKind import kotlin.contracts.contract import kotlin.time.Duration @@ -83,17 +84,27 @@ public interface ThreadChannel : GuildMessageChannel, ThreadChannelBehavior { */ public val rateLimitPerUser: Duration? get() = data.rateLimitPerUser.value + @Deprecated("Binary compatibility, had different return type before. Keep for some releases.", level = HIDDEN) + public fun getMemberCount(): OptionalInt = data.memberCount + + /** An approximate count of users in this thread, stops counting at 50. */ + public val memberCount: Int? get() = data.memberCount.value + + @Deprecated("Binary compatibility, had different return type before. Keep for some releases.", level = HIDDEN) + public fun getMessageCount(): OptionalInt = data.messageCount + /** - * member count for this thread. - * approximate maximum value is 50. + * Number of messages (not including the initial message or deleted messages) in this thread. + * + * For threads created before July 1, 2022, the message count is inaccurate when it's greater than 50. */ - public val memberCount: OptionalInt get() = data.memberCount + public val messageCount: Int? get() = data.messageCount.value /** - * message count for this thread. - * approximate maximum value is 50. + * Number of messages ever sent in this thread, it's similar to [messageCount] on message creation, but will not + * decrement the number when a message is deleted. */ - public val messageCount: OptionalInt get() = data.messageCount + public val totalMessageSent: Int? get() = data.totalMessageSent.value /** * The default duration setup pre-selected for this thread. From fe935747913733d4cfc62315bc01ae154a318e9c Mon Sep 17 00:00:00 2001 From: Lukellmann Date: Sat, 25 Mar 2023 06:33:57 +0100 Subject: [PATCH 39/42] Align order with intents documentation --- core/src/main/kotlin/Util.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/kotlin/Util.kt b/core/src/main/kotlin/Util.kt index b3ef60f594f6..49e8e660a499 100644 --- a/core/src/main/kotlin/Util.kt +++ b/core/src/main/kotlin/Util.kt @@ -388,7 +388,7 @@ public fun Intents.IntentsBuilder.enableEvent(event: KClass): Unit = EmojisUpdateEvent::class -> +GuildEmojis - IntegrationCreateEvent::class, IntegrationUpdateEvent::class, IntegrationsUpdateEvent::class, IntegrationDeleteEvent::class -> +GuildIntegrations + IntegrationsUpdateEvent::class, IntegrationCreateEvent::class, IntegrationUpdateEvent::class, IntegrationDeleteEvent::class -> +GuildIntegrations WebhookUpdateEvent::class -> +GuildWebhooks From 15cc326d86f22757053fcd542da0a7d888957314 Mon Sep 17 00:00:00 2001 From: Lukellmann Date: Sat, 25 Mar 2023 07:17:22 +0100 Subject: [PATCH 40/42] Remove ThreadModifyBuilder It was almost the same as ThreadModifyBuilder, just with an additional flags property, which was just copied over to ThreadModifyBuilder. Having a single builder for both cases is more maintainable and keeps the API simpler. --- core/api/core.api | 4 -- .../entity/channel/thread/ThreadChannel.kt | 12 +--- rest/api/rest.api | 26 +-------- .../thread/ForumThreadModifyBuilder.kt | 55 ------------------- .../channel/thread/ThreadModifyBuilder.kt | 5 ++ 5 files changed, 8 insertions(+), 94 deletions(-) delete mode 100644 rest/src/main/kotlin/builder/channel/thread/ForumThreadModifyBuilder.kt diff --git a/core/api/core.api b/core/api/core.api index c5af897aee9e..bb842ea4d8d1 100644 --- a/core/api/core.api +++ b/core/api/core.api @@ -8744,10 +8744,6 @@ public final class dev/kord/core/entity/channel/thread/ThreadChannel$DefaultImpl public static fun withStrategy (Ldev/kord/core/entity/channel/thread/ThreadChannel;Ldev/kord/core/supplier/EntitySupplyStrategy;)Ldev/kord/core/entity/channel/thread/ThreadChannel; } -public final class dev/kord/core/entity/channel/thread/ThreadChannelKt { - public static final fun editAsForumThread (Ldev/kord/core/entity/channel/thread/ThreadChannel;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; -} - public final class dev/kord/core/entity/channel/thread/ThreadMember : dev/kord/core/behavior/ThreadMemberBehavior { public fun (Ldev/kord/core/cache/data/ThreadMemberData;Ldev/kord/core/Kord;Ldev/kord/core/supplier/EntitySupplier;)V public synthetic fun (Ldev/kord/core/cache/data/ThreadMemberData;Ldev/kord/core/Kord;Ldev/kord/core/supplier/EntitySupplier;ILkotlin/jvm/internal/DefaultConstructorMarker;)V diff --git a/core/src/main/kotlin/entity/channel/thread/ThreadChannel.kt b/core/src/main/kotlin/entity/channel/thread/ThreadChannel.kt index b61b91df179a..dd8353ab4c9a 100644 --- a/core/src/main/kotlin/entity/channel/thread/ThreadChannel.kt +++ b/core/src/main/kotlin/entity/channel/thread/ThreadChannel.kt @@ -11,17 +11,12 @@ import dev.kord.core.Kord import dev.kord.core.behavior.UserBehavior import dev.kord.core.behavior.channel.threads.ThreadChannelBehavior import dev.kord.core.cache.data.ChannelData -import dev.kord.core.cache.data.toData import dev.kord.core.entity.Message -import dev.kord.core.entity.channel.Channel import dev.kord.core.entity.channel.GuildMessageChannel import dev.kord.core.supplier.EntitySupplier import dev.kord.core.supplier.EntitySupplyStrategy -import dev.kord.rest.builder.channel.thread.ForumThreadModifyBuilder import kotlinx.datetime.Instant import kotlin.DeprecationLevel.HIDDEN -import kotlin.contracts.InvocationKind -import kotlin.contracts.contract import kotlin.time.Duration public interface ThreadChannel : GuildMessageChannel, ThreadChannelBehavior { @@ -132,12 +127,7 @@ public interface ThreadChannel : GuildMessageChannel, ThreadChannelBehavior { } } -public suspend inline fun ThreadChannel.editAsForumThread(builder: ForumThreadModifyBuilder.() -> Unit): TextChannelThread { - contract { callsInPlace(builder, InvocationKind.EXACTLY_ONCE) } - val appliedBuilder = ForumThreadModifyBuilder().apply(builder) - val patchedChannel = kord.rest.channel.patchThread(id, appliedBuilder.toRequest(), appliedBuilder.reason) - return Channel.from(patchedChannel.toData(), kord) as TextChannelThread -} + internal fun ThreadChannel(data: ChannelData, kord: Kord, supplier: EntitySupplier = kord.defaultSupplier): ThreadChannel { return object : ThreadChannel { diff --git a/rest/api/rest.api b/rest/api/rest.api index 04b42435911b..c287d1cf0b61 100644 --- a/rest/api/rest.api +++ b/rest/api/rest.api @@ -769,30 +769,6 @@ public final class dev/kord/rest/builder/channel/VoiceChannelModifyBuilder : dev public synthetic fun toRequest ()Ljava/lang/Object; } -public final class dev/kord/rest/builder/channel/thread/ForumThreadModifyBuilder : dev/kord/rest/builder/AuditRequestBuilder { - public fun ()V - public final fun getAppliedTags ()Ljava/util/List; - public final fun getArchived ()Ljava/lang/Boolean; - public final fun getAutoArchiveDuration ()Ldev/kord/common/entity/ArchiveDuration; - public final fun getFlags ()Ldev/kord/common/entity/ChannelFlags; - public final fun getInvitable ()Ljava/lang/Boolean; - public final fun getLocked ()Ljava/lang/Boolean; - public final fun getName ()Ljava/lang/String; - public final fun getRateLimitPerUser-FghU774 ()Lkotlin/time/Duration; - public fun getReason ()Ljava/lang/String; - public final fun setAppliedTags (Ljava/util/List;)V - public final fun setArchived (Ljava/lang/Boolean;)V - public final fun setAutoArchiveDuration (Ldev/kord/common/entity/ArchiveDuration;)V - public final fun setFlags (Ldev/kord/common/entity/ChannelFlags;)V - public final fun setInvitable (Ljava/lang/Boolean;)V - public final fun setLocked (Ljava/lang/Boolean;)V - public final fun setName (Ljava/lang/String;)V - public final fun setRateLimitPerUser-BwNAW2A (Lkotlin/time/Duration;)V - public fun setReason (Ljava/lang/String;)V - public fun toRequest ()Ldev/kord/rest/json/request/ChannelModifyPatchRequest; - public synthetic fun toRequest ()Ljava/lang/Object; -} - public final class dev/kord/rest/builder/channel/thread/StartForumThreadBuilder : dev/kord/rest/builder/AuditRequestBuilder { public fun (Ljava/lang/String;)V public final fun createMessage (Ljava/lang/String;)V @@ -851,6 +827,7 @@ public final class dev/kord/rest/builder/channel/thread/ThreadModifyBuilder : de public final fun getAppliedTags ()Ljava/util/List; public final fun getArchived ()Ljava/lang/Boolean; public final fun getAutoArchiveDuration ()Ldev/kord/common/entity/ArchiveDuration; + public final fun getFlags ()Ldev/kord/common/entity/ChannelFlags; public final fun getInvitable ()Ljava/lang/Boolean; public final fun getLocked ()Ljava/lang/Boolean; public final fun getName ()Ljava/lang/String; @@ -859,6 +836,7 @@ public final class dev/kord/rest/builder/channel/thread/ThreadModifyBuilder : de public final fun setAppliedTags (Ljava/util/List;)V public final fun setArchived (Ljava/lang/Boolean;)V public final fun setAutoArchiveDuration (Ldev/kord/common/entity/ArchiveDuration;)V + public final fun setFlags (Ldev/kord/common/entity/ChannelFlags;)V public final fun setInvitable (Ljava/lang/Boolean;)V public final fun setLocked (Ljava/lang/Boolean;)V public final fun setName (Ljava/lang/String;)V diff --git a/rest/src/main/kotlin/builder/channel/thread/ForumThreadModifyBuilder.kt b/rest/src/main/kotlin/builder/channel/thread/ForumThreadModifyBuilder.kt deleted file mode 100644 index 3bd28fe1938a..000000000000 --- a/rest/src/main/kotlin/builder/channel/thread/ForumThreadModifyBuilder.kt +++ /dev/null @@ -1,55 +0,0 @@ -package dev.kord.rest.builder.channel.thread - -import dev.kord.common.annotation.KordDsl -import dev.kord.common.entity.ArchiveDuration -import dev.kord.common.entity.ChannelFlags -import dev.kord.common.entity.Snowflake -import dev.kord.common.entity.optional.Optional -import dev.kord.common.entity.optional.OptionalBoolean -import dev.kord.common.entity.optional.delegate.delegate -import dev.kord.rest.builder.AuditRequestBuilder -import dev.kord.rest.json.request.ChannelModifyPatchRequest -import kotlin.time.Duration - -@KordDsl -public class ForumThreadModifyBuilder : AuditRequestBuilder { - - private var _name: Optional = Optional.Missing() - public var name: String? by ::_name.delegate() - - private var _archived: OptionalBoolean = OptionalBoolean.Missing - public var archived: Boolean? by ::_archived.delegate() - - private var _locked: OptionalBoolean = OptionalBoolean.Missing - public var locked: Boolean? by ::_locked.delegate() - - private var _rateLimitPerUser: Optional = Optional.Missing() - public var rateLimitPerUser: Duration? by ::_rateLimitPerUser.delegate() - - private var _autoArchiveDuration: Optional = Optional.Missing() - public var autoArchiveDuration: ArchiveDuration? by ::_autoArchiveDuration.delegate() - - private var _invitable: OptionalBoolean = OptionalBoolean.Missing - public var invitable: Boolean? by ::_invitable.delegate() - - private var _flags: Optional = Optional.Missing() - public var flags: ChannelFlags? by ::_flags.delegate() - - private var _appliedTags: Optional> = Optional.Missing() - public var appliedTags: MutableList? by ::_appliedTags.delegate() - - override fun toRequest(): ChannelModifyPatchRequest { - return ChannelModifyPatchRequest( - name = _name, - locked = _locked, - archived = _archived, - autoArchiveDuration = _autoArchiveDuration, - rateLimitPerUser = _rateLimitPerUser, - invitable = _invitable, - flags = _flags, - appliedTags = _appliedTags - ) - } - - override var reason: String? = null -} \ No newline at end of file diff --git a/rest/src/main/kotlin/builder/channel/thread/ThreadModifyBuilder.kt b/rest/src/main/kotlin/builder/channel/thread/ThreadModifyBuilder.kt index e257edc512a4..1375ced55cae 100644 --- a/rest/src/main/kotlin/builder/channel/thread/ThreadModifyBuilder.kt +++ b/rest/src/main/kotlin/builder/channel/thread/ThreadModifyBuilder.kt @@ -2,6 +2,7 @@ package dev.kord.rest.builder.channel.thread import dev.kord.common.annotation.KordDsl import dev.kord.common.entity.ArchiveDuration +import dev.kord.common.entity.ChannelFlags import dev.kord.common.entity.Snowflake import dev.kord.common.entity.optional.Optional import dev.kord.common.entity.optional.OptionalBoolean @@ -31,6 +32,9 @@ public class ThreadModifyBuilder : AuditRequestBuilder = Optional.Missing() + public var flags: ChannelFlags? by ::_flags.delegate() + private var _appliedTags: Optional> = Optional.Missing() public var appliedTags: MutableList? by ::_appliedTags.delegate() @@ -42,6 +46,7 @@ public class ThreadModifyBuilder : AuditRequestBuilder Date: Sat, 25 Mar 2023 07:54:02 +0100 Subject: [PATCH 41/42] Make StartForumThreadBuilder.message non-nullable A message is always required. createMessage was renamed to message because a thread is started that just contains a message. --- rest/api/rest.api | 4 ++-- .../channel/thread/StartForumThreadBuilder.kt | 21 +++++++------------ 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/rest/api/rest.api b/rest/api/rest.api index c287d1cf0b61..c8da1e76b56d 100644 --- a/rest/api/rest.api +++ b/rest/api/rest.api @@ -771,14 +771,14 @@ public final class dev/kord/rest/builder/channel/VoiceChannelModifyBuilder : dev public final class dev/kord/rest/builder/channel/thread/StartForumThreadBuilder : dev/kord/rest/builder/AuditRequestBuilder { public fun (Ljava/lang/String;)V - public final fun createMessage (Ljava/lang/String;)V - public final fun createMessage (Lkotlin/jvm/functions/Function1;)V public final fun getAppliedTags ()Ljava/util/List; public final fun getAutoArchiveDuration ()Ldev/kord/common/entity/ArchiveDuration; public final fun getMessage ()Ldev/kord/rest/builder/message/create/ForumMessageCreateBuilder; public final fun getName ()Ljava/lang/String; public final fun getRateLimitPerUser-FghU774 ()Lkotlin/time/Duration; public fun getReason ()Ljava/lang/String; + public final fun message (Ljava/lang/String;)V + public final fun message (Lkotlin/jvm/functions/Function1;)V public final fun setAppliedTags (Ljava/util/List;)V public final fun setAutoArchiveDuration (Ldev/kord/common/entity/ArchiveDuration;)V public final fun setMessage (Ldev/kord/rest/builder/message/create/ForumMessageCreateBuilder;)V diff --git a/rest/src/main/kotlin/builder/channel/thread/StartForumThreadBuilder.kt b/rest/src/main/kotlin/builder/channel/thread/StartForumThreadBuilder.kt index d9d53d759bb4..c636fec3be53 100644 --- a/rest/src/main/kotlin/builder/channel/thread/StartForumThreadBuilder.kt +++ b/rest/src/main/kotlin/builder/channel/thread/StartForumThreadBuilder.kt @@ -4,7 +4,6 @@ import dev.kord.common.annotation.KordDsl import dev.kord.common.entity.ArchiveDuration import dev.kord.common.entity.Snowflake import dev.kord.common.entity.optional.Optional -import dev.kord.common.entity.optional.coerceToMissing import dev.kord.common.entity.optional.delegate.delegate import dev.kord.rest.builder.AuditRequestBuilder import dev.kord.rest.builder.message.create.ForumMessageCreateBuilder @@ -27,33 +26,29 @@ public class StartForumThreadBuilder(public var name: String) : AuditRequestBuil private var _appliedTags: Optional> = Optional.Missing() public var appliedTags: MutableList? by ::_appliedTags.delegate() - public var message: ForumMessageCreateBuilder? = null + public var message: ForumMessageCreateBuilder = ForumMessageCreateBuilder() - public fun createMessage(content: String) { - createMessage { - this.content = content - } + public fun message(content: String) { + message.content = content } - public inline fun createMessage(builder: ForumMessageCreateBuilder.() -> Unit) { + public inline fun message(builder: ForumMessageCreateBuilder.() -> Unit) { contract { callsInPlace(builder, InvocationKind.EXACTLY_ONCE) } - - message = ForumMessageCreateBuilder().apply(builder) + message.apply(builder) } override fun toRequest(): MultipartStartThreadRequest { - val messageRequest = message?.toRequest() + val messageRequest = message.toRequest() return MultipartStartThreadRequest( StartThreadRequest( name = name, autoArchiveDuration = _autoArchiveDuration, rateLimitPerUser = _rateLimitPerUser, - message = Optional(messageRequest?.request).coerceToMissing(), + message = Optional(messageRequest.request), appliedTags = _appliedTags ), - files = messageRequest?.files ?: emptyList() + files = messageRequest.files, ) } - } From 38a347c16d82fc80711a0dc7bb23480ee4ab8882 Mon Sep 17 00:00:00 2001 From: Lukellmann Date: Sat, 25 Mar 2023 08:20:48 +0100 Subject: [PATCH 42/42] ChannelService.startThread builder parameter was unused --- rest/src/main/kotlin/service/ChannelService.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/rest/src/main/kotlin/service/ChannelService.kt b/rest/src/main/kotlin/service/ChannelService.kt index 7f3bc16d9b8d..2b3ef6c62072 100644 --- a/rest/src/main/kotlin/service/ChannelService.kt +++ b/rest/src/main/kotlin/service/ChannelService.kt @@ -348,6 +348,7 @@ public class ChannelService(requestHandler: RequestHandler) : RestService(reques contract { callsInPlace(builder, InvocationKind.EXACTLY_ONCE) } val startBuilder = StartThreadBuilder(name, type).apply { this.autoArchiveDuration = archiveDuration + builder() } return startThread(channelId, startBuilder.toRequest(), startBuilder.reason) }