1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-26 12:08:43 +00:00

"language" field im RawMessageEntity

This commit is contained in:
InsanusMokrassar 2020-01-23 17:07:28 +06:00
parent 4e39f77b53
commit 41db785696
2 changed files with 4 additions and 2 deletions

View File

@ -9,6 +9,7 @@
* `SendPoll` was rewritten as sealed class * `SendPoll` was rewritten as sealed class
* `SendRegularPoll` was created and represent `sendPoll` method with type `regular` * `SendRegularPoll` was created and represent `sendPoll` method with type `regular`
* `SendQuizPoll` was created and represent `sendPoll` method with type `quiz` * `SendQuizPoll` was created and represent `sendPoll` method with type `quiz`
* `language` field in PreTextSource now correctly passed from telegram MessageEntities
## 0.22.0 ## 0.22.0

View File

@ -13,7 +13,8 @@ internal data class RawMessageEntity(
val offset: Int, val offset: Int,
val length: Int, val length: Int,
val url: String? = null, val url: String? = null,
val user: User? = null val user: User? = null,
val language: String? = null
) )
internal fun RawMessageEntity.asTextParts(source: String, subParts: List<TextPart>): List<TextPart> { internal fun RawMessageEntity.asTextParts(source: String, subParts: List<TextPart>): List<TextPart> {
@ -31,7 +32,7 @@ internal fun RawMessageEntity.asTextParts(source: String, subParts: List<TextPar
"bold" -> BoldTextSource(sourceSubstring, shiftedSubParts) "bold" -> BoldTextSource(sourceSubstring, shiftedSubParts)
"italic" -> ItalicTextSource(sourceSubstring, shiftedSubParts) "italic" -> ItalicTextSource(sourceSubstring, shiftedSubParts)
"code" -> CodeTextSource(sourceSubstring) "code" -> CodeTextSource(sourceSubstring)
"pre" -> PreTextSource(sourceSubstring) "pre" -> PreTextSource(sourceSubstring, language)
"text_link" -> TextLinkTextSource(sourceSubstring, url ?: throw IllegalStateException("URL must not be null for text link")) "text_link" -> TextLinkTextSource(sourceSubstring, url ?: throw IllegalStateException("URL must not be null for text link"))
"text_mention" -> TextMentionTextSource(sourceSubstring, user ?: throw IllegalStateException("User must not be null for text mention"), shiftedSubParts) "text_mention" -> TextMentionTextSource(sourceSubstring, user ?: throw IllegalStateException("User must not be null for text mention"), shiftedSubParts)
"underline" -> UnderlineTextSource(sourceSubstring, shiftedSubParts) "underline" -> UnderlineTextSource(sourceSubstring, shiftedSubParts)