mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-26 03:58:44 +00:00
commit
6959dacfc4
@ -1,5 +1,12 @@
|
|||||||
# TelegramBotAPI changelog
|
# TelegramBotAPI changelog
|
||||||
|
|
||||||
|
## 7.1.2
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `MicroUtils`: `0.18.0` -> `0.18.1`
|
||||||
|
* `Core`:
|
||||||
|
* Now it is possible to serialize `Sticker`s
|
||||||
|
|
||||||
## 7.1.1
|
## 7.1.1
|
||||||
|
|
||||||
* `Versions`:
|
* `Versions`:
|
||||||
|
@ -6,4 +6,4 @@ kotlin.incremental=true
|
|||||||
kotlin.incremental.js=true
|
kotlin.incremental.js=true
|
||||||
|
|
||||||
library_group=dev.inmo
|
library_group=dev.inmo
|
||||||
library_version=7.1.1
|
library_version=7.1.2
|
||||||
|
@ -11,9 +11,9 @@ uuid = "0.7.0"
|
|||||||
ktor = "2.3.0"
|
ktor = "2.3.0"
|
||||||
|
|
||||||
ksp = "1.8.21-1.0.11"
|
ksp = "1.8.21-1.0.11"
|
||||||
kotlin-poet = "1.13.1"
|
kotlin-poet = "1.13.2"
|
||||||
|
|
||||||
microutils = "0.18.0"
|
microutils = "0.18.1"
|
||||||
|
|
||||||
github-release-plugin = "2.4.1"
|
github-release-plugin = "2.4.1"
|
||||||
dokka = "1.8.10"
|
dokka = "1.8.10"
|
||||||
|
@ -22,7 +22,7 @@ data class StickerSurrogate(
|
|||||||
val height: Int,
|
val height: Int,
|
||||||
val is_animated: Boolean? = null,
|
val is_animated: Boolean? = null,
|
||||||
val is_video: Boolean? = null,
|
val is_video: Boolean? = null,
|
||||||
val thumb: PhotoSize? = null,
|
val thumbnail: PhotoSize? = null,
|
||||||
val emoji: String? = null,
|
val emoji: String? = null,
|
||||||
val set_name: StickerSetName? = null,
|
val set_name: StickerSetName? = null,
|
||||||
val premium_animation: File? = null,
|
val premium_animation: File? = null,
|
||||||
@ -43,6 +43,7 @@ sealed interface Sticker : TelegramMediaFile, SizedMediaFile, ThumbedMediaFile {
|
|||||||
get() = false
|
get() = false
|
||||||
val isVideo
|
val isVideo
|
||||||
get() = false
|
get() = false
|
||||||
|
val type: StickerType
|
||||||
|
|
||||||
fun asInputSticker(emojis: List<String> = emoji ?.let { listOf(it) } ?: error("Unable to create input sticker without emojis")): InputSticker
|
fun asInputSticker(emojis: List<String> = emoji ?.let { listOf(it) } ?: error("Unable to create input sticker without emojis")): InputSticker
|
||||||
}
|
}
|
||||||
@ -62,7 +63,7 @@ object StickerSerializer : KSerializer<Sticker> {
|
|||||||
surrogate.file_unique_id,
|
surrogate.file_unique_id,
|
||||||
surrogate.width,
|
surrogate.width,
|
||||||
surrogate.height,
|
surrogate.height,
|
||||||
surrogate.thumb,
|
surrogate.thumbnail,
|
||||||
surrogate.emoji,
|
surrogate.emoji,
|
||||||
surrogate.set_name,
|
surrogate.set_name,
|
||||||
surrogate.premium_animation,
|
surrogate.premium_animation,
|
||||||
@ -73,7 +74,7 @@ object StickerSerializer : KSerializer<Sticker> {
|
|||||||
surrogate.file_unique_id,
|
surrogate.file_unique_id,
|
||||||
surrogate.width,
|
surrogate.width,
|
||||||
surrogate.height,
|
surrogate.height,
|
||||||
surrogate.thumb,
|
surrogate.thumbnail,
|
||||||
surrogate.emoji,
|
surrogate.emoji,
|
||||||
surrogate.set_name,
|
surrogate.set_name,
|
||||||
surrogate.premium_animation,
|
surrogate.premium_animation,
|
||||||
@ -84,7 +85,7 @@ object StickerSerializer : KSerializer<Sticker> {
|
|||||||
surrogate.file_unique_id,
|
surrogate.file_unique_id,
|
||||||
surrogate.width,
|
surrogate.width,
|
||||||
surrogate.height,
|
surrogate.height,
|
||||||
surrogate.thumb,
|
surrogate.thumbnail,
|
||||||
surrogate.emoji,
|
surrogate.emoji,
|
||||||
surrogate.set_name,
|
surrogate.set_name,
|
||||||
surrogate.premium_animation,
|
surrogate.premium_animation,
|
||||||
@ -98,7 +99,7 @@ object StickerSerializer : KSerializer<Sticker> {
|
|||||||
surrogate.width,
|
surrogate.width,
|
||||||
surrogate.height,
|
surrogate.height,
|
||||||
surrogate.mask_position,
|
surrogate.mask_position,
|
||||||
surrogate.thumb,
|
surrogate.thumbnail,
|
||||||
surrogate.emoji,
|
surrogate.emoji,
|
||||||
surrogate.set_name,
|
surrogate.set_name,
|
||||||
surrogate.file_size
|
surrogate.file_size
|
||||||
@ -109,7 +110,7 @@ object StickerSerializer : KSerializer<Sticker> {
|
|||||||
surrogate.width,
|
surrogate.width,
|
||||||
surrogate.height,
|
surrogate.height,
|
||||||
surrogate.mask_position,
|
surrogate.mask_position,
|
||||||
surrogate.thumb,
|
surrogate.thumbnail,
|
||||||
surrogate.emoji,
|
surrogate.emoji,
|
||||||
surrogate.set_name,
|
surrogate.set_name,
|
||||||
surrogate.file_size
|
surrogate.file_size
|
||||||
@ -120,7 +121,7 @@ object StickerSerializer : KSerializer<Sticker> {
|
|||||||
surrogate.width,
|
surrogate.width,
|
||||||
surrogate.height,
|
surrogate.height,
|
||||||
surrogate.mask_position,
|
surrogate.mask_position,
|
||||||
surrogate.thumb,
|
surrogate.thumbnail,
|
||||||
surrogate.emoji,
|
surrogate.emoji,
|
||||||
surrogate.set_name,
|
surrogate.set_name,
|
||||||
surrogate.file_size
|
surrogate.file_size
|
||||||
@ -133,7 +134,7 @@ object StickerSerializer : KSerializer<Sticker> {
|
|||||||
surrogate.width,
|
surrogate.width,
|
||||||
surrogate.height,
|
surrogate.height,
|
||||||
surrogate.custom_emoji_id ?: error("For custom emoji stickers field custom_emoji_id should be presented"),
|
surrogate.custom_emoji_id ?: error("For custom emoji stickers field custom_emoji_id should be presented"),
|
||||||
surrogate.thumb,
|
surrogate.thumbnail,
|
||||||
surrogate.emoji,
|
surrogate.emoji,
|
||||||
surrogate.set_name,
|
surrogate.set_name,
|
||||||
surrogate.file_size,
|
surrogate.file_size,
|
||||||
@ -145,7 +146,7 @@ object StickerSerializer : KSerializer<Sticker> {
|
|||||||
surrogate.width,
|
surrogate.width,
|
||||||
surrogate.height,
|
surrogate.height,
|
||||||
surrogate.custom_emoji_id ?: error("For custom emoji stickers field custom_emoji_id should be presented"),
|
surrogate.custom_emoji_id ?: error("For custom emoji stickers field custom_emoji_id should be presented"),
|
||||||
surrogate.thumb,
|
surrogate.thumbnail,
|
||||||
surrogate.emoji,
|
surrogate.emoji,
|
||||||
surrogate.set_name,
|
surrogate.set_name,
|
||||||
surrogate.file_size,
|
surrogate.file_size,
|
||||||
@ -157,7 +158,7 @@ object StickerSerializer : KSerializer<Sticker> {
|
|||||||
surrogate.width,
|
surrogate.width,
|
||||||
surrogate.height,
|
surrogate.height,
|
||||||
surrogate.custom_emoji_id ?: error("For custom emoji stickers field custom_emoji_id should be presented"),
|
surrogate.custom_emoji_id ?: error("For custom emoji stickers field custom_emoji_id should be presented"),
|
||||||
surrogate.thumb,
|
surrogate.thumbnail,
|
||||||
surrogate.emoji,
|
surrogate.emoji,
|
||||||
surrogate.set_name,
|
surrogate.set_name,
|
||||||
surrogate.file_size,
|
surrogate.file_size,
|
||||||
@ -169,7 +170,7 @@ object StickerSerializer : KSerializer<Sticker> {
|
|||||||
surrogate.file_unique_id,
|
surrogate.file_unique_id,
|
||||||
surrogate.width,
|
surrogate.width,
|
||||||
surrogate.height,
|
surrogate.height,
|
||||||
surrogate.thumb,
|
surrogate.thumbnail,
|
||||||
surrogate.emoji,
|
surrogate.emoji,
|
||||||
surrogate.set_name,
|
surrogate.set_name,
|
||||||
surrogate.file_size,
|
surrogate.file_size,
|
||||||
@ -178,13 +179,35 @@ object StickerSerializer : KSerializer<Sticker> {
|
|||||||
surrogate.is_video == true -> StickerFormat.Video
|
surrogate.is_video == true -> StickerFormat.Video
|
||||||
else -> StickerFormat.Static
|
else -> StickerFormat.Static
|
||||||
},
|
},
|
||||||
|
surrogate.type,
|
||||||
json
|
json
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun serialize(encoder: Encoder, value: Sticker) {
|
override fun serialize(encoder: Encoder, value: Sticker) {
|
||||||
TODO("Not yet implemented")
|
with(value) {
|
||||||
|
StickerSurrogate.serializer().serialize(
|
||||||
|
encoder,
|
||||||
|
StickerSurrogate(
|
||||||
|
fileId,
|
||||||
|
fileUniqueId,
|
||||||
|
type,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
isAnimated,
|
||||||
|
isVideo,
|
||||||
|
thumbnail,
|
||||||
|
emoji,
|
||||||
|
stickerSetName,
|
||||||
|
(this as? RegularSticker) ?.premiumAnimationFile,
|
||||||
|
(this as? MaskSticker) ?.maskPosition,
|
||||||
|
(this as? CustomEmojiSticker) ?.customEmojiId,
|
||||||
|
fileSize,
|
||||||
|
(this as? CustomEmojiSticker) ?.needsRepainting ?: false
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -210,6 +233,9 @@ sealed interface AnimatedSticker : Sticker {
|
|||||||
sealed interface RegularSticker : Sticker {
|
sealed interface RegularSticker : Sticker {
|
||||||
val premiumAnimationFile: File?
|
val premiumAnimationFile: File?
|
||||||
|
|
||||||
|
override val type: StickerType.Regular
|
||||||
|
get() = StickerType.Regular
|
||||||
|
|
||||||
override fun asInputSticker(emojis: List<String>) = InputSticker.WithKeywords.Regular(
|
override fun asInputSticker(emojis: List<String>) = InputSticker.WithKeywords.Regular(
|
||||||
fileId,
|
fileId,
|
||||||
emojis,
|
emojis,
|
||||||
@ -241,6 +267,11 @@ data class RegularSimpleSticker(
|
|||||||
@SerialName(stickerFormatField)
|
@SerialName(stickerFormatField)
|
||||||
@EncodeDefault
|
@EncodeDefault
|
||||||
override val stickerFormat: StickerFormat = StickerFormat.Static
|
override val stickerFormat: StickerFormat = StickerFormat.Static
|
||||||
|
@SerialName(stickerTypeField)
|
||||||
|
@Serializable(StickerType.Serializer::class)
|
||||||
|
@EncodeDefault
|
||||||
|
override val type: StickerType.Regular
|
||||||
|
get() = StickerType.Regular
|
||||||
}
|
}
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
@ -263,7 +294,13 @@ data class RegularAnimatedSticker(
|
|||||||
override val premiumAnimationFile: File? = null,
|
override val premiumAnimationFile: File? = null,
|
||||||
@SerialName(fileSizeField)
|
@SerialName(fileSizeField)
|
||||||
override val fileSize: Long? = null,
|
override val fileSize: Long? = null,
|
||||||
) : RegularSticker, AnimatedSticker
|
) : RegularSticker, AnimatedSticker {
|
||||||
|
@SerialName(stickerTypeField)
|
||||||
|
@Serializable(StickerType.Serializer::class)
|
||||||
|
@EncodeDefault
|
||||||
|
override val type: StickerType.Regular
|
||||||
|
get() = StickerType.Regular
|
||||||
|
}
|
||||||
@Serializable
|
@Serializable
|
||||||
data class RegularVideoSticker(
|
data class RegularVideoSticker(
|
||||||
@SerialName(fileIdField)
|
@SerialName(fileIdField)
|
||||||
@ -284,13 +321,22 @@ data class RegularVideoSticker(
|
|||||||
override val premiumAnimationFile: File? = null,
|
override val premiumAnimationFile: File? = null,
|
||||||
@SerialName(fileSizeField)
|
@SerialName(fileSizeField)
|
||||||
override val fileSize: Long? = null,
|
override val fileSize: Long? = null,
|
||||||
) : RegularSticker, VideoSticker
|
) : RegularSticker, VideoSticker {
|
||||||
|
@SerialName(stickerTypeField)
|
||||||
|
@Serializable(StickerType.Serializer::class)
|
||||||
|
@EncodeDefault
|
||||||
|
override val type: StickerType.Regular
|
||||||
|
get() = StickerType.Regular
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
sealed interface MaskSticker : Sticker {
|
sealed interface MaskSticker : Sticker {
|
||||||
val maskPosition: MaskPosition?
|
val maskPosition: MaskPosition?
|
||||||
|
|
||||||
|
override val type: StickerType.Mask
|
||||||
|
get() = StickerType.Mask
|
||||||
|
|
||||||
override fun asInputSticker(emojis: List<String>) = InputSticker.Mask(
|
override fun asInputSticker(emojis: List<String>) = InputSticker.Mask(
|
||||||
fileId,
|
fileId,
|
||||||
emojis,
|
emojis,
|
||||||
@ -321,6 +367,12 @@ data class MaskSimpleSticker(
|
|||||||
@SerialName(stickerFormatField)
|
@SerialName(stickerFormatField)
|
||||||
@EncodeDefault
|
@EncodeDefault
|
||||||
override val stickerFormat: StickerFormat = StickerFormat.Static
|
override val stickerFormat: StickerFormat = StickerFormat.Static
|
||||||
|
|
||||||
|
@SerialName(stickerTypeField)
|
||||||
|
@Serializable(StickerType.Serializer::class)
|
||||||
|
@EncodeDefault
|
||||||
|
override val type: StickerType.Mask
|
||||||
|
get() = StickerType.Mask
|
||||||
}
|
}
|
||||||
@Serializable
|
@Serializable
|
||||||
data class MaskAnimatedSticker(
|
data class MaskAnimatedSticker(
|
||||||
@ -342,7 +394,13 @@ data class MaskAnimatedSticker(
|
|||||||
override val stickerSetName: StickerSetName? = null,
|
override val stickerSetName: StickerSetName? = null,
|
||||||
@SerialName(fileSizeField)
|
@SerialName(fileSizeField)
|
||||||
override val fileSize: Long? = null,
|
override val fileSize: Long? = null,
|
||||||
) : MaskSticker, AnimatedSticker
|
) : MaskSticker, AnimatedSticker {
|
||||||
|
@SerialName(stickerTypeField)
|
||||||
|
@Serializable(StickerType.Serializer::class)
|
||||||
|
@EncodeDefault
|
||||||
|
override val type: StickerType.Mask
|
||||||
|
get() = StickerType.Mask
|
||||||
|
}
|
||||||
@Serializable
|
@Serializable
|
||||||
data class MaskVideoSticker(
|
data class MaskVideoSticker(
|
||||||
@SerialName(fileIdField)
|
@SerialName(fileIdField)
|
||||||
@ -363,13 +421,22 @@ data class MaskVideoSticker(
|
|||||||
override val stickerSetName: StickerSetName? = null,
|
override val stickerSetName: StickerSetName? = null,
|
||||||
@SerialName(fileSizeField)
|
@SerialName(fileSizeField)
|
||||||
override val fileSize: Long? = null,
|
override val fileSize: Long? = null,
|
||||||
) : MaskSticker, VideoSticker
|
) : MaskSticker, VideoSticker {
|
||||||
|
@SerialName(stickerTypeField)
|
||||||
|
@Serializable(StickerType.Serializer::class)
|
||||||
|
@EncodeDefault
|
||||||
|
override val type: StickerType.Mask
|
||||||
|
get() = StickerType.Mask
|
||||||
|
}
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
sealed interface CustomEmojiSticker : Sticker {
|
sealed interface CustomEmojiSticker : Sticker {
|
||||||
val customEmojiId: CustomEmojiId
|
val customEmojiId: CustomEmojiId
|
||||||
val needsRepainting: Boolean
|
val needsRepainting: Boolean
|
||||||
|
|
||||||
|
override val type: StickerType.CustomEmoji
|
||||||
|
get() = StickerType.CustomEmoji
|
||||||
|
|
||||||
override fun asInputSticker(emojis: List<String>) = InputSticker.WithKeywords.CustomEmoji(
|
override fun asInputSticker(emojis: List<String>) = InputSticker.WithKeywords.CustomEmoji(
|
||||||
fileId,
|
fileId,
|
||||||
emojis,
|
emojis,
|
||||||
@ -403,6 +470,12 @@ data class CustomEmojiSimpleSticker(
|
|||||||
@SerialName(stickerFormatField)
|
@SerialName(stickerFormatField)
|
||||||
@EncodeDefault
|
@EncodeDefault
|
||||||
override val stickerFormat: StickerFormat = StickerFormat.Static
|
override val stickerFormat: StickerFormat = StickerFormat.Static
|
||||||
|
|
||||||
|
@SerialName(stickerTypeField)
|
||||||
|
@Serializable(StickerType.Serializer::class)
|
||||||
|
@EncodeDefault
|
||||||
|
override val type: StickerType.CustomEmoji
|
||||||
|
get() = StickerType.CustomEmoji
|
||||||
}
|
}
|
||||||
@Serializable
|
@Serializable
|
||||||
data class CustomEmojiAnimatedSticker(
|
data class CustomEmojiAnimatedSticker(
|
||||||
@ -426,7 +499,13 @@ data class CustomEmojiAnimatedSticker(
|
|||||||
override val fileSize: Long? = null,
|
override val fileSize: Long? = null,
|
||||||
@SerialName(needsRepaintingField)
|
@SerialName(needsRepaintingField)
|
||||||
override val needsRepainting: Boolean = false,
|
override val needsRepainting: Boolean = false,
|
||||||
) : CustomEmojiSticker, AnimatedSticker
|
) : CustomEmojiSticker, AnimatedSticker {
|
||||||
|
@SerialName(stickerTypeField)
|
||||||
|
@Serializable(StickerType.Serializer::class)
|
||||||
|
@EncodeDefault
|
||||||
|
override val type: StickerType.CustomEmoji
|
||||||
|
get() = StickerType.CustomEmoji
|
||||||
|
}
|
||||||
@Serializable
|
@Serializable
|
||||||
data class CustomEmojiVideoSticker(
|
data class CustomEmojiVideoSticker(
|
||||||
@SerialName(fileIdField)
|
@SerialName(fileIdField)
|
||||||
@ -449,7 +528,13 @@ data class CustomEmojiVideoSticker(
|
|||||||
override val fileSize: Long? = null,
|
override val fileSize: Long? = null,
|
||||||
@SerialName(needsRepaintingField)
|
@SerialName(needsRepaintingField)
|
||||||
override val needsRepainting: Boolean = false,
|
override val needsRepainting: Boolean = false,
|
||||||
) : CustomEmojiSticker, VideoSticker
|
) : CustomEmojiSticker, VideoSticker {
|
||||||
|
@SerialName(stickerTypeField)
|
||||||
|
@Serializable(StickerType.Serializer::class)
|
||||||
|
@EncodeDefault
|
||||||
|
override val type: StickerType.CustomEmoji
|
||||||
|
get() = StickerType.CustomEmoji
|
||||||
|
}
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class UnknownSticker(
|
data class UnknownSticker(
|
||||||
@ -471,6 +556,9 @@ data class UnknownSticker(
|
|||||||
override val fileSize: Long? = null,
|
override val fileSize: Long? = null,
|
||||||
@SerialName(stickerFormatField)
|
@SerialName(stickerFormatField)
|
||||||
override val stickerFormat: StickerFormat = StickerFormat.Static,
|
override val stickerFormat: StickerFormat = StickerFormat.Static,
|
||||||
|
@SerialName(stickerTypeField)
|
||||||
|
@Serializable(StickerType.Serializer::class)
|
||||||
|
override val type: StickerType = StickerType.Regular,
|
||||||
val raw: JsonElement
|
val raw: JsonElement
|
||||||
) : Sticker {
|
) : Sticker {
|
||||||
override fun asInputSticker(emojis: List<String>) = InputSticker.WithKeywords.Regular(
|
override fun asInputSticker(emojis: List<String>) = InputSticker.WithKeywords.Regular(
|
||||||
|
Loading…
Reference in New Issue
Block a user