mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-12-22 16:47:13 +00:00
RawMessageEntity is internal
This commit is contained in:
parent
402e1b12dc
commit
3285b2812e
@ -10,6 +10,8 @@
|
||||
* Update of description
|
||||
* `RawUpdate` 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
|
||||
|
||||
|
@ -6,7 +6,7 @@ import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.internal.ArrayListSerializer
|
||||
|
||||
@Serializable
|
||||
data class RawMessageEntity(
|
||||
internal data class RawMessageEntity(
|
||||
val type: String,
|
||||
val offset: 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()
|
||||
)
|
||||
|
@ -1,31 +1,48 @@
|
||||
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.MessageEntity.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.*
|
||||
import kotlinx.serialization.*
|
||||
|
||||
@Serializable
|
||||
data class Game(
|
||||
data class Game internal constructor(
|
||||
@SerialName(titleField)
|
||||
val title: String,
|
||||
override val title: String,
|
||||
@SerialName(descriptionField)
|
||||
val description: String,
|
||||
@Serializable(PhotoSerializer::class)
|
||||
@SerialName(photoField)
|
||||
val photo: Photo,
|
||||
@SerialName(textField)
|
||||
val text: String? = null,
|
||||
override val caption: String? = null,
|
||||
@Serializable(RawMessageEntitiesSerializer::class)
|
||||
@SerialName(textEntitiesField)
|
||||
private val textEntitiesRaw: RawMessageEntities? = null,
|
||||
private val rawEntities: RawMessageEntities? = null,
|
||||
@SerialName(animationField)
|
||||
val animation: AnimationFile? = null
|
||||
) {
|
||||
) : Titled, CaptionedInput {
|
||||
@Transient
|
||||
val textEntities: List<MessageEntity>? = text ?.let {
|
||||
textEntitiesRaw ?.map {
|
||||
it.asMessageEntity(text)
|
||||
override val captionEntities: List<MessageEntity> = caption ?.let {
|
||||
rawEntities ?.map {
|
||||
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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user