1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-12-26 18:47:14 +00:00
This commit is contained in:
InsanusMokrassar 2021-04-28 23:22:13 +06:00
parent 0914710cc7
commit eb923a6338

View File

@ -162,9 +162,9 @@ internal fun TextSource.toRawMessageEntities(offset: Int = 0): List<RawMessageEn
internal fun List<TextSource>.toRawMessageEntities(preOffset: Int = 0): List<RawMessageEntity> {
var i = preOffset
return flatMap {
it.toRawMessageEntities(i).also {
i += it.maxByOrNull { it.length }!!.length + 1
return flatMap { textSource ->
textSource.toRawMessageEntities(i).also {
i += it.maxByOrNull { it.length } ?.length ?: textSource.source.length
}
}
}