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

mask position is nullable in mask stickers and sticker sets

This commit is contained in:
InsanusMokrassar 2023-03-11 01:18:39 +06:00
parent 0c24aa1270
commit 3c4f8787a6
3 changed files with 17 additions and 14 deletions

View File

@ -33,7 +33,10 @@ suspend fun TelegramBot.addStickerToSet(
emojis, emojis,
keywords keywords
) )
StickerType.Mask -> error("Unable to create Mask sticker to the set without maskPosition parameter") StickerType.Mask -> InputSticker.Mask(
sticker,
emojis
)
StickerType.Regular -> InputSticker.WithKeywords.Regular( StickerType.Regular -> InputSticker.WithKeywords.Regular(
sticker, sticker,
emojis, emojis,
@ -48,7 +51,7 @@ suspend fun TelegramBot.addStickerToSet(
stickerSet: StickerSet, stickerSet: StickerSet,
sticker: InputFile, sticker: InputFile,
emojis: List<String>, emojis: List<String>,
maskPosition: MaskPosition maskPosition: MaskPosition? = null
) = addStickerToSet( ) = addStickerToSet(
userId, userId,
stickerSet.name, stickerSet.name,
@ -87,7 +90,7 @@ suspend fun TelegramBot.addStickerToSet(
stickerSet: StickerSet, stickerSet: StickerSet,
sticker: InputFile, sticker: InputFile,
emojis: List<String>, emojis: List<String>,
maskPosition: MaskPosition maskPosition: MaskPosition? = null
) = addStickerToSet( ) = addStickerToSet(
user.id, stickerSet, sticker, emojis, maskPosition user.id, stickerSet, sticker, emojis, maskPosition
) )

View File

@ -23,7 +23,7 @@ sealed interface InputSticker {
@SerialName(emojiListField) @SerialName(emojiListField)
override val emojisList: List<String>, override val emojisList: List<String>,
@SerialName(maskPositionField) @SerialName(maskPositionField)
val maskPosition: MaskPosition val maskPosition: MaskPosition? = null
) : InputSticker ) : InputSticker
@Serializable @Serializable

View File

@ -93,7 +93,7 @@ object StickerSerializer : KSerializer<Sticker> {
surrogate.file_unique_id, surrogate.file_unique_id,
surrogate.width, surrogate.width,
surrogate.height, surrogate.height,
surrogate.mask_position ?: error("For mask stickers field mask_position should be presented"), surrogate.mask_position,
surrogate.thumb, surrogate.thumb,
surrogate.emoji, surrogate.emoji,
surrogate.set_name, surrogate.set_name,
@ -104,7 +104,7 @@ object StickerSerializer : KSerializer<Sticker> {
surrogate.file_unique_id, surrogate.file_unique_id,
surrogate.width, surrogate.width,
surrogate.height, surrogate.height,
surrogate.mask_position ?: error("For mask stickers field mask_position should be presented"), surrogate.mask_position,
surrogate.thumb, surrogate.thumb,
surrogate.emoji, surrogate.emoji,
surrogate.set_name, surrogate.set_name,
@ -115,7 +115,7 @@ object StickerSerializer : KSerializer<Sticker> {
surrogate.file_unique_id, surrogate.file_unique_id,
surrogate.width, surrogate.width,
surrogate.height, surrogate.height,
surrogate.mask_position ?: error("For mask stickers field mask_position should be presented"), surrogate.mask_position,
surrogate.thumb, surrogate.thumb,
surrogate.emoji, surrogate.emoji,
surrogate.set_name, surrogate.set_name,
@ -128,7 +128,7 @@ object StickerSerializer : KSerializer<Sticker> {
surrogate.file_unique_id, surrogate.file_unique_id,
surrogate.width, surrogate.width,
surrogate.height, surrogate.height,
surrogate.custom_emoji_id ?: error("For mask stickers field mask_position should be presented"), surrogate.custom_emoji_id ?: error("For custom emoji stickers field custom_emoji_id should be presented"),
surrogate.thumb, surrogate.thumb,
surrogate.emoji, surrogate.emoji,
surrogate.set_name, surrogate.set_name,
@ -139,7 +139,7 @@ object StickerSerializer : KSerializer<Sticker> {
surrogate.file_unique_id, surrogate.file_unique_id,
surrogate.width, surrogate.width,
surrogate.height, surrogate.height,
surrogate.custom_emoji_id ?: error("For mask stickers field mask_position should be presented"), surrogate.custom_emoji_id ?: error("For custom emoji stickers field custom_emoji_id should be presented"),
surrogate.thumb, surrogate.thumb,
surrogate.emoji, surrogate.emoji,
surrogate.set_name, surrogate.set_name,
@ -150,7 +150,7 @@ object StickerSerializer : KSerializer<Sticker> {
surrogate.file_unique_id, surrogate.file_unique_id,
surrogate.width, surrogate.width,
surrogate.height, surrogate.height,
surrogate.custom_emoji_id ?: error("For mask stickers field mask_position should be presented"), surrogate.custom_emoji_id ?: error("For custom emoji stickers field custom_emoji_id should be presented"),
surrogate.thumb, surrogate.thumb,
surrogate.emoji, surrogate.emoji,
surrogate.set_name, surrogate.set_name,
@ -276,7 +276,7 @@ data class RegularVideoSticker(
@Serializable @Serializable
sealed interface MaskSticker : Sticker { sealed interface MaskSticker : Sticker {
val maskPosition: MaskPosition val maskPosition: MaskPosition?
} }
@Serializable @Serializable
data class MaskSimpleSticker( data class MaskSimpleSticker(
@ -289,7 +289,7 @@ data class MaskSimpleSticker(
@SerialName(heightField) @SerialName(heightField)
override val height: Int, override val height: Int,
@SerialName(maskPositionField) @SerialName(maskPositionField)
override val maskPosition: MaskPosition, override val maskPosition: MaskPosition? = null,
@SerialName(thumbnailField) @SerialName(thumbnailField)
override val thumbnail: PhotoSize? = null, override val thumbnail: PhotoSize? = null,
@SerialName(emojiField) @SerialName(emojiField)
@ -314,7 +314,7 @@ data class MaskAnimatedSticker(
@SerialName(heightField) @SerialName(heightField)
override val height: Int, override val height: Int,
@SerialName(maskPositionField) @SerialName(maskPositionField)
override val maskPosition: MaskPosition, override val maskPosition: MaskPosition? = null,
@SerialName(thumbnailField) @SerialName(thumbnailField)
override val thumbnail: PhotoSize? = null, override val thumbnail: PhotoSize? = null,
@SerialName(emojiField) @SerialName(emojiField)
@ -335,7 +335,7 @@ data class MaskVideoSticker(
@SerialName(heightField) @SerialName(heightField)
override val height: Int, override val height: Int,
@SerialName(maskPositionField) @SerialName(maskPositionField)
override val maskPosition: MaskPosition, override val maskPosition: MaskPosition? = null,
@SerialName(thumbnailField) @SerialName(thumbnailField)
override val thumbnail: PhotoSize? = null, override val thumbnail: PhotoSize? = null,
@SerialName(emojiField) @SerialName(emojiField)