diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/AddStickerToSet.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/AddStickerToSet.kt index cc167680ba..275d372f8a 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/AddStickerToSet.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/AddStickerToSet.kt @@ -33,7 +33,10 @@ suspend fun TelegramBot.addStickerToSet( emojis, 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( sticker, emojis, @@ -48,7 +51,7 @@ suspend fun TelegramBot.addStickerToSet( stickerSet: StickerSet, sticker: InputFile, emojis: List, - maskPosition: MaskPosition + maskPosition: MaskPosition? = null ) = addStickerToSet( userId, stickerSet.name, @@ -87,7 +90,7 @@ suspend fun TelegramBot.addStickerToSet( stickerSet: StickerSet, sticker: InputFile, emojis: List, - maskPosition: MaskPosition + maskPosition: MaskPosition? = null ) = addStickerToSet( user.id, stickerSet, sticker, emojis, maskPosition ) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/stickers/InputSticker.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/stickers/InputSticker.kt index aaac6fc0cc..9633b555a7 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/stickers/InputSticker.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/stickers/InputSticker.kt @@ -23,7 +23,7 @@ sealed interface InputSticker { @SerialName(emojiListField) override val emojisList: List, @SerialName(maskPositionField) - val maskPosition: MaskPosition + val maskPosition: MaskPosition? = null ) : InputSticker @Serializable diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/Sticker.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/Sticker.kt index c95fc364d4..bd4c1403ee 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/Sticker.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/Sticker.kt @@ -93,7 +93,7 @@ object StickerSerializer : KSerializer { surrogate.file_unique_id, surrogate.width, surrogate.height, - surrogate.mask_position ?: error("For mask stickers field mask_position should be presented"), + surrogate.mask_position, surrogate.thumb, surrogate.emoji, surrogate.set_name, @@ -104,7 +104,7 @@ object StickerSerializer : KSerializer { surrogate.file_unique_id, surrogate.width, surrogate.height, - surrogate.mask_position ?: error("For mask stickers field mask_position should be presented"), + surrogate.mask_position, surrogate.thumb, surrogate.emoji, surrogate.set_name, @@ -115,7 +115,7 @@ object StickerSerializer : KSerializer { surrogate.file_unique_id, surrogate.width, surrogate.height, - surrogate.mask_position ?: error("For mask stickers field mask_position should be presented"), + surrogate.mask_position, surrogate.thumb, surrogate.emoji, surrogate.set_name, @@ -128,7 +128,7 @@ object StickerSerializer : KSerializer { surrogate.file_unique_id, surrogate.width, 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.emoji, surrogate.set_name, @@ -139,7 +139,7 @@ object StickerSerializer : KSerializer { surrogate.file_unique_id, surrogate.width, 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.emoji, surrogate.set_name, @@ -150,7 +150,7 @@ object StickerSerializer : KSerializer { surrogate.file_unique_id, surrogate.width, 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.emoji, surrogate.set_name, @@ -276,7 +276,7 @@ data class RegularVideoSticker( @Serializable sealed interface MaskSticker : Sticker { - val maskPosition: MaskPosition + val maskPosition: MaskPosition? } @Serializable data class MaskSimpleSticker( @@ -289,7 +289,7 @@ data class MaskSimpleSticker( @SerialName(heightField) override val height: Int, @SerialName(maskPositionField) - override val maskPosition: MaskPosition, + override val maskPosition: MaskPosition? = null, @SerialName(thumbnailField) override val thumbnail: PhotoSize? = null, @SerialName(emojiField) @@ -314,7 +314,7 @@ data class MaskAnimatedSticker( @SerialName(heightField) override val height: Int, @SerialName(maskPositionField) - override val maskPosition: MaskPosition, + override val maskPosition: MaskPosition? = null, @SerialName(thumbnailField) override val thumbnail: PhotoSize? = null, @SerialName(emojiField) @@ -335,7 +335,7 @@ data class MaskVideoSticker( @SerialName(heightField) override val height: Int, @SerialName(maskPositionField) - override val maskPosition: MaskPosition, + override val maskPosition: MaskPosition? = null, @SerialName(thumbnailField) override val thumbnail: PhotoSize? = null, @SerialName(emojiField)