Skip to content

Commit

Permalink
Use Duration instead of DurationInSeconds
Browse files Browse the repository at this point in the history
  • Loading branch information
lukellmann committed Aug 8, 2023
1 parent 4209065 commit 9029114
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<GuildChannelCreateRequest> {
PermissionOverwritesCreateBuilder,
AuditRequestBuilder<GuildChannelCreateRequest> {
override var reason: String? = null

private var _bitrate: OptionalInt = OptionalInt.Missing
Expand All @@ -25,8 +25,8 @@ AuditRequestBuilder<GuildChannelCreateRequest> {
private var _userLimit: OptionalInt = OptionalInt.Missing
public var userLimit: Int? by ::_userLimit.delegate()

private var _rateLimitPerUser: Optional<DurationInSeconds> = Optional.Missing()
public var rateLimitPerUser: DurationInSeconds? by ::_rateLimitPerUser.delegate()
private var _rateLimitPerUser: Optional<Duration> = Optional.Missing()
public var rateLimitPerUser: Duration? by ::_rateLimitPerUser.delegate()

private var _position: OptionalInt = OptionalInt.Missing
public var position: Int? by ::_position.delegate()
Expand All @@ -50,4 +50,4 @@ AuditRequestBuilder<GuildChannelCreateRequest> {
parentId = _parentId,
nsfw = _nsfw
)
}
}
2 changes: 1 addition & 1 deletion rest/src/commonMain/kotlin/service/GuildService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9029114

Please sign in to comment.