1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-26 03:58:44 +00:00

RawMessageEntity is internal

This commit is contained in:
InsanusMokrassar 2019-08-17 22:48:18 +06:00
parent 402e1b12dc
commit 3285b2812e
3 changed files with 31 additions and 12 deletions

View File

@ -10,6 +10,8 @@
* Update of description * Update of description
* `RawUpdate` now is internal and not available outside of library * `RawUpdate` now is internal and not available outside of library
* `RawChatMember` now is internal and not available outside of library * `RawChatMember` now is internal and not available outside of library
* Make `Game` object a little bit more standartizated
* `RawMessageEntity` now is internal
## 0.17.0 ## 0.17.0

View File

@ -6,7 +6,7 @@ import kotlinx.serialization.Serializable
import kotlinx.serialization.internal.ArrayListSerializer import kotlinx.serialization.internal.ArrayListSerializer
@Serializable @Serializable
data class RawMessageEntity( internal data class RawMessageEntity(
val type: String, val type: String,
val offset: Int, val offset: Int,
val length: Int, val length: Int,
@ -34,8 +34,8 @@ data class RawMessageEntity(
} }
} }
typealias RawMessageEntities = List<RawMessageEntity> internal typealias RawMessageEntities = List<RawMessageEntity>
object RawMessageEntitiesSerializer : KSerializer<List<RawMessageEntity>> by ArrayListSerializer( internal object RawMessageEntitiesSerializer : KSerializer<List<RawMessageEntity>> by ArrayListSerializer(
RawMessageEntity.serializer() RawMessageEntity.serializer()
) )

View File

@ -1,31 +1,48 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.games package com.github.insanusmokrassar.TelegramBotAPI.types.games
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.* import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.*
import com.github.insanusmokrassar.TelegramBotAPI.types.files.* import com.github.insanusmokrassar.TelegramBotAPI.types.files.*
import kotlinx.serialization.* import kotlinx.serialization.*
@Serializable @Serializable
data class Game( data class Game internal constructor(
@SerialName(titleField) @SerialName(titleField)
val title: String, override val title: String,
@SerialName(descriptionField) @SerialName(descriptionField)
val description: String, val description: String,
@Serializable(PhotoSerializer::class) @Serializable(PhotoSerializer::class)
@SerialName(photoField) @SerialName(photoField)
val photo: Photo, val photo: Photo,
@SerialName(textField) @SerialName(textField)
val text: String? = null, override val caption: String? = null,
@Serializable(RawMessageEntitiesSerializer::class) @Serializable(RawMessageEntitiesSerializer::class)
@SerialName(textEntitiesField) @SerialName(textEntitiesField)
private val textEntitiesRaw: RawMessageEntities? = null, private val rawEntities: RawMessageEntities? = null,
@SerialName(animationField) @SerialName(animationField)
val animation: AnimationFile? = null val animation: AnimationFile? = null
) { ) : Titled, CaptionedInput {
@Transient @Transient
val textEntities: List<MessageEntity>? = text ?.let { override val captionEntities: List<MessageEntity> = caption ?.let {
textEntitiesRaw ?.map { rawEntities ?.map {
it.asMessageEntity(text) it.asMessageEntity(caption)
}
} }
} ?: emptyList()
@Deprecated(
"Missinterfaced field",
ReplaceWith("caption")
)
@Transient
val text: String?
get() = caption
@Deprecated(
"Missinterfaced field",
ReplaceWith("captionEntities")
)
@Transient
val textEntities: List<MessageEntity>?
get() = captionEntities
} }