From 9029114154b63d362d9ed2f1082d44175306b3b5 Mon Sep 17 00:00:00 2001 From: lukellmann Date: Tue, 8 Aug 2023 23:35:22 +0200 Subject: [PATCH] Use Duration instead of DurationInSeconds --- .../kotlin/behavior/channel/CategoryBehavior.kt | 1 + .../builder/channel/StageChannelCreateBuilder.kt | 12 ++++++------ rest/src/commonMain/kotlin/service/GuildService.kt | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/core/src/commonMain/kotlin/behavior/channel/CategoryBehavior.kt b/core/src/commonMain/kotlin/behavior/channel/CategoryBehavior.kt index 971b3f77810..b492f5a6a01 100644 --- a/core/src/commonMain/kotlin/behavior/channel/CategoryBehavior.kt +++ b/core/src/commonMain/kotlin/behavior/channel/CategoryBehavior.kt @@ -192,6 +192,7 @@ public suspend inline fun CategoryBehavior.createNewsChannel( return Channel.from(data, kord) as NewsChannel } + /** * Requests to create a new stage channel with this category as parent. * diff --git a/rest/src/commonMain/kotlin/builder/channel/StageChannelCreateBuilder.kt b/rest/src/commonMain/kotlin/builder/channel/StageChannelCreateBuilder.kt index 75b98a5401b..afd25c4155b 100644 --- a/rest/src/commonMain/kotlin/builder/channel/StageChannelCreateBuilder.kt +++ b/rest/src/commonMain/kotlin/builder/channel/StageChannelCreateBuilder.kt @@ -9,14 +9,14 @@ import dev.kord.common.entity.optional.OptionalBoolean import dev.kord.common.entity.optional.OptionalInt import dev.kord.common.entity.optional.OptionalSnowflake import dev.kord.common.entity.optional.delegate.delegate -import dev.kord.common.serialization.DurationInSeconds import dev.kord.rest.builder.AuditRequestBuilder import dev.kord.rest.json.request.GuildChannelCreateRequest +import kotlin.time.Duration @KordDsl public class StageChannelCreateBuilder(public var name: String) : -PermissionOverwritesCreateBuilder, -AuditRequestBuilder { + PermissionOverwritesCreateBuilder, + AuditRequestBuilder { override var reason: String? = null private var _bitrate: OptionalInt = OptionalInt.Missing @@ -25,8 +25,8 @@ AuditRequestBuilder { private var _userLimit: OptionalInt = OptionalInt.Missing public var userLimit: Int? by ::_userLimit.delegate() - private var _rateLimitPerUser: Optional = Optional.Missing() - public var rateLimitPerUser: DurationInSeconds? by ::_rateLimitPerUser.delegate() + private var _rateLimitPerUser: Optional = Optional.Missing() + public var rateLimitPerUser: Duration? by ::_rateLimitPerUser.delegate() private var _position: OptionalInt = OptionalInt.Missing public var position: Int? by ::_position.delegate() @@ -50,4 +50,4 @@ AuditRequestBuilder { parentId = _parentId, nsfw = _nsfw ) -} \ No newline at end of file +} diff --git a/rest/src/commonMain/kotlin/service/GuildService.kt b/rest/src/commonMain/kotlin/service/GuildService.kt index afbf7f164d7..f2f849adeff 100644 --- a/rest/src/commonMain/kotlin/service/GuildService.kt +++ b/rest/src/commonMain/kotlin/service/GuildService.kt @@ -578,7 +578,7 @@ public suspend inline fun GuildService.createStageChannel( guildId: Snowflake, name: String, builder: StageChannelCreateBuilder.() -> Unit -) : DiscordChannel { +): DiscordChannel { contract { callsInPlace(builder, InvocationKind.EXACTLY_ONCE) } val createBuilder = StageChannelCreateBuilder(name).apply(builder) return createGuildChannel(guildId, createBuilder.toRequest(), createBuilder.reason)