Skip to content

Commit 76906b1

Browse files
authored
Replace kotlinx.datetime types with kotlin.time (#258)
1 parent 3954ee8 commit 76906b1

File tree

14 files changed

+24
-28
lines changed

14 files changed

+24
-28
lines changed

BotCommands-core/build.gradle.kts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ dependencies {
4949

5050
// -------------------- GLOBAL DEPENDENCIES --------------------
5151

52-
api(libs.kotlinx.datetime)
53-
5452
// Deserialization
5553
api(libs.jackson.databind)
5654
api(libs.jackson.module.kotlin)

BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/core/db/DBResult.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ import io.github.freya022.botcommands.api.core.utils.isSubclassOf
44
import io.github.freya022.botcommands.api.core.utils.toBoxed
55
import io.github.freya022.botcommands.internal.utils.findErasureOfAt
66
import io.github.freya022.botcommands.internal.utils.rethrow
7-
import kotlinx.datetime.Instant
8-
import kotlinx.datetime.toKotlinInstant
97
import java.sql.ResultSet
108
import java.sql.SQLException
119
import java.util.*
1210
import java.util.stream.Stream
1311
import java.util.stream.StreamSupport
1412
import kotlin.reflect.jvm.jvmErasure
1513
import kotlin.reflect.typeOf
14+
import kotlin.time.Instant
15+
import kotlin.time.toKotlinInstant
1616

1717
/**
1818
* Utility class to iterate over a [ResultSet],

BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/components/controller/ComponentController.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import io.github.freya022.botcommands.internal.utils.takeIfFinite
2424
import io.github.freya022.botcommands.internal.utils.throwInternal
2525
import io.github.oshai.kotlinlogging.KotlinLogging
2626
import kotlinx.coroutines.runBlocking
27-
import kotlinx.datetime.Clock
27+
import kotlin.time.Clock
2828

2929
private const val PREFIX = "BotCommands-Components-"
3030
private const val PREFIX_LENGTH = PREFIX.length
@@ -170,4 +170,4 @@ internal class ComponentController(
170170

171171
internal fun getComponentId(internalId: Int): String = PREFIX + internalId
172172
}
173-
}
173+
}

BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/components/controller/ComponentTimeoutManager.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import kotlinx.coroutines.CancellationException
1414
import kotlinx.coroutines.Job
1515
import kotlinx.coroutines.delay
1616
import kotlinx.coroutines.launch
17-
import kotlinx.datetime.Clock
18-
import kotlinx.datetime.Instant
17+
import kotlin.time.Clock
18+
import kotlin.time.Instant
1919

2020
private val logger = KotlinLogging.logger { }
2121

BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/components/data/ComponentData.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package io.github.freya022.botcommands.internal.components.data
33
import io.github.freya022.botcommands.internal.components.ComponentType
44
import io.github.freya022.botcommands.internal.components.LifetimeType
55
import io.github.freya022.botcommands.internal.components.data.timeout.ComponentTimeout
6-
import kotlinx.datetime.Instant
76
import kotlin.time.Duration
7+
import kotlin.time.Instant
88

99
internal sealed interface ComponentData {
1010
val internalId: Int
@@ -13,4 +13,4 @@ internal sealed interface ComponentData {
1313
val expiresAt: Instant?
1414
val timeout: ComponentTimeout?
1515
val resetTimeoutOnUseDuration: Duration?
16-
}
16+
}

BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/components/data/ComponentGroupData.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package io.github.freya022.botcommands.internal.components.data
33
import io.github.freya022.botcommands.internal.components.ComponentType
44
import io.github.freya022.botcommands.internal.components.LifetimeType
55
import io.github.freya022.botcommands.internal.components.data.timeout.ComponentTimeout
6-
import kotlinx.datetime.Instant
76
import kotlin.time.Duration
7+
import kotlin.time.Instant
88

99
internal class ComponentGroupData internal constructor(
1010
override val internalId: Int,
@@ -16,4 +16,4 @@ internal class ComponentGroupData internal constructor(
1616
): ComponentData {
1717
override val componentType: ComponentType
1818
get() = ComponentType.GROUP
19-
}
19+
}

BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/components/data/EphemeralComponentData.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import io.github.freya022.botcommands.internal.components.ComponentType
77
import io.github.freya022.botcommands.internal.components.LifetimeType
88
import io.github.freya022.botcommands.internal.components.data.timeout.EphemeralTimeout
99
import io.github.freya022.botcommands.internal.components.handler.EphemeralHandler
10-
import kotlinx.datetime.Instant
1110
import kotlin.time.Duration
11+
import kotlin.time.Instant
1212

1313
internal class EphemeralComponentData(
1414
override val internalId: Int,
@@ -25,4 +25,4 @@ internal class EphemeralComponentData(
2525
) : ActionComponentData {
2626
override val lifetimeType: LifetimeType
2727
get() = LifetimeType.EPHEMERAL
28-
}
28+
}

BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/components/data/PersistentComponentData.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import io.github.freya022.botcommands.internal.components.ComponentType
77
import io.github.freya022.botcommands.internal.components.LifetimeType
88
import io.github.freya022.botcommands.internal.components.data.timeout.PersistentTimeout
99
import io.github.freya022.botcommands.internal.components.handler.PersistentHandler
10-
import kotlinx.datetime.Instant
1110
import kotlin.time.Duration
11+
import kotlin.time.Instant
1212

1313
internal class PersistentComponentData(
1414
override val internalId: Int,
@@ -25,4 +25,4 @@ internal class PersistentComponentData(
2525
) : ActionComponentData {
2626
override val lifetimeType: LifetimeType
2727
get() = LifetimeType.PERSISTENT
28-
}
28+
}

BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/components/repositories/ComponentRepository.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ import io.github.freya022.botcommands.internal.utils.throwArgument
2727
import io.github.freya022.botcommands.internal.utils.throwInternal
2828
import io.github.oshai.kotlinlogging.KotlinLogging
2929
import kotlinx.coroutines.runBlocking
30-
import kotlinx.datetime.Clock
31-
import kotlinx.datetime.Instant
32-
import kotlinx.datetime.toJavaInstant
3330
import net.dv8tion.jda.api.Permission
3431
import java.sql.DatabaseMetaData
3532
import java.sql.Timestamp
33+
import kotlin.time.Clock
3634
import kotlin.time.Duration
3735
import kotlin.time.Duration.Companion.milliseconds
36+
import kotlin.time.Instant
37+
import kotlin.time.toJavaInstant
3838

3939
private val logger = KotlinLogging.logger { }
4040

BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/core/BContextImpl.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import kotlinx.coroutines.CoroutineScope
2424
import kotlinx.coroutines.ExecutorCoroutineDispatcher
2525
import kotlinx.coroutines.cancel
2626
import kotlinx.coroutines.runBlocking
27-
import kotlinx.datetime.Clock
2827
import net.dv8tion.jda.api.JDA
2928
import net.dv8tion.jda.api.entities.Message
3029
import net.dv8tion.jda.api.events.session.ShutdownEvent
@@ -39,6 +38,7 @@ import java.util.concurrent.locks.ReentrantLock
3938
import kotlin.concurrent.withLock
4039
import kotlin.reflect.full.memberProperties
4140
import kotlin.reflect.jvm.jvmErasure
41+
import kotlin.time.Clock
4242
import kotlin.time.Duration
4343
import kotlin.time.Duration.Companion.minutes
4444
import kotlin.time.toJavaDuration

0 commit comments

Comments
 (0)