mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 08:13:47 +00:00
classcasts and raw fields updates
This commit is contained in:
parent
6426ed6571
commit
00d467d091
@ -31,6 +31,7 @@ import dev.inmo.tgbotapi.types.chat.abstracts.extended.*
|
||||
import dev.inmo.tgbotapi.types.dice.*
|
||||
import dev.inmo.tgbotapi.types.files.*
|
||||
import dev.inmo.tgbotapi.types.files.abstracts.*
|
||||
import dev.inmo.tgbotapi.types.files.sticker.*
|
||||
import dev.inmo.tgbotapi.types.files.sticker.Sticker
|
||||
import dev.inmo.tgbotapi.types.location.*
|
||||
import dev.inmo.tgbotapi.types.message.*
|
||||
@ -2310,6 +2311,33 @@ inline fun TelegramMediaFile.asSticker(): Sticker? = this as? Sticker
|
||||
@PreviewFeature
|
||||
inline fun TelegramMediaFile.requireSticker(): Sticker = this as Sticker
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> TelegramMediaFile.whenSimpleSticker(block: (SimpleSticker) -> T) = asSimpleSticker() ?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun TelegramMediaFile.asSimpleSticker(): SimpleSticker? = this as? SimpleSticker
|
||||
|
||||
@PreviewFeature
|
||||
inline fun TelegramMediaFile.requireSimpleSticker(): SimpleSticker = this as SimpleSticker
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> TelegramMediaFile.whenAnimatedSticker(block: (AnimatedSticker) -> T) = asAnimatedSticker() ?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun TelegramMediaFile.asAnimatedSticker(): AnimatedSticker? = this as? AnimatedSticker
|
||||
|
||||
@PreviewFeature
|
||||
inline fun TelegramMediaFile.requireAnimatedSticker(): AnimatedSticker = this as AnimatedSticker
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> TelegramMediaFile.whenVideoSticker(block: (VideoSticker) -> T) = asVideoSticker() ?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun TelegramMediaFile.asVideoSticker(): VideoSticker? = this as? VideoSticker
|
||||
|
||||
@PreviewFeature
|
||||
inline fun TelegramMediaFile.requireVideoSticker(): VideoSticker = this as VideoSticker
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> TelegramMediaFile.whenVideoFile(block: (VideoFile) -> T) = asVideoFile() ?.let(block)
|
||||
|
||||
|
@ -0,0 +1,21 @@
|
||||
package dev.inmo.tgbotapi.extensions.utils.extensions.raw
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.files.sticker.*
|
||||
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
||||
|
||||
inline val Sticker.file_id: FileId
|
||||
get() = fileId
|
||||
inline val Sticker.file_unique_id: FileUniqueId
|
||||
get() = fileUniqueId
|
||||
inline val Sticker.is_animated: Boolean
|
||||
get() = this is AnimatedSticker
|
||||
inline val Sticker.is_video: Boolean
|
||||
get() = this is VideoSticker
|
||||
inline val Sticker.set_name: StickerSetName?
|
||||
get() = stickerSetName
|
||||
inline val Sticker.mask_position: MaskPosition?
|
||||
get() = maskPosition
|
||||
inline val Sticker.file_size: Long?
|
||||
get() = fileSize
|
Loading…
Reference in New Issue
Block a user