From f68edebd24190ad58f65555b2fb5a3c8bc46c9bd Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 2 Jan 2020 23:58:16 +0600 Subject: [PATCH] RawMessageEntity will not throw exception --- CHANGELOG.md | 2 ++ .../TelegramBotAPI/types/MessageEntity/RawMessageEntity.kt | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8dac4d4575..43da309d6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ * All `MessageEntity` classes now have no income parameter `sourceString` * In most part of `TextSource` classes `asMarkdownSource` and `asHtmlSource` now are getters instead if fields * All parseMode-specific functions in `StringFormatting` now are not `infix` +* Now will not be thrown exception when there is income unknown type of `MessageEntity`. Instead of this will be +created `RegularTextMessageEntity` with the same text * Removed constructor of `TextMentionMessageEntity`, which was deprecated previously * Removed constructor of `TextMentionTextSource`, which was deprecated previously * All `TelegramMediaFile` instances now have field `fileUniqueId`, which represents `file_unique_id` field from API diff --git a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/RawMessageEntity.kt b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/RawMessageEntity.kt index b732fcb1dc..1d5ceac9a7 100644 --- a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/RawMessageEntity.kt +++ b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/RawMessageEntity.kt @@ -32,7 +32,7 @@ internal data class RawMessageEntity( "text_mention" -> TextMentionMessageEntity(offset, length, sourceSubstring, user ?: throw IllegalStateException("User must not be null for text mention")) "underline" -> UnderlineMessageEntity(offset, length, sourceSubstring) "strikethrough" -> StrikethroughMessageEntity(offset, length, sourceSubstring) - else -> throw IllegalArgumentException("Unknown type of message entity") + else -> RegularTextMessageEntity(offset, length, sourceSubstring) } } }