1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2025-11-16 20:10:18 +00:00

update stickers

This commit is contained in:
2024-04-18 16:12:19 +06:00
parent 84abd006ad
commit 28e031265c
6 changed files with 392 additions and 505 deletions

View File

@@ -29,7 +29,7 @@ data class StickerSurrogate(
val mask_position: MaskPosition? = null,
val custom_emoji_id: CustomEmojiId? = null,
val file_size: Long? = null,
val needs_repainting: Boolean = false
val needs_repainting: Boolean = false,
)
// TODO:: Serializer
@@ -40,9 +40,9 @@ sealed interface Sticker : TelegramMediaFile, SizedMediaFile, ThumbedMediaFile,
val stickerFormat: StickerFormat
val isAnimated
get() = false
get() = stickerFormat is StickerFormat.Animated
val isVideo
get() = false
get() = stickerFormat is StickerFormat.Video
val type: StickerType
fun asInputSticker(emojis: List<String> = emoji ?.let { listOf(it) } ?: error("Unable to create input sticker without emojis")): InputSticker
@@ -238,6 +238,7 @@ sealed interface RegularSticker : Sticker {
override fun asInputSticker(emojis: List<String>) = InputSticker.WithKeywords.Regular(
fileId,
stickerFormat,
emojis,
emptyList()
)
@@ -339,6 +340,7 @@ sealed interface MaskSticker : Sticker {
override fun asInputSticker(emojis: List<String>) = InputSticker.Mask(
fileId,
stickerFormat,
emojis,
maskPosition
)
@@ -439,6 +441,7 @@ sealed interface CustomEmojiSticker : Sticker {
override fun asInputSticker(emojis: List<String>) = InputSticker.WithKeywords.CustomEmoji(
fileId,
stickerFormat,
emojis,
emptyList()
)
@@ -563,6 +566,7 @@ data class UnknownSticker(
) : Sticker {
override fun asInputSticker(emojis: List<String>) = InputSticker.WithKeywords.Regular(
fileId,
stickerFormat,
emojis,
emptyList()
)

View File

@@ -21,14 +21,18 @@ data class UsersShared(
requestId: RequestId,
user: SharedUser
) : this(requestId, listOf(user))
constructor(
requestId: RequestId,
userIds: List<UserId>
) : this(requestId, userIds.map { SharedUser(it) })
constructor(
requestId: RequestId,
userId: UserId
) : this(requestId, SharedUser(userId))
override val chatId: ChatId
get() = userId
companion object {
operator fun invoke(
requestId: RequestId,
userIds: List<UserId>
) = UsersShared(requestId, userIds.map { SharedUser(it) })
operator fun invoke(
requestId: RequestId,
userId: UserId
) = UsersShared(requestId, SharedUser(userId))
}
}