diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d474e4617..d4891f3983 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## 10.0.0 +**IN THIS UPDATE KLOCK DEPENDENCY CHANGED TO `com.soywiz.korge:korlibs-time` UP TO 5.3.0 VERSION** + +**IN THIS UPDATE KRYPTO DEPENDENCY CHANGED TO `com.soywiz.korge:korlibs-crypto` UP TO 5.3.0 VERSION** + ## 9.4.3 **IetfLanguageCode has been renamed to IetfLang in MicroUtils** diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LiveLocationProvider.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LiveLocationProvider.kt index 4222a29c89..7d2d93b6d0 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LiveLocationProvider.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LiveLocationProvider.kt @@ -24,6 +24,7 @@ import dev.inmo.tgbotapi.types.message.abstracts.Message import dev.inmo.tgbotapi.types.message.content.LocationContent import dev.inmo.tgbotapi.utils.extensions.threadIdOrNull import io.ktor.utils.io.core.Closeable +import korlibs.time.millisecondsLong import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineStart import kotlinx.coroutines.currentCoroutineContext diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/polls/SendPoll.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/polls/SendPoll.kt index 2b16aaac31..1d63f7a816 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/polls/SendPoll.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/polls/SendPoll.kt @@ -16,6 +16,8 @@ import dev.inmo.tgbotapi.types.message.content.PollContent import dev.inmo.tgbotapi.types.message.toRawMessageEntities import dev.inmo.tgbotapi.types.polls.* import dev.inmo.tgbotapi.utils.extensions.makeString +import korlibs.time.millisecondsLong +import korlibs.time.seconds import kotlinx.serialization.* private val commonResultDeserializer: DeserializationStrategy> = TelegramBotAPIMessageDeserializationStrategyClass() diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/stickers/CreateNewStickerSet.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/stickers/CreateNewStickerSet.kt index 5cf4afa885..9bcaee8730 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/stickers/CreateNewStickerSet.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/stickers/CreateNewStickerSet.kt @@ -145,7 +145,7 @@ sealed interface CreateNewStickerSet : CreateStickerSetAction { object CreateNewStickerSetSerializer : KSerializer, MapperSerializer( CreateNewStickerSet.SurrogateCreateNewSticker.serializer(), - { + { it -> CreateNewStickerSet.SurrogateCreateNewSticker( it.userId, it.name, @@ -156,7 +156,7 @@ object CreateNewStickerSetSerializer : KSerializer, (it as? CreateNewStickerSet.CustomEmoji)?.needsRepainting ) }, - { + { it -> when (it.stickerType) { StickerType.CustomEmoji -> CreateNewStickerSet.CustomEmoji( it.userId, diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/stickers/InputSticker.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/stickers/InputSticker.kt index 874fff6676..b0a9cd4591 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/stickers/InputSticker.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/stickers/InputSticker.kt @@ -57,7 +57,7 @@ sealed interface InputSticker { object InputStickerSerializer : KSerializer, MapperSerializer( SurrogateInputSticker.serializer(), - { + { it -> when (it) { is InputSticker.Mask -> SurrogateInputSticker( it.sticker, @@ -82,7 +82,7 @@ object InputStickerSerializer : KSerializer, MapperSerializer when (it.internalType) { StickerType.CustomEmoji -> InputSticker.WithKeywords.CustomEmoji( it.sticker, diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/colors/ColorId.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/colors/ColorId.kt index 7f882e7491..1e8e3e6e26 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/colors/ColorId.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/colors/ColorId.kt @@ -11,7 +11,7 @@ value class ColorId( ) { companion object { val defaultAccentColors = mapOf( - ColorId(0) to HEXAColor(0xff0000ffu), + ColorId(0) to setOf(HEXAColor(0xff0000ffu)), ) } } \ No newline at end of file diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/ChatEvents/voice/VideoChatEnded.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/ChatEvents/voice/VideoChatEnded.kt index a9805c8d60..ded85cf7c9 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/ChatEvents/voice/VideoChatEnded.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/ChatEvents/voice/VideoChatEnded.kt @@ -5,6 +5,7 @@ import korlibs.time.seconds import dev.inmo.tgbotapi.types.Seconds import dev.inmo.tgbotapi.types.durationField import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.VideoChatEvent +import korlibs.time.milliseconds import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/polls/Poll.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/polls/Poll.kt index 07110b525a..bb07e64c16 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/polls/Poll.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/polls/Poll.kt @@ -11,6 +11,7 @@ import dev.inmo.tgbotapi.types.message.textsources.TextSource import dev.inmo.tgbotapi.types.message.toRawMessageEntities import dev.inmo.tgbotapi.utils.RiskFeature import dev.inmo.tgbotapi.utils.nonstrictJsonFormat +import korlibs.time.seconds import kotlinx.serialization.* import kotlinx.serialization.descriptors.SerialDescriptor import kotlinx.serialization.encoding.Decoder diff --git a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/ClassCastsNew.kt b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/ClassCastsNew.kt index 70b2517155..67d1718676 100644 --- a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/ClassCastsNew.kt +++ b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/ClassCastsNew.kt @@ -122,6 +122,7 @@ import dev.inmo.tgbotapi.types.chat.ExtendedChat import dev.inmo.tgbotapi.types.chat.ExtendedChatWithUsername import dev.inmo.tgbotapi.types.chat.ExtendedForumChat import dev.inmo.tgbotapi.types.chat.ExtendedGroupChat +import dev.inmo.tgbotapi.types.chat.ExtendedNonBotChat import dev.inmo.tgbotapi.types.chat.ExtendedPrivateChat import dev.inmo.tgbotapi.types.chat.ExtendedPublicChat import dev.inmo.tgbotapi.types.chat.ExtendedSupergroupChat @@ -1980,6 +1981,24 @@ public inline fun Chat.unknownExtendedChatOrThrow(): UnknownExtendedChat = this public inline fun Chat.ifUnknownExtendedChat(block: (UnknownExtendedChat) -> T): T? = unknownExtendedChatOrNull() ?.let(block) +public inline fun Chat.extendedChatOrNull(): ExtendedChat? = this as? + dev.inmo.tgbotapi.types.chat.ExtendedChat + +public inline fun Chat.extendedChatOrThrow(): ExtendedChat = this as + dev.inmo.tgbotapi.types.chat.ExtendedChat + +public inline fun Chat.ifExtendedChat(block: (ExtendedChat) -> T): T? = extendedChatOrNull() + ?.let(block) + +public inline fun Chat.extendedNonBotChatOrNull(): ExtendedNonBotChat? = this as? + dev.inmo.tgbotapi.types.chat.ExtendedNonBotChat + +public inline fun Chat.extendedNonBotChatOrThrow(): ExtendedNonBotChat = this as + dev.inmo.tgbotapi.types.chat.ExtendedNonBotChat + +public inline fun Chat.ifExtendedNonBotChat(block: (ExtendedNonBotChat) -> T): T? = + extendedNonBotChatOrNull() ?.let(block) + public inline fun Chat.extendedChannelChatOrNull(): ExtendedChannelChat? = this as? dev.inmo.tgbotapi.types.chat.ExtendedChannelChat @@ -2034,15 +2053,6 @@ public inline fun Chat.extendedForumChatOrThrow(): ExtendedForumChat = this as public inline fun Chat.ifExtendedForumChat(block: (ExtendedForumChat) -> T): T? = extendedForumChatOrNull() ?.let(block) -public inline fun Chat.extendedChatOrNull(): ExtendedChat? = this as? - dev.inmo.tgbotapi.types.chat.ExtendedChat - -public inline fun Chat.extendedChatOrThrow(): ExtendedChat = this as - dev.inmo.tgbotapi.types.chat.ExtendedChat - -public inline fun Chat.ifExtendedChat(block: (ExtendedChat) -> T): T? = extendedChatOrNull() - ?.let(block) - public inline fun Chat.extendedChatWithUsernameOrNull(): ExtendedChatWithUsername? = this as? dev.inmo.tgbotapi.types.chat.ExtendedChatWithUsername diff --git a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/raw/Poll.kt b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/raw/Poll.kt index c4ede211b5..97ece7e16b 100644 --- a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/raw/Poll.kt +++ b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/raw/Poll.kt @@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList import dev.inmo.tgbotapi.types.polls.* import dev.inmo.tgbotapi.utils.RiskFeature +import korlibs.time.seconds import kotlinx.serialization.json.jsonPrimitive @RiskFeature(RawFieldsUsageWarning)