1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 08:13:47 +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,
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<String>,
maskPosition: MaskPosition
maskPosition: MaskPosition? = null
) = addStickerToSet(
userId,
stickerSet.name,
@ -87,7 +90,7 @@ suspend fun TelegramBot.addStickerToSet(
stickerSet: StickerSet,
sticker: InputFile,
emojis: List<String>,
maskPosition: MaskPosition
maskPosition: MaskPosition? = null
) = addStickerToSet(
user.id, stickerSet, sticker, emojis, maskPosition
)

View File

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

View File

@ -93,7 +93,7 @@ object StickerSerializer : KSerializer<Sticker> {
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<Sticker> {
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<Sticker> {
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<Sticker> {
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<Sticker> {
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<Sticker> {
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)