From 0087d02b5f0dcc9e2813035f8295c043e6fd331a Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 20 Aug 2020 01:17:32 +0600 Subject: [PATCH] potential fix of build --- .../TelegramBotAPI/types/BotCommand.kt | 5 ++++- .../insanusmokrassar/TelegramBotAPI/types/Common.kt | 13 ++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/BotCommand.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/BotCommand.kt index 3ac9d3470d..5f280450de 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/BotCommand.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/BotCommand.kt @@ -4,7 +4,10 @@ import com.github.insanusmokrassar.TelegramBotAPI.utils.throwRangeError import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable -val BotCommandNameRegex = Regex("^[a-z_0-9]{${botCommandLengthLimit.first},${botCommandLengthLimit.last}}$") +// Made as lazy for correct work in K/JS +val BotCommandNameRegex by lazy { + Regex("^[a-z_0-9]{${botCommandLengthLimit.first},${botCommandLengthLimit.last}}$") +} @Serializable data class BotCommand( diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Common.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Common.kt index 915e9bb031..d66576899c 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Common.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Common.kt @@ -65,11 +65,14 @@ val explanationLimit = 0 .. 200 val openPeriodPollSecondsLimit = 5 .. 600 -val telegramInlineModeGifPermittedMimeTypes = listOf( - BuiltinMimeTypes.Image.Jpg, - BuiltinMimeTypes.Image.Gif, - BuiltinMimeTypes.Video.MP4 -) +// Made as lazy for correct work in K/JS +val telegramInlineModeGifPermittedMimeTypes by lazy { + listOf( + BuiltinMimeTypes.Image.Jpg, + BuiltinMimeTypes.Image.Gif, + BuiltinMimeTypes.Video.MP4 + ) +} const val chatIdField = "chat_id" const val messageIdField = "message_id"