mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 08:13:47 +00:00
fix of #550
This commit is contained in:
parent
721b82f912
commit
643f8e577e
@ -3,7 +3,9 @@
|
|||||||
## 1.0.0
|
## 1.0.0
|
||||||
|
|
||||||
* `Core`:
|
* `Core`:
|
||||||
* Constructor of `UnknownInlineKeyboardButton` is not internal and can be created with any `json`
|
* Constructor of `UnknownInlineKeyboardButton` is not internal and can be created with any `json` ([#563](https://github.com/InsanusMokrassar/TelegramBotAPI/issues/563))
|
||||||
|
* All the interfaces from `dev.inmo.tgbotapi.types.files.abstracts` have been replaced to `dev.inmo.tgbotapi.types.files` and converted to sealed ([#550](https://github.com/InsanusMokrassar/TelegramBotAPI/issues/550))
|
||||||
|
* `PassportFile` has been replaced to `dev.inmo.tgbotapi.types.files`
|
||||||
|
|
||||||
## 0.38.13
|
## 0.38.13
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ import dev.inmo.tgbotapi.extensions.api.get.getFileAdditionalInfo
|
|||||||
import dev.inmo.tgbotapi.requests.DownloadFile
|
import dev.inmo.tgbotapi.requests.DownloadFile
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
import dev.inmo.tgbotapi.types.files.PathedFile
|
import dev.inmo.tgbotapi.types.files.PathedFile
|
||||||
import dev.inmo.tgbotapi.types.files.abstracts.TelegramMediaFile
|
import dev.inmo.tgbotapi.types.files.TelegramMediaFile
|
||||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaContent
|
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaContent
|
||||||
|
|
||||||
suspend fun TelegramBot.downloadFile(
|
suspend fun TelegramBot.downloadFile(
|
||||||
|
@ -4,7 +4,7 @@ import dev.inmo.tgbotapi.bot.TelegramBot
|
|||||||
import dev.inmo.tgbotapi.extensions.api.get.getFileAdditionalInfo
|
import dev.inmo.tgbotapi.extensions.api.get.getFileAdditionalInfo
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
import dev.inmo.tgbotapi.types.files.PathedFile
|
import dev.inmo.tgbotapi.types.files.PathedFile
|
||||||
import dev.inmo.tgbotapi.types.files.abstracts.TelegramMediaFile
|
import dev.inmo.tgbotapi.types.files.TelegramMediaFile
|
||||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaContent
|
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaContent
|
||||||
|
|
||||||
suspend fun TelegramBot.downloadFileStream(
|
suspend fun TelegramBot.downloadFileStream(
|
||||||
|
@ -5,7 +5,7 @@ import dev.inmo.tgbotapi.extensions.api.get.getFileAdditionalInfo
|
|||||||
import dev.inmo.tgbotapi.requests.DownloadFileStream
|
import dev.inmo.tgbotapi.requests.DownloadFileStream
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
import dev.inmo.tgbotapi.types.files.PathedFile
|
import dev.inmo.tgbotapi.types.files.PathedFile
|
||||||
import dev.inmo.tgbotapi.types.files.abstracts.TelegramMediaFile
|
import dev.inmo.tgbotapi.types.files.TelegramMediaFile
|
||||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaContent
|
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaContent
|
||||||
|
|
||||||
suspend fun TelegramBot.downloadFileStreamAllocator(
|
suspend fun TelegramBot.downloadFileStreamAllocator(
|
||||||
|
@ -3,7 +3,7 @@ package dev.inmo.tgbotapi.extensions.api.get
|
|||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
import dev.inmo.tgbotapi.requests.get.GetFile
|
import dev.inmo.tgbotapi.requests.get.GetFile
|
||||||
import dev.inmo.tgbotapi.types.files.abstracts.TelegramMediaFile
|
import dev.inmo.tgbotapi.types.files.TelegramMediaFile
|
||||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaContent
|
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaContent
|
||||||
|
|
||||||
suspend fun TelegramBot.getFileAdditionalInfo(
|
suspend fun TelegramBot.getFileAdditionalInfo(
|
||||||
|
@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.extensions.api.get
|
|||||||
|
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.get.GetStickerSet
|
import dev.inmo.tgbotapi.requests.get.GetStickerSet
|
||||||
import dev.inmo.tgbotapi.types.files.sticker.Sticker
|
import dev.inmo.tgbotapi.types.files.Sticker
|
||||||
|
|
||||||
suspend fun TelegramBot.getStickerSet(
|
suspend fun TelegramBot.getStickerSet(
|
||||||
name: String
|
name: String
|
||||||
|
@ -18,12 +18,11 @@ import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
|||||||
import dev.inmo.tgbotapi.types.chat.abstracts.Chat
|
import dev.inmo.tgbotapi.types.chat.abstracts.Chat
|
||||||
import dev.inmo.tgbotapi.types.dice.DiceAnimationType
|
import dev.inmo.tgbotapi.types.dice.DiceAnimationType
|
||||||
import dev.inmo.tgbotapi.types.files.*
|
import dev.inmo.tgbotapi.types.files.*
|
||||||
import dev.inmo.tgbotapi.types.files.abstracts.TelegramMediaFile
|
import dev.inmo.tgbotapi.types.files.TelegramMediaFile
|
||||||
import dev.inmo.tgbotapi.types.files.sticker.Sticker
|
import dev.inmo.tgbotapi.types.files.Sticker
|
||||||
import dev.inmo.tgbotapi.types.games.Game
|
import dev.inmo.tgbotapi.types.games.Game
|
||||||
import dev.inmo.tgbotapi.types.location.*
|
import dev.inmo.tgbotapi.types.location.*
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||||
import dev.inmo.tgbotapi.types.message.content.*
|
|
||||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
|
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
|
||||||
import dev.inmo.tgbotapi.types.message.content.media.*
|
import dev.inmo.tgbotapi.types.message.content.media.*
|
||||||
import dev.inmo.tgbotapi.types.payments.LabeledPrice
|
import dev.inmo.tgbotapi.types.payments.LabeledPrice
|
||||||
|
@ -7,7 +7,7 @@ import dev.inmo.tgbotapi.types.ChatIdentifier
|
|||||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
import dev.inmo.tgbotapi.types.MessageIdentifier
|
||||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.Chat
|
import dev.inmo.tgbotapi.types.chat.abstracts.Chat
|
||||||
import dev.inmo.tgbotapi.types.files.sticker.Sticker
|
import dev.inmo.tgbotapi.types.files.Sticker
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
|
@ -3,7 +3,7 @@ package dev.inmo.tgbotapi.extensions.api.stickers
|
|||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
import dev.inmo.tgbotapi.requests.stickers.DeleteStickerFromSet
|
import dev.inmo.tgbotapi.requests.stickers.DeleteStickerFromSet
|
||||||
import dev.inmo.tgbotapi.types.files.sticker.Sticker
|
import dev.inmo.tgbotapi.types.files.Sticker
|
||||||
|
|
||||||
suspend fun TelegramBot.deleteStickerFromSet(
|
suspend fun TelegramBot.deleteStickerFromSet(
|
||||||
sticker: FileId
|
sticker: FileId
|
||||||
|
@ -3,7 +3,7 @@ package dev.inmo.tgbotapi.extensions.api.stickers
|
|||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
import dev.inmo.tgbotapi.requests.stickers.SetStickerPositionInSet
|
import dev.inmo.tgbotapi.requests.stickers.SetStickerPositionInSet
|
||||||
import dev.inmo.tgbotapi.types.files.sticker.Sticker
|
import dev.inmo.tgbotapi.types.files.Sticker
|
||||||
|
|
||||||
suspend fun TelegramBot.setStickerPositionInSet(
|
suspend fun TelegramBot.setStickerPositionInSet(
|
||||||
sticker: FileId,
|
sticker: FileId,
|
||||||
|
@ -5,7 +5,7 @@ import dev.inmo.tgbotapi.bot.TelegramBot
|
|||||||
import dev.inmo.tgbotapi.extensions.api.get.getFileAdditionalInfo
|
import dev.inmo.tgbotapi.extensions.api.get.getFileAdditionalInfo
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
import dev.inmo.tgbotapi.types.files.PathedFile
|
import dev.inmo.tgbotapi.types.files.PathedFile
|
||||||
import dev.inmo.tgbotapi.types.files.abstracts.TelegramMediaFile
|
import dev.inmo.tgbotapi.types.files.TelegramMediaFile
|
||||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaContent
|
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaContent
|
||||||
import io.ktor.util.cio.use
|
import io.ktor.util.cio.use
|
||||||
import io.ktor.util.cio.writeChannel
|
import io.ktor.util.cio.writeChannel
|
||||||
|
@ -9,7 +9,7 @@ import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.SimpleFilter
|
|||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.ByChatMessageMarkerFactory
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.ByChatMessageMarkerFactory
|
||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.MarkerFactory
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.MarkerFactory
|
||||||
import dev.inmo.tgbotapi.extensions.utils.whenCommonMessage
|
import dev.inmo.tgbotapi.extensions.utils.whenCommonMessage
|
||||||
import dev.inmo.tgbotapi.types.files.abstracts.TelegramMediaFile
|
import dev.inmo.tgbotapi.types.files.TelegramMediaFile
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.CommonMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.CommonMessage
|
||||||
import dev.inmo.tgbotapi.types.message.content.*
|
import dev.inmo.tgbotapi.types.message.content.*
|
||||||
import dev.inmo.tgbotapi.types.message.content.abstracts.*
|
import dev.inmo.tgbotapi.types.message.content.abstracts.*
|
||||||
|
@ -22,7 +22,7 @@ import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.ByC
|
|||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.MarkerFactory
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.MarkerFactory
|
||||||
import dev.inmo.tgbotapi.extensions.utils.asEditMessageUpdate
|
import dev.inmo.tgbotapi.extensions.utils.asEditMessageUpdate
|
||||||
import dev.inmo.tgbotapi.extensions.utils.withContent
|
import dev.inmo.tgbotapi.extensions.utils.withContent
|
||||||
import dev.inmo.tgbotapi.types.files.abstracts.TelegramMediaFile
|
import dev.inmo.tgbotapi.types.files.TelegramMediaFile
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.CommonMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.CommonMessage
|
||||||
import dev.inmo.tgbotapi.types.message.content.*
|
import dev.inmo.tgbotapi.types.message.content.*
|
||||||
import dev.inmo.tgbotapi.types.message.content.abstracts.*
|
import dev.inmo.tgbotapi.types.message.content.abstracts.*
|
||||||
|
@ -2,8 +2,8 @@ package dev.inmo.tgbotapi.requests.get
|
|||||||
|
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||||
|
import dev.inmo.tgbotapi.types.fileIdField
|
||||||
import dev.inmo.tgbotapi.types.files.PathedFile
|
import dev.inmo.tgbotapi.types.files.PathedFile
|
||||||
import dev.inmo.tgbotapi.types.files.abstracts.fileIdField
|
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
|
@ -189,6 +189,13 @@ const val requestContactField = "request_contact"
|
|||||||
const val requestLocationField = "request_location"
|
const val requestLocationField = "request_location"
|
||||||
const val requestPollField = "request_poll"
|
const val requestPollField = "request_poll"
|
||||||
|
|
||||||
|
const val fileNameField = "file_name"
|
||||||
|
const val mimeTypeField = "mime_type"
|
||||||
|
const val fileIdField = "file_id"
|
||||||
|
const val fileSizeField = "file_size"
|
||||||
|
const val fileDateField = "file_date"
|
||||||
|
const val filePathField = "file_path"
|
||||||
|
|
||||||
|
|
||||||
const val requestWriteAccessField = "request_write_access"
|
const val requestWriteAccessField = "request_write_access"
|
||||||
|
|
||||||
|
@ -9,7 +9,6 @@ import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
|||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.files.abstracts.mimeTypeField
|
|
||||||
import dev.inmo.tgbotapi.utils.MimeType
|
import dev.inmo.tgbotapi.utils.MimeType
|
||||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
|
@ -9,7 +9,6 @@ import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource
|
|||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.files.abstracts.mimeTypeField
|
|
||||||
import dev.inmo.tgbotapi.utils.MimeType
|
import dev.inmo.tgbotapi.utils.MimeType
|
||||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
package dev.inmo.tgbotapi.types.files
|
package dev.inmo.tgbotapi.types.files
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
import dev.inmo.tgbotapi.types.FileUniqueId
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.fileUniqueIdField
|
import dev.inmo.tgbotapi.types.files.*
|
||||||
import dev.inmo.tgbotapi.types.files.abstracts.*
|
|
||||||
import dev.inmo.tgbotapi.utils.MimeType
|
import dev.inmo.tgbotapi.utils.MimeType
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
@ -3,7 +3,6 @@ package dev.inmo.tgbotapi.types.files
|
|||||||
import dev.inmo.tgbotapi.CommonAbstracts.Performerable
|
import dev.inmo.tgbotapi.CommonAbstracts.Performerable
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.files.abstracts.*
|
|
||||||
import dev.inmo.tgbotapi.utils.MimeType
|
import dev.inmo.tgbotapi.utils.MimeType
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
package dev.inmo.tgbotapi.types.files
|
||||||
|
|
||||||
|
sealed interface CustomNamedMediaFile {
|
||||||
|
val fileName: String?
|
||||||
|
}
|
@ -1,10 +1,8 @@
|
|||||||
package dev.inmo.tgbotapi.types.files
|
package dev.inmo.tgbotapi.types.files
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
import dev.inmo.tgbotapi.types.FileUniqueId
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.fileUniqueIdField
|
import dev.inmo.tgbotapi.types.files.*
|
||||||
import dev.inmo.tgbotapi.types.files.abstracts.*
|
|
||||||
import dev.inmo.tgbotapi.types.message.content.media.DocumentContent
|
|
||||||
import dev.inmo.tgbotapi.utils.MimeType
|
import dev.inmo.tgbotapi.utils.MimeType
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
package dev.inmo.tgbotapi.types.files
|
package dev.inmo.tgbotapi.types.files
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
import dev.inmo.tgbotapi.types.FileUniqueId
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.fileUniqueIdField
|
import dev.inmo.tgbotapi.types.files.*
|
||||||
import dev.inmo.tgbotapi.types.files.abstracts.*
|
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
package dev.inmo.tgbotapi.types.files
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.MimeTyped
|
||||||
|
import dev.inmo.tgbotapi.types.files.TelegramMediaFile
|
||||||
|
|
||||||
|
sealed interface MimedMediaFile : TelegramMediaFile, MimeTyped
|
@ -0,0 +1,22 @@
|
|||||||
|
package dev.inmo.tgbotapi.types.files
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
@Serializable
|
||||||
|
data class PassportFile(
|
||||||
|
@SerialName(fileIdField)
|
||||||
|
override val fileId: FileId,
|
||||||
|
@SerialName(fileUniqueIdField)
|
||||||
|
override val fileUniqueId: FileUniqueId,
|
||||||
|
@SerialName(fileDateField)
|
||||||
|
val uploadingDate: TelegramDate,
|
||||||
|
@SerialName(fileSizeField)
|
||||||
|
override val fileSize: Long? = null
|
||||||
|
) : TelegramMediaFile
|
@ -1,9 +1,7 @@
|
|||||||
package dev.inmo.tgbotapi.types.files
|
package dev.inmo.tgbotapi.types.files
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
import dev.inmo.tgbotapi.types.FileUniqueId
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.fileUniqueIdField
|
|
||||||
import dev.inmo.tgbotapi.types.files.abstracts.*
|
|
||||||
import dev.inmo.tgbotapi.utils.*
|
import dev.inmo.tgbotapi.utils.*
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
package dev.inmo.tgbotapi.types.files
|
package dev.inmo.tgbotapi.types.files
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
import dev.inmo.tgbotapi.types.FileUniqueId
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.fileUniqueIdField
|
import dev.inmo.tgbotapi.types.files.*
|
||||||
import dev.inmo.tgbotapi.types.files.abstracts.*
|
|
||||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
import kotlinx.serialization.builtins.ListSerializer
|
import kotlinx.serialization.builtins.ListSerializer
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
package dev.inmo.tgbotapi.types.files
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.types.files.TelegramMediaFile
|
||||||
|
|
||||||
|
sealed interface PlayableMediaFile : TelegramMediaFile {
|
||||||
|
val duration: Long?
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
package dev.inmo.tgbotapi.types.files
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.types.files.TelegramMediaFile
|
||||||
|
|
||||||
|
sealed interface SizedMediaFile : TelegramMediaFile {
|
||||||
|
val width: Int
|
||||||
|
val height: Int
|
||||||
|
}
|
@ -1,6 +1,156 @@
|
|||||||
package dev.inmo.tgbotapi.types.files
|
package dev.inmo.tgbotapi.types.files
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.files.sticker.Sticker
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
||||||
|
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||||
|
import kotlinx.serialization.*
|
||||||
|
import kotlinx.serialization.descriptors.SerialDescriptor
|
||||||
|
import kotlinx.serialization.encoding.Decoder
|
||||||
|
import kotlinx.serialization.encoding.Encoder
|
||||||
|
|
||||||
@Deprecated("Replaced", ReplaceWith("Sticker", "dev.inmo.tgbotapi.types.files.sticker.Sticker"))
|
@Serializable
|
||||||
typealias Sticker = Sticker
|
@RiskFeature("This class is used for serialization/deserialization of Sticker interface")
|
||||||
|
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
|
||||||
|
)
|
||||||
|
|
||||||
|
// TODO:: Serializer
|
||||||
|
@Serializable(StickerSerializer::class)
|
||||||
|
sealed interface Sticker : TelegramMediaFile, SizedMediaFile, ThumbedMediaFile {
|
||||||
|
val emoji: String?
|
||||||
|
val maskPosition: MaskPosition?
|
||||||
|
val stickerSetName: StickerSetName?
|
||||||
|
|
||||||
|
val isAnimated
|
||||||
|
get() = this is AnimatedSticker
|
||||||
|
val isVideo
|
||||||
|
get() = this is VideoSticker
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun serializer(): KSerializer<Sticker> = StickerSerializer
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
object StickerSerializer : KSerializer<Sticker> {
|
||||||
|
override val descriptor: SerialDescriptor = StickerSurrogate.serializer().descriptor
|
||||||
|
|
||||||
|
override fun deserialize(decoder: Decoder): Sticker {
|
||||||
|
val surrogate = StickerSurrogate.serializer().deserialize(decoder)
|
||||||
|
|
||||||
|
return when {
|
||||||
|
surrogate.is_animated == true -> AnimatedSticker(
|
||||||
|
surrogate.file_id,
|
||||||
|
surrogate.file_unique_id,
|
||||||
|
surrogate.width,
|
||||||
|
surrogate.height,
|
||||||
|
surrogate.thumb,
|
||||||
|
surrogate.emoji,
|
||||||
|
surrogate.set_name,
|
||||||
|
surrogate.mask_position,
|
||||||
|
surrogate.file_size
|
||||||
|
)
|
||||||
|
surrogate.is_video == true -> VideoSticker(
|
||||||
|
surrogate.file_id,
|
||||||
|
surrogate.file_unique_id,
|
||||||
|
surrogate.width,
|
||||||
|
surrogate.height,
|
||||||
|
surrogate.thumb,
|
||||||
|
surrogate.emoji,
|
||||||
|
surrogate.set_name,
|
||||||
|
surrogate.mask_position,
|
||||||
|
surrogate.file_size
|
||||||
|
)
|
||||||
|
else -> SimpleSticker(
|
||||||
|
surrogate.file_id,
|
||||||
|
surrogate.file_unique_id,
|
||||||
|
surrogate.width,
|
||||||
|
surrogate.height,
|
||||||
|
surrogate.thumb,
|
||||||
|
surrogate.emoji,
|
||||||
|
surrogate.set_name,
|
||||||
|
surrogate.mask_position,
|
||||||
|
surrogate.file_size
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun serialize(encoder: Encoder, value: Sticker) {
|
||||||
|
TODO("Not yet implemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class SimpleSticker(
|
||||||
|
@SerialName(fileIdField)
|
||||||
|
override val fileId: FileId,
|
||||||
|
@SerialName(fileUniqueIdField)
|
||||||
|
override val fileUniqueId: FileUniqueId,
|
||||||
|
@SerialName(widthField)
|
||||||
|
override val width: Int,
|
||||||
|
@SerialName(heightField)
|
||||||
|
override val height: Int,
|
||||||
|
@SerialName(thumbField)
|
||||||
|
override val thumb: PhotoSize? = null,
|
||||||
|
@SerialName(emojiField)
|
||||||
|
override val emoji: String? = null,
|
||||||
|
@SerialName(stickerSetNameField)
|
||||||
|
override val stickerSetName: StickerSetName? = null,
|
||||||
|
@SerialName(maskPositionField)
|
||||||
|
override val maskPosition: MaskPosition? = null,
|
||||||
|
@SerialName(fileSizeField)
|
||||||
|
override val fileSize: Long? = null,
|
||||||
|
) : Sticker
|
||||||
|
@Serializable
|
||||||
|
data class AnimatedSticker(
|
||||||
|
@SerialName(fileIdField)
|
||||||
|
override val fileId: FileId,
|
||||||
|
@SerialName(fileUniqueIdField)
|
||||||
|
override val fileUniqueId: FileUniqueId,
|
||||||
|
@SerialName(widthField)
|
||||||
|
override val width: Int,
|
||||||
|
@SerialName(heightField)
|
||||||
|
override val height: Int,
|
||||||
|
@SerialName(thumbField)
|
||||||
|
override val thumb: PhotoSize? = null,
|
||||||
|
@SerialName(emojiField)
|
||||||
|
override val emoji: String? = null,
|
||||||
|
@SerialName(stickerSetNameField)
|
||||||
|
override val stickerSetName: StickerSetName? = null,
|
||||||
|
@SerialName(maskPositionField)
|
||||||
|
override val maskPosition: MaskPosition? = null,
|
||||||
|
@SerialName(fileSizeField)
|
||||||
|
override val fileSize: Long? = null,
|
||||||
|
) : Sticker
|
||||||
|
@Serializable
|
||||||
|
data class VideoSticker(
|
||||||
|
@SerialName(fileIdField)
|
||||||
|
override val fileId: FileId,
|
||||||
|
@SerialName(fileUniqueIdField)
|
||||||
|
override val fileUniqueId: FileUniqueId,
|
||||||
|
@SerialName(widthField)
|
||||||
|
override val width: Int,
|
||||||
|
@SerialName(heightField)
|
||||||
|
override val height: Int,
|
||||||
|
@SerialName(thumbField)
|
||||||
|
override val thumb: PhotoSize? = null,
|
||||||
|
@SerialName(emojiField)
|
||||||
|
override val emoji: String? = null,
|
||||||
|
@SerialName(stickerSetNameField)
|
||||||
|
override val stickerSetName: StickerSetName? = null,
|
||||||
|
@SerialName(maskPositionField)
|
||||||
|
override val maskPosition: MaskPosition? = null,
|
||||||
|
@SerialName(fileSizeField)
|
||||||
|
override val fileSize: Long? = null,
|
||||||
|
) : Sticker
|
||||||
|
@ -1,17 +1,12 @@
|
|||||||
package dev.inmo.tgbotapi.types.files.abstracts
|
package dev.inmo.tgbotapi.types.files
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
import dev.inmo.tgbotapi.types.FileUniqueId
|
import dev.inmo.tgbotapi.types.FileUniqueId
|
||||||
|
|
||||||
internal const val fileIdField = "file_id"
|
|
||||||
internal const val fileSizeField = "file_size"
|
|
||||||
internal const val fileDateField = "file_date"
|
|
||||||
internal const val filePathField = "file_path"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Declare common part of media files in Telegram. Note: it is not representation of JVM `File` type
|
* Declare common part of media files in Telegram. Note: it is not representation of JVM `File` type
|
||||||
*/
|
*/
|
||||||
interface TelegramMediaFile {
|
sealed interface TelegramMediaFile {
|
||||||
val fileId: FileId
|
val fileId: FileId
|
||||||
val fileUniqueId: FileUniqueId
|
val fileUniqueId: FileUniqueId
|
||||||
val fileSize: Long?
|
val fileSize: Long?
|
@ -0,0 +1,8 @@
|
|||||||
|
package dev.inmo.tgbotapi.types.files
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.types.files.PhotoSize
|
||||||
|
import dev.inmo.tgbotapi.types.files.TelegramMediaFile
|
||||||
|
|
||||||
|
sealed interface ThumbedMediaFile : TelegramMediaFile {
|
||||||
|
val thumb: PhotoSize?
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
package dev.inmo.tgbotapi.types.files
|
||||||
|
|
||||||
|
sealed interface TitledMediaFile {
|
||||||
|
val title: String?
|
||||||
|
}
|
@ -5,7 +5,6 @@ import dev.inmo.tgbotapi.types.*
|
|||||||
import dev.inmo.tgbotapi.types.InputMedia.InputMediaVideo
|
import dev.inmo.tgbotapi.types.InputMedia.InputMediaVideo
|
||||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.files.abstracts.*
|
|
||||||
import dev.inmo.tgbotapi.utils.MimeType
|
import dev.inmo.tgbotapi.utils.MimeType
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
package dev.inmo.tgbotapi.types.files
|
package dev.inmo.tgbotapi.types.files
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
import dev.inmo.tgbotapi.types.FileUniqueId
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.fileUniqueIdField
|
import dev.inmo.tgbotapi.types.files.*
|
||||||
import dev.inmo.tgbotapi.types.files.abstracts.*
|
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.types.files
|
|||||||
|
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.files.abstracts.*
|
import dev.inmo.tgbotapi.types.files.*
|
||||||
import dev.inmo.tgbotapi.utils.MimeType
|
import dev.inmo.tgbotapi.utils.MimeType
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
package dev.inmo.tgbotapi.types.files.abstracts
|
|
||||||
|
|
||||||
internal const val fileNameField = "file_name"
|
|
||||||
|
|
||||||
interface CustomNamedMediaFile {
|
|
||||||
val fileName: String?
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
package dev.inmo.tgbotapi.types.files.abstracts
|
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.MimeTyped
|
|
||||||
|
|
||||||
internal const val mimeTypeField = "mime_type"
|
|
||||||
|
|
||||||
interface MimedMediaFile : TelegramMediaFile, MimeTyped
|
|
@ -0,0 +1,22 @@
|
|||||||
|
package dev.inmo.tgbotapi.types.files.abstracts
|
||||||
|
|
||||||
|
@Deprecated("Renamed", ReplaceWith("CustomNamedMediaFile", "dev.inmo.tgbotapi.types.files.CustomNamedMediaFile"))
|
||||||
|
typealias CustomNamedMediaFile = dev.inmo.tgbotapi.types.files.CustomNamedMediaFile
|
||||||
|
|
||||||
|
@Deprecated("Replaced", ReplaceWith("MimedMediaFile", "dev.inmo.tgbotapi.types.files.MimedMediaFile"))
|
||||||
|
typealias MimedMediaFile = dev.inmo.tgbotapi.types.files.MimedMediaFile
|
||||||
|
|
||||||
|
@Deprecated("Replaced", ReplaceWith("PlayableMediaFile", "dev.inmo.tgbotapi.types.files.PlayableMediaFile"))
|
||||||
|
typealias PlayableMediaFile = dev.inmo.tgbotapi.types.files.PlayableMediaFile
|
||||||
|
|
||||||
|
@Deprecated("Replaced", ReplaceWith("SizedMediaFile", "dev.inmo.tgbotapi.types.files.SizedMediaFile"))
|
||||||
|
typealias SizedMediaFile = dev.inmo.tgbotapi.types.files.SizedMediaFile
|
||||||
|
|
||||||
|
@Deprecated("Replaced", ReplaceWith("TelegramMediaFile", "dev.inmo.tgbotapi.types.files.TelegramMediaFile"))
|
||||||
|
typealias TelegramMediaFile = dev.inmo.tgbotapi.types.files.TelegramMediaFile
|
||||||
|
|
||||||
|
@Deprecated("Replaced", ReplaceWith("ThumbedMediaFile", "dev.inmo.tgbotapi.types.files.ThumbedMediaFile"))
|
||||||
|
typealias ThumbedMediaFile = dev.inmo.tgbotapi.types.files.ThumbedMediaFile
|
||||||
|
|
||||||
|
@Deprecated("Replaced", ReplaceWith("TitledMediaFile", "dev.inmo.tgbotapi.types.files.TitledMediaFile"))
|
||||||
|
typealias TitledMediaFile = dev.inmo.tgbotapi.types.files.TitledMediaFile
|
@ -1,5 +0,0 @@
|
|||||||
package dev.inmo.tgbotapi.types.files.abstracts
|
|
||||||
|
|
||||||
interface PlayableMediaFile : TelegramMediaFile {
|
|
||||||
val duration: Long?
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
package dev.inmo.tgbotapi.types.files.abstracts
|
|
||||||
|
|
||||||
interface SizedMediaFile : TelegramMediaFile {
|
|
||||||
val width: Int
|
|
||||||
val height: Int
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
package dev.inmo.tgbotapi.types.files.abstracts
|
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.files.PhotoSize
|
|
||||||
|
|
||||||
interface ThumbedMediaFile : TelegramMediaFile {
|
|
||||||
val thumb: PhotoSize?
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
package dev.inmo.tgbotapi.types.files.abstracts
|
|
||||||
|
|
||||||
interface TitledMediaFile {
|
|
||||||
val title: String?
|
|
||||||
}
|
|
@ -1,158 +1,19 @@
|
|||||||
package dev.inmo.tgbotapi.types.files.sticker
|
package dev.inmo.tgbotapi.types.files.sticker
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
@Deprecated("Replaced", ReplaceWith("StickerSurrogate", "dev.inmo.tgbotapi.types.files.StickerSurrogate"))
|
||||||
import dev.inmo.tgbotapi.types.*
|
typealias StickerSurrogate = dev.inmo.tgbotapi.types.files.StickerSurrogate
|
||||||
import dev.inmo.tgbotapi.types.files.PhotoSize
|
|
||||||
import dev.inmo.tgbotapi.types.files.abstracts.*
|
|
||||||
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
|
||||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
|
||||||
import kotlinx.serialization.*
|
|
||||||
import kotlinx.serialization.descriptors.SerialDescriptor
|
|
||||||
import kotlinx.serialization.encoding.Decoder
|
|
||||||
import kotlinx.serialization.encoding.Encoder
|
|
||||||
|
|
||||||
@Serializable
|
@Deprecated("Replaced", ReplaceWith("Sticker", "dev.inmo.tgbotapi.types.files.Sticker"))
|
||||||
@RiskFeature("This class is used for serialization/deserialization of Sticker interface")
|
typealias Sticker = dev.inmo.tgbotapi.types.files.Sticker
|
||||||
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
|
|
||||||
)
|
|
||||||
|
|
||||||
// TODO:: Serializer
|
@Deprecated("Replaced", ReplaceWith("StickerSerializer", "dev.inmo.tgbotapi.types.files.StickerSerializer"))
|
||||||
@Serializable(StickerSerializer::class)
|
typealias StickerSerializer = dev.inmo.tgbotapi.types.files.StickerSerializer
|
||||||
sealed interface Sticker : TelegramMediaFile, SizedMediaFile, ThumbedMediaFile {
|
|
||||||
val emoji: String?
|
|
||||||
val maskPosition: MaskPosition?
|
|
||||||
val stickerSetName: StickerSetName?
|
|
||||||
|
|
||||||
val isAnimated
|
@Deprecated("Replaced", ReplaceWith("SimpleSticker", "dev.inmo.tgbotapi.types.files.SimpleSticker"))
|
||||||
get() = this is AnimatedSticker
|
typealias SimpleSticker = dev.inmo.tgbotapi.types.files.SimpleSticker
|
||||||
val isVideo
|
|
||||||
get() = this is VideoSticker
|
|
||||||
|
|
||||||
companion object {
|
@Deprecated("Replaced", ReplaceWith("AnimatedSticker", "dev.inmo.tgbotapi.types.files.AnimatedSticker"))
|
||||||
fun serializer(): KSerializer<Sticker> = StickerSerializer
|
typealias AnimatedSticker = dev.inmo.tgbotapi.types.files.AnimatedSticker
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
object StickerSerializer : KSerializer<Sticker> {
|
@Deprecated("Replaced", ReplaceWith("VideoSticker", "dev.inmo.tgbotapi.types.files.VideoSticker"))
|
||||||
override val descriptor: SerialDescriptor = StickerSurrogate.serializer().descriptor
|
typealias VideoSticker = dev.inmo.tgbotapi.types.files.VideoSticker
|
||||||
|
|
||||||
override fun deserialize(decoder: Decoder): Sticker {
|
|
||||||
val surrogate = StickerSurrogate.serializer().deserialize(decoder)
|
|
||||||
|
|
||||||
return when {
|
|
||||||
surrogate.is_animated == true -> AnimatedSticker(
|
|
||||||
surrogate.file_id,
|
|
||||||
surrogate.file_unique_id,
|
|
||||||
surrogate.width,
|
|
||||||
surrogate.height,
|
|
||||||
surrogate.thumb,
|
|
||||||
surrogate.emoji,
|
|
||||||
surrogate.set_name,
|
|
||||||
surrogate.mask_position,
|
|
||||||
surrogate.file_size
|
|
||||||
)
|
|
||||||
surrogate.is_video == true -> VideoSticker(
|
|
||||||
surrogate.file_id,
|
|
||||||
surrogate.file_unique_id,
|
|
||||||
surrogate.width,
|
|
||||||
surrogate.height,
|
|
||||||
surrogate.thumb,
|
|
||||||
surrogate.emoji,
|
|
||||||
surrogate.set_name,
|
|
||||||
surrogate.mask_position,
|
|
||||||
surrogate.file_size
|
|
||||||
)
|
|
||||||
else -> SimpleSticker(
|
|
||||||
surrogate.file_id,
|
|
||||||
surrogate.file_unique_id,
|
|
||||||
surrogate.width,
|
|
||||||
surrogate.height,
|
|
||||||
surrogate.thumb,
|
|
||||||
surrogate.emoji,
|
|
||||||
surrogate.set_name,
|
|
||||||
surrogate.mask_position,
|
|
||||||
surrogate.file_size
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun serialize(encoder: Encoder, value: Sticker) {
|
|
||||||
TODO("Not yet implemented")
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Serializable
|
|
||||||
data class SimpleSticker(
|
|
||||||
@SerialName(fileIdField)
|
|
||||||
override val fileId: FileId,
|
|
||||||
@SerialName(fileUniqueIdField)
|
|
||||||
override val fileUniqueId: FileUniqueId,
|
|
||||||
@SerialName(widthField)
|
|
||||||
override val width: Int,
|
|
||||||
@SerialName(heightField)
|
|
||||||
override val height: Int,
|
|
||||||
@SerialName(thumbField)
|
|
||||||
override val thumb: PhotoSize? = null,
|
|
||||||
@SerialName(emojiField)
|
|
||||||
override val emoji: String? = null,
|
|
||||||
@SerialName(stickerSetNameField)
|
|
||||||
override val stickerSetName: StickerSetName? = null,
|
|
||||||
@SerialName(maskPositionField)
|
|
||||||
override val maskPosition: MaskPosition? = null,
|
|
||||||
@SerialName(fileSizeField)
|
|
||||||
override val fileSize: Long? = null,
|
|
||||||
) : Sticker
|
|
||||||
@Serializable
|
|
||||||
data class AnimatedSticker(
|
|
||||||
@SerialName(fileIdField)
|
|
||||||
override val fileId: FileId,
|
|
||||||
@SerialName(fileUniqueIdField)
|
|
||||||
override val fileUniqueId: FileUniqueId,
|
|
||||||
@SerialName(widthField)
|
|
||||||
override val width: Int,
|
|
||||||
@SerialName(heightField)
|
|
||||||
override val height: Int,
|
|
||||||
@SerialName(thumbField)
|
|
||||||
override val thumb: PhotoSize? = null,
|
|
||||||
@SerialName(emojiField)
|
|
||||||
override val emoji: String? = null,
|
|
||||||
@SerialName(stickerSetNameField)
|
|
||||||
override val stickerSetName: StickerSetName? = null,
|
|
||||||
@SerialName(maskPositionField)
|
|
||||||
override val maskPosition: MaskPosition? = null,
|
|
||||||
@SerialName(fileSizeField)
|
|
||||||
override val fileSize: Long? = null,
|
|
||||||
) : Sticker
|
|
||||||
@Serializable
|
|
||||||
data class VideoSticker(
|
|
||||||
@SerialName(fileIdField)
|
|
||||||
override val fileId: FileId,
|
|
||||||
@SerialName(fileUniqueIdField)
|
|
||||||
override val fileUniqueId: FileUniqueId,
|
|
||||||
@SerialName(widthField)
|
|
||||||
override val width: Int,
|
|
||||||
@SerialName(heightField)
|
|
||||||
override val height: Int,
|
|
||||||
@SerialName(thumbField)
|
|
||||||
override val thumb: PhotoSize? = null,
|
|
||||||
@SerialName(emojiField)
|
|
||||||
override val emoji: String? = null,
|
|
||||||
@SerialName(stickerSetNameField)
|
|
||||||
override val stickerSetName: StickerSetName? = null,
|
|
||||||
@SerialName(maskPositionField)
|
|
||||||
override val maskPosition: MaskPosition? = null,
|
|
||||||
@SerialName(fileSizeField)
|
|
||||||
override val fileSize: Long? = null,
|
|
||||||
) : Sticker
|
|
||||||
|
@ -7,7 +7,7 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
|||||||
import dev.inmo.tgbotapi.types.chat.abstracts.*
|
import dev.inmo.tgbotapi.types.chat.abstracts.*
|
||||||
import dev.inmo.tgbotapi.types.dice.Dice
|
import dev.inmo.tgbotapi.types.dice.Dice
|
||||||
import dev.inmo.tgbotapi.types.files.*
|
import dev.inmo.tgbotapi.types.files.*
|
||||||
import dev.inmo.tgbotapi.types.files.sticker.Sticker
|
import dev.inmo.tgbotapi.types.files.Sticker
|
||||||
import dev.inmo.tgbotapi.types.games.RawGame
|
import dev.inmo.tgbotapi.types.games.RawGame
|
||||||
import dev.inmo.tgbotapi.types.location.Location
|
import dev.inmo.tgbotapi.types.location.Location
|
||||||
import dev.inmo.tgbotapi.types.message.ChatEvents.*
|
import dev.inmo.tgbotapi.types.message.ChatEvents.*
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.types.message.content.abstracts
|
package dev.inmo.tgbotapi.types.message.content.abstracts
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.files.abstracts.TelegramMediaFile
|
import dev.inmo.tgbotapi.types.files.TelegramMediaFile
|
||||||
|
|
||||||
interface MediaCollectionContent<T: TelegramMediaFile>: MessageContent, MediaContent {
|
interface MediaCollectionContent<T: TelegramMediaFile>: MessageContent, MediaContent {
|
||||||
val mediaCollection: List<T>
|
val mediaCollection: List<T>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package dev.inmo.tgbotapi.types.message.content.abstracts
|
package dev.inmo.tgbotapi.types.message.content.abstracts
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.InputMedia.InputMedia
|
import dev.inmo.tgbotapi.types.InputMedia.InputMedia
|
||||||
import dev.inmo.tgbotapi.types.files.abstracts.TelegramMediaFile
|
import dev.inmo.tgbotapi.types.files.TelegramMediaFile
|
||||||
|
|
||||||
interface MediaContent: MessageContent {
|
interface MediaContent: MessageContent {
|
||||||
val media: TelegramMediaFile
|
val media: TelegramMediaFile
|
||||||
|
@ -6,7 +6,7 @@ import dev.inmo.tgbotapi.types.ChatIdentifier
|
|||||||
import dev.inmo.tgbotapi.types.InputMedia.InputMediaDocument
|
import dev.inmo.tgbotapi.types.InputMedia.InputMediaDocument
|
||||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
import dev.inmo.tgbotapi.types.MessageIdentifier
|
||||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.files.sticker.Sticker
|
import dev.inmo.tgbotapi.types.files.Sticker
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaContent
|
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaContent
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
@ -2,6 +2,7 @@ package dev.inmo.tgbotapi.types.passport.encrypted
|
|||||||
|
|
||||||
import dev.inmo.micro_utils.serialization.base64.Base64BytesToFromStringSerializer
|
import dev.inmo.micro_utils.serialization.base64.Base64BytesToFromStringSerializer
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.files.PassportFile
|
||||||
import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.*
|
import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.*
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
@ -2,6 +2,7 @@ package dev.inmo.tgbotapi.types.passport.encrypted
|
|||||||
|
|
||||||
import dev.inmo.micro_utils.serialization.base64.Base64BytesToFromStringSerializer
|
import dev.inmo.micro_utils.serialization.base64.Base64BytesToFromStringSerializer
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.files.PassportFile
|
||||||
import dev.inmo.tgbotapi.types.passport.credentials.EncryptedData
|
import dev.inmo.tgbotapi.types.passport.credentials.EncryptedData
|
||||||
import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.*
|
import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.*
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
|
@ -2,6 +2,7 @@ package dev.inmo.tgbotapi.types.passport.encrypted
|
|||||||
|
|
||||||
import dev.inmo.micro_utils.serialization.base64.Base64BytesToFromStringSerializer
|
import dev.inmo.micro_utils.serialization.base64.Base64BytesToFromStringSerializer
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.files.PassportFile
|
||||||
import dev.inmo.tgbotapi.types.passport.credentials.EncryptedData
|
import dev.inmo.tgbotapi.types.passport.credentials.EncryptedData
|
||||||
import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.*
|
import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.*
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
|
@ -1,23 +1,4 @@
|
|||||||
package dev.inmo.tgbotapi.types.passport.encrypted
|
package dev.inmo.tgbotapi.types.passport.encrypted
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
@Deprecated("Replaced", ReplaceWith("PassportFile", "dev.inmo.tgbotapi.types.files.PassportFile"))
|
||||||
import dev.inmo.tgbotapi.types.*
|
typealias PassportFile = dev.inmo.tgbotapi.types.files.PassportFile
|
||||||
import dev.inmo.tgbotapi.types.files.abstracts.*
|
|
||||||
import kotlinx.serialization.SerialName
|
|
||||||
import kotlinx.serialization.Serializable
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
@Serializable
|
|
||||||
data class PassportFile(
|
|
||||||
@SerialName(fileIdField)
|
|
||||||
override val fileId: FileId,
|
|
||||||
@SerialName(fileUniqueIdField)
|
|
||||||
override val fileUniqueId: FileUniqueId,
|
|
||||||
@SerialName(fileDateField)
|
|
||||||
val uploadingDate: TelegramDate,
|
|
||||||
@SerialName(fileSizeField)
|
|
||||||
override val fileSize: Long? = null
|
|
||||||
) : TelegramMediaFile
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package dev.inmo.tgbotapi.types.passport.encrypted.abstracts
|
package dev.inmo.tgbotapi.types.passport.encrypted.abstracts
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.passport.encrypted.EncryptedElementSerializer
|
import dev.inmo.tgbotapi.types.passport.encrypted.EncryptedElementSerializer
|
||||||
import dev.inmo.tgbotapi.types.passport.encrypted.PassportFile
|
import dev.inmo.tgbotapi.types.files.PassportFile
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
@Serializable(EncryptedElementSerializer::class)
|
@Serializable(EncryptedElementSerializer::class)
|
||||||
interface EncryptedPassportElementTranslatable : EncryptedPassportElement {
|
interface EncryptedPassportElementTranslatable : EncryptedPassportElement {
|
||||||
val translations: List<PassportFile>
|
val translations: List<PassportFile>
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package dev.inmo.tgbotapi.types.passport.encrypted.abstracts
|
package dev.inmo.tgbotapi.types.passport.encrypted.abstracts
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.passport.encrypted.EncryptedElementSerializer
|
import dev.inmo.tgbotapi.types.passport.encrypted.EncryptedElementSerializer
|
||||||
import dev.inmo.tgbotapi.types.passport.encrypted.PassportFile
|
import dev.inmo.tgbotapi.types.files.PassportFile
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
@Serializable(EncryptedElementSerializer::class)
|
@Serializable(EncryptedElementSerializer::class)
|
||||||
interface EncryptedPassportElementWithFilesCollection : EncryptedPassportElement {
|
interface EncryptedPassportElementWithFilesCollection : EncryptedPassportElement {
|
||||||
val files: List<PassportFile>
|
val files: List<PassportFile>
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package dev.inmo.tgbotapi.types.passport.encrypted.abstracts
|
package dev.inmo.tgbotapi.types.passport.encrypted.abstracts
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.passport.encrypted.EncryptedElementSerializer
|
import dev.inmo.tgbotapi.types.passport.encrypted.EncryptedElementSerializer
|
||||||
import dev.inmo.tgbotapi.types.passport.encrypted.PassportFile
|
import dev.inmo.tgbotapi.types.files.PassportFile
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
@Serializable(EncryptedElementSerializer::class)
|
@Serializable(EncryptedElementSerializer::class)
|
||||||
interface EncryptedPassportElementWithFrontSide : EncryptedPassportElement {
|
interface EncryptedPassportElementWithFrontSide : EncryptedPassportElement {
|
||||||
val frontSide: PassportFile?
|
val frontSide: PassportFile?
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package dev.inmo.tgbotapi.types.passport.encrypted.abstracts
|
package dev.inmo.tgbotapi.types.passport.encrypted.abstracts
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.passport.encrypted.EncryptedElementSerializer
|
import dev.inmo.tgbotapi.types.passport.encrypted.EncryptedElementSerializer
|
||||||
import dev.inmo.tgbotapi.types.passport.encrypted.PassportFile
|
import dev.inmo.tgbotapi.types.files.PassportFile
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
@Serializable(EncryptedElementSerializer::class)
|
@Serializable(EncryptedElementSerializer::class)
|
||||||
interface EncryptedPassportElementWithReverseSide : EncryptedPassportElement {
|
interface EncryptedPassportElementWithReverseSide : EncryptedPassportElement {
|
||||||
val reverseSide: PassportFile?
|
val reverseSide: PassportFile?
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package dev.inmo.tgbotapi.types.passport.encrypted.abstracts
|
package dev.inmo.tgbotapi.types.passport.encrypted.abstracts
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.passport.encrypted.EncryptedElementSerializer
|
import dev.inmo.tgbotapi.types.passport.encrypted.EncryptedElementSerializer
|
||||||
import dev.inmo.tgbotapi.types.passport.encrypted.PassportFile
|
import dev.inmo.tgbotapi.types.files.PassportFile
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
@Serializable(EncryptedElementSerializer::class)
|
@Serializable(EncryptedElementSerializer::class)
|
||||||
interface EncryptedPassportElementWithSelfie : EncryptedPassportElement {
|
interface EncryptedPassportElementWithSelfie : EncryptedPassportElement {
|
||||||
val selfie: PassportFile?
|
val selfie: PassportFile?
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.types.stickers
|
|||||||
|
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.files.PhotoSize
|
import dev.inmo.tgbotapi.types.files.PhotoSize
|
||||||
import dev.inmo.tgbotapi.types.files.sticker.Sticker
|
import dev.inmo.tgbotapi.types.files.Sticker
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ import dev.inmo.tgbotapi.bot.TelegramBot
|
|||||||
import dev.inmo.tgbotapi.requests.DownloadFile
|
import dev.inmo.tgbotapi.requests.DownloadFile
|
||||||
import dev.inmo.tgbotapi.requests.get.GetFile
|
import dev.inmo.tgbotapi.requests.get.GetFile
|
||||||
import dev.inmo.tgbotapi.types.passport.credentials.*
|
import dev.inmo.tgbotapi.types.passport.credentials.*
|
||||||
import dev.inmo.tgbotapi.types.passport.encrypted.PassportFile
|
import dev.inmo.tgbotapi.types.files.PassportFile
|
||||||
|
|
||||||
fun EndDataCredentials.decryptData(
|
fun EndDataCredentials.decryptData(
|
||||||
bytes: EncryptedData
|
bytes: EncryptedData
|
||||||
|
@ -30,9 +30,9 @@ import dev.inmo.tgbotapi.types.chat.abstracts.*
|
|||||||
import dev.inmo.tgbotapi.types.chat.abstracts.extended.*
|
import dev.inmo.tgbotapi.types.chat.abstracts.extended.*
|
||||||
import dev.inmo.tgbotapi.types.dice.*
|
import dev.inmo.tgbotapi.types.dice.*
|
||||||
import dev.inmo.tgbotapi.types.files.*
|
import dev.inmo.tgbotapi.types.files.*
|
||||||
import dev.inmo.tgbotapi.types.files.abstracts.*
|
import dev.inmo.tgbotapi.types.files.*
|
||||||
import dev.inmo.tgbotapi.types.files.sticker.*
|
import dev.inmo.tgbotapi.types.files.*
|
||||||
import dev.inmo.tgbotapi.types.files.sticker.Sticker
|
import dev.inmo.tgbotapi.types.files.Sticker
|
||||||
import dev.inmo.tgbotapi.types.location.*
|
import dev.inmo.tgbotapi.types.location.*
|
||||||
import dev.inmo.tgbotapi.types.message.*
|
import dev.inmo.tgbotapi.types.message.*
|
||||||
import dev.inmo.tgbotapi.types.message.ChatEvents.*
|
import dev.inmo.tgbotapi.types.message.ChatEvents.*
|
||||||
|
@ -8,7 +8,7 @@ import dev.inmo.tgbotapi.types.chat.abstracts.Chat
|
|||||||
import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
|
import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
|
||||||
import dev.inmo.tgbotapi.types.dice.Dice
|
import dev.inmo.tgbotapi.types.dice.Dice
|
||||||
import dev.inmo.tgbotapi.types.files.*
|
import dev.inmo.tgbotapi.types.files.*
|
||||||
import dev.inmo.tgbotapi.types.files.sticker.Sticker
|
import dev.inmo.tgbotapi.types.files.Sticker
|
||||||
import dev.inmo.tgbotapi.types.games.Game
|
import dev.inmo.tgbotapi.types.games.Game
|
||||||
import dev.inmo.tgbotapi.types.location.Location
|
import dev.inmo.tgbotapi.types.location.Location
|
||||||
import dev.inmo.tgbotapi.types.message.ChatEvents.*
|
import dev.inmo.tgbotapi.types.message.ChatEvents.*
|
||||||
|
@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.extensions.utils.extensions.raw
|
|||||||
|
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.files.sticker.*
|
import dev.inmo.tgbotapi.types.files.*
|
||||||
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
import dev.inmo.tgbotapi.types.stickers.MaskPosition
|
||||||
|
|
||||||
inline val Sticker.file_id: FileId
|
inline val Sticker.file_id: FileId
|
||||||
|
@ -5,7 +5,7 @@ import dev.inmo.tgbotapi.requests.DownloadFileStream
|
|||||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
import dev.inmo.tgbotapi.requests.get.GetFile
|
import dev.inmo.tgbotapi.requests.get.GetFile
|
||||||
import dev.inmo.tgbotapi.types.files.PathedFile
|
import dev.inmo.tgbotapi.types.files.PathedFile
|
||||||
import dev.inmo.tgbotapi.types.files.abstracts.TelegramMediaFile
|
import dev.inmo.tgbotapi.types.files.TelegramMediaFile
|
||||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaContent
|
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaContent
|
||||||
import dev.inmo.tgbotapi.utils.*
|
import dev.inmo.tgbotapi.utils.*
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user