Package dev.inmo.tgbotapi.types.files

Types

Link copied to clipboard
data class AnimatedSticker(    val fileId: FileId,     val fileUniqueId: FileUniqueId,     val width: Int,     val height: Int,     val thumb: PhotoSize? = null,     val emoji: String? = null,     val stickerSetName: StickerSetName? = null,     val premiumAnimationFile: File?,     val maskPosition: MaskPosition? = null,     val fileSize: Long? = null) : Sticker
Link copied to clipboard
data class AnimationFile(    val fileId: FileId,     val fileUniqueId: FileUniqueId,     val width: Int,     val height: Int,     val duration: Long? = null,     val thumb: PhotoSize? = null,     val fileName: String? = null,     val mimeType: MimeType? = null,     val fileSize: Long? = null) : TelegramMediaFile, MimedMediaFile, ThumbedMediaFile, PlayableMediaFile, CustomNamedMediaFile, SizedMediaFile
Link copied to clipboard
data class AudioFile(    val fileId: FileId,     val fileUniqueId: FileUniqueId,     val duration: Long? = null,     val performer: String? = null,     val title: String? = null,     val fileName: String? = null,     val mimeType: MimeType? = null,     val fileSize: Long? = null,     val thumb: PhotoSize? = null) : TelegramMediaFile, CustomNamedMediaFile, MimedMediaFile, ThumbedMediaFile, PlayableMediaFile, TitledMediaFile, Performerable
Link copied to clipboard
interface CustomNamedMediaFile
Link copied to clipboard
data class DocumentFile(    val fileId: FileId,     val fileUniqueId: FileUniqueId,     val fileSize: Long? = null,     val thumb: PhotoSize? = null,     val mimeType: MimeType? = null,     val fileName: String? = null) : TelegramMediaFile, MimedMediaFile, ThumbedMediaFile, CustomNamedMediaFile
Link copied to clipboard
data class File(    val fileId: FileId,     val fileUniqueId: FileUniqueId,     val fileSize: Long? = null) : TelegramMediaFile
Link copied to clipboard
interface MimedMediaFile : TelegramMediaFile, MimeTyped
Link copied to clipboard
data class PassportFile(    val fileId: FileId,     val fileUniqueId: FileUniqueId,     val uploadingDate: TelegramDate,     val fileSize: Long? = null) : TelegramMediaFile

This object represents a file uploaded to Telegram Passport. Currently all Telegram Passport files are in JPEG format when decrypted and don't exceed 10MB.

Link copied to clipboard
data class PathedFile(    val fileId: FileId,     val fileUniqueId: FileUniqueId,     val filePath: String,     val fileSize: Long? = null) : TelegramMediaFile
Link copied to clipboard
typealias Photo = List<PhotoSize>
Link copied to clipboard
object PhotoSerializer : KSerializer<Photo>
Link copied to clipboard
data class PhotoSize(    val fileId: FileId,     val fileUniqueId: FileUniqueId,     val fileSize: Long? = null,     val width: Int,     val height: Int) : SizedMediaFile
Link copied to clipboard
interface PlayableMediaFile : TelegramMediaFile
Link copied to clipboard
data class SimpleSticker(    val fileId: FileId,     val fileUniqueId: FileUniqueId,     val width: Int,     val height: Int,     val thumb: PhotoSize? = null,     val emoji: String? = null,     val stickerSetName: StickerSetName? = null,     val premiumAnimationFile: File?,     val maskPosition: MaskPosition? = null,     val fileSize: Long? = null) : Sticker
Link copied to clipboard
interface SizedMediaFile : TelegramMediaFile
Link copied to clipboard
interface Sticker : TelegramMediaFile, SizedMediaFile, ThumbedMediaFile
Link copied to clipboard
object StickerSerializer : KSerializer<Sticker>
Link copied to clipboard
data class StickerSurrogate(    val file_id: FileId,     val file_unique_id: FileUniqueId,     val width: Int,     val height: Int,     val is_animated: Boolean? = null,     val is_video: Boolean? = null,     val thumb: PhotoSize? = null,     val emoji: String? = null,     val set_name: StickerSetName? = null,     val mask_position: MaskPosition? = null,     val file_size: Long? = null,     val premium_animation: File? = null)
Link copied to clipboard
interface TelegramMediaFile

Declare common part of media files in Telegram. Note: it is not representation of JVM File type

Link copied to clipboard
interface ThumbedMediaFile : TelegramMediaFile
Link copied to clipboard
interface TitledMediaFile
Link copied to clipboard
data class VideoFile(    val fileId: FileId,     val fileUniqueId: FileUniqueId,     val width: Int,     val height: Int,     val duration: Long? = null,     val thumb: PhotoSize? = null,     val fileName: String? = null,     val mimeType: MimeType? = null,     val fileSize: Long? = null) : TelegramMediaFile, CustomNamedMediaFile, MimedMediaFile, ThumbedMediaFile, PlayableMediaFile, SizedMediaFile
Link copied to clipboard
data class VideoNoteFile(    val fileId: FileId,     val fileUniqueId: FileUniqueId,     val width: Int,     val duration: Long? = null,     val thumb: PhotoSize? = null,     val fileSize: Long? = null) : TelegramMediaFile, ThumbedMediaFile, PlayableMediaFile, SizedMediaFile
Link copied to clipboard
data class VideoSticker(    val fileId: FileId,     val fileUniqueId: FileUniqueId,     val width: Int,     val height: Int,     val thumb: PhotoSize? = null,     val emoji: String? = null,     val stickerSetName: StickerSetName? = null,     val premiumAnimationFile: File?,     val maskPosition: MaskPosition? = null,     val fileSize: Long? = null) : Sticker
Link copied to clipboard
data class VoiceFile(    val fileId: FileId,     val fileUniqueId: FileUniqueId,     val duration: Long? = null,     val mimeType: MimeType? = null,     val fileSize: Long? = null) : TelegramMediaFile, MimedMediaFile, PlayableMediaFile

Functions

Link copied to clipboard
fun VoiceFile.asAudioFile(    performer: String? = null,     title: String? = null,     fileName: String? = null): AudioFile
Link copied to clipboard
inline fun TelegramMediaFile.asDocumentFile(): DocumentFile
Link copied to clipboard
fun PathedFile.asStream(telegramAPIUrlsKeeper: TelegramAPIUrlsKeeper): InputStream
Link copied to clipboard
fun AudioFile.asVoiceFile(): VoiceFile
Link copied to clipboard
fun Photo.biggest(): PhotoSize?
Link copied to clipboard
fun PathedFile.fullUrl(keeper: TelegramAPIUrlsKeeper): String
Link copied to clipboard
fun TelegramAPIUrlsKeeper.resolveFileURL(file: PathedFile): String
Link copied to clipboard
inline fun VideoFile.toTelegramMediaVideo(textSources: TextSourcesList): TelegramMediaVideo
inline fun VideoFile.toTelegramMediaVideo(text: String? = null, parseMode: ParseMode? = null): TelegramMediaVideo