mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-12-25 18:17:13 +00:00
replace joda-time dependency by soywiz klock
This commit is contained in:
parent
498efc2ec3
commit
24d11d2c2b
@ -32,7 +32,7 @@ dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
api "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_version"
|
||||
api "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$kotlin_serialisation_runtime_version"
|
||||
api "joda-time:joda-time:$joda_time_version"
|
||||
api "com.soywiz.korlibs.klock:klock:$klock_version"
|
||||
|
||||
api "io.ktor:ktor-client:$ktor_version"
|
||||
api "io.ktor:ktor-client-cio:$ktor_version"
|
||||
|
@ -2,7 +2,7 @@ kotlin.code.style=official
|
||||
kotlin_version=1.3.61
|
||||
kotlin_coroutines_version=1.3.2
|
||||
kotlin_serialisation_runtime_version=0.14.0
|
||||
joda_time_version=2.10.5
|
||||
klock_version=1.8.0
|
||||
ktor_version=1.2.6
|
||||
|
||||
gradle_bintray_plugin_version=1.8.4
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types
|
||||
|
||||
import kotlinx.serialization.*
|
||||
import org.joda.time.DateTime
|
||||
import com.soywiz.klock.DateTime
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
@Serializable(TelegramDateSerializer::class)
|
||||
@ -12,7 +12,7 @@ data class TelegramDate(
|
||||
private val date: Long
|
||||
) {
|
||||
constructor(dateTime: DateTime) : this(
|
||||
TimeUnit.MILLISECONDS.toSeconds(dateTime.millis)
|
||||
TimeUnit.MILLISECONDS.toSeconds(dateTime.unixMillisLong)
|
||||
)
|
||||
|
||||
@Transient
|
||||
@ -27,7 +27,7 @@ fun DateTime.toTelegramDate(): TelegramDate = TelegramDate(this)
|
||||
internal object TelegramDateSerializer : KSerializer<TelegramDate> {
|
||||
override fun serialize(encoder: Encoder, obj: TelegramDate) {
|
||||
encoder.encodeLong(
|
||||
TimeUnit.MILLISECONDS.toSeconds(obj.asDate.millis)
|
||||
TimeUnit.MILLISECONDS.toSeconds(obj.asDate.unixMillisLong)
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.ChannelChat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.ChatEvents.abstracts.ChannelEvent
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ChatEventMessage
|
||||
import org.joda.time.DateTime
|
||||
import com.soywiz.klock.DateTime
|
||||
|
||||
data class ChannelEventMessage(
|
||||
override val messageId: MessageIdentifier,
|
||||
|
@ -7,7 +7,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.MediaGroupMessage
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaGroupContent
|
||||
import org.joda.time.DateTime
|
||||
import com.soywiz.klock.DateTime
|
||||
|
||||
data class ChannelMediaGroupMessage(
|
||||
override val messageId: MessageIdentifier,
|
||||
|
@ -7,7 +7,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.CommonMessage
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent
|
||||
import org.joda.time.DateTime
|
||||
import com.soywiz.klock.DateTime
|
||||
|
||||
data class ChannelMessage<T: MessageContent>(
|
||||
override val messageId: MessageIdentifier,
|
||||
|
@ -5,7 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMa
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaGroupContent
|
||||
import org.joda.time.DateTime
|
||||
import com.soywiz.klock.DateTime
|
||||
|
||||
data class CommonMediaGroupMessage(
|
||||
override val messageId: MessageIdentifier,
|
||||
|
@ -7,7 +7,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.payments.abstracts.PaymentInfo
|
||||
import org.joda.time.DateTime
|
||||
import com.soywiz.klock.DateTime
|
||||
|
||||
data class CommonMessageImpl<T: MessageContent>(
|
||||
override val messageId: MessageIdentifier,
|
||||
|
@ -4,7 +4,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.GroupChat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.ChatEvents.abstracts.GroupEvent
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ChatEventMessage
|
||||
import org.joda.time.DateTime
|
||||
import com.soywiz.klock.DateTime
|
||||
|
||||
data class GroupEventMessage(
|
||||
override val messageId: MessageIdentifier,
|
||||
|
@ -4,7 +4,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.SupergroupChat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.ChatEvents.abstracts.SupergroupEvent
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ChatEventMessage
|
||||
import org.joda.time.DateTime
|
||||
import com.soywiz.klock.DateTime
|
||||
|
||||
data class SupergroupEventMessage(
|
||||
override val messageId: MessageIdentifier,
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts
|
||||
|
||||
import org.joda.time.DateTime
|
||||
import com.soywiz.klock.DateTime
|
||||
|
||||
interface AbleToBeEditedMessage : Message {
|
||||
val editDate: DateTime?
|
||||
|
@ -5,7 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.internal.StringDescriptor
|
||||
import org.joda.time.DateTime
|
||||
import com.soywiz.klock.DateTime
|
||||
|
||||
interface Message {
|
||||
val messageId: MessageIdentifier
|
||||
|
@ -1,9 +1,9 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types
|
||||
|
||||
import com.soywiz.klock.DateTime
|
||||
import kotlinx.serialization.ImplicitReflectionSerializer
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.json.Json
|
||||
import org.joda.time.DateTime
|
||||
import java.util.concurrent.TimeUnit
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertEquals
|
||||
|
Loading…
Reference in New Issue
Block a user