diff --git a/CHANGELOG.md b/CHANGELOG.md index 05ef3ecbc8..e73e33d733 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,9 @@ ## 1.0.0 * `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 diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/files/DownloadFile.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/files/DownloadFile.kt index 6a69e6b15b..5d4b9c555a 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/files/DownloadFile.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/files/DownloadFile.kt @@ -5,7 +5,7 @@ import dev.inmo.tgbotapi.extensions.api.get.getFileAdditionalInfo import dev.inmo.tgbotapi.requests.DownloadFile import dev.inmo.tgbotapi.requests.abstracts.FileId 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 suspend fun TelegramBot.downloadFile( diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/files/DownloadFileStream.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/files/DownloadFileStream.kt index f2c35a6d95..25e4d1c727 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/files/DownloadFileStream.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/files/DownloadFileStream.kt @@ -4,7 +4,7 @@ import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.extensions.api.get.getFileAdditionalInfo import dev.inmo.tgbotapi.requests.abstracts.FileId 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 suspend fun TelegramBot.downloadFileStream( diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/files/DownloadFileStreamAllocator.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/files/DownloadFileStreamAllocator.kt index 8261d4c275..f9bec0baba 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/files/DownloadFileStreamAllocator.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/files/DownloadFileStreamAllocator.kt @@ -5,7 +5,7 @@ import dev.inmo.tgbotapi.extensions.api.get.getFileAdditionalInfo import dev.inmo.tgbotapi.requests.DownloadFileStream import dev.inmo.tgbotapi.requests.abstracts.FileId 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 suspend fun TelegramBot.downloadFileStreamAllocator( diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/get/GetFile.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/get/GetFile.kt index d3ce16dccc..eee28a2879 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/get/GetFile.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/get/GetFile.kt @@ -3,7 +3,7 @@ package dev.inmo.tgbotapi.extensions.api.get import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.requests.abstracts.FileId 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 suspend fun TelegramBot.getFileAdditionalInfo( diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/get/GetStickerSet.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/get/GetStickerSet.kt index 513f406e72..94400fa7a9 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/get/GetStickerSet.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/get/GetStickerSet.kt @@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.extensions.api.get import dev.inmo.tgbotapi.bot.TelegramBot 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( name: String diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/Replies.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/Replies.kt index 7f1e6278a4..89b9c61732 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/Replies.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/Replies.kt @@ -18,12 +18,11 @@ import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.chat.abstracts.Chat import dev.inmo.tgbotapi.types.dice.DiceAnimationType import dev.inmo.tgbotapi.types.files.* -import dev.inmo.tgbotapi.types.files.abstracts.TelegramMediaFile -import dev.inmo.tgbotapi.types.files.sticker.Sticker +import dev.inmo.tgbotapi.types.files.TelegramMediaFile +import dev.inmo.tgbotapi.types.files.Sticker import dev.inmo.tgbotapi.types.games.Game import dev.inmo.tgbotapi.types.location.* 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.media.* import dev.inmo.tgbotapi.types.payments.LabeledPrice diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendSticker.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendSticker.kt index 4381032e80..d236e11cf3 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendSticker.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendSticker.kt @@ -7,7 +7,7 @@ import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.MessageIdentifier import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup 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 diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/DeleteStickerFromSet.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/DeleteStickerFromSet.kt index a51fa3fdc4..29be658518 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/DeleteStickerFromSet.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/DeleteStickerFromSet.kt @@ -3,7 +3,7 @@ package dev.inmo.tgbotapi.extensions.api.stickers import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.requests.abstracts.FileId 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( sticker: FileId diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/SetStickerPositionInSet.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/SetStickerPositionInSet.kt index 3fa4da399c..affe3f2056 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/SetStickerPositionInSet.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/stickers/SetStickerPositionInSet.kt @@ -3,7 +3,7 @@ package dev.inmo.tgbotapi.extensions.api.stickers import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.requests.abstracts.FileId 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( sticker: FileId, diff --git a/tgbotapi.api/src/jvmMain/kotlin/dev/inmo/tgbotapi/extensions/api/files/DownloadFileToFile.kt b/tgbotapi.api/src/jvmMain/kotlin/dev/inmo/tgbotapi/extensions/api/files/DownloadFileToFile.kt index 0e12b4c855..20b76284bd 100644 --- a/tgbotapi.api/src/jvmMain/kotlin/dev/inmo/tgbotapi/extensions/api/files/DownloadFileToFile.kt +++ b/tgbotapi.api/src/jvmMain/kotlin/dev/inmo/tgbotapi/extensions/api/files/DownloadFileToFile.kt @@ -5,7 +5,7 @@ import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.extensions.api.get.getFileAdditionalInfo import dev.inmo.tgbotapi.requests.abstracts.FileId 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 io.ktor.util.cio.use import io.ktor.util.cio.writeChannel diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ContentTriggers.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ContentTriggers.kt index 4f51259fb4..0d722d8f5c 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ContentTriggers.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ContentTriggers.kt @@ -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.MarkerFactory 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.content.* import dev.inmo.tgbotapi.types.message.content.abstracts.* diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/EditedContentTriggers.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/EditedContentTriggers.kt index c1b617bbbd..9f57f0e464 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/EditedContentTriggers.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/EditedContentTriggers.kt @@ -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.utils.asEditMessageUpdate 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.content.* import dev.inmo.tgbotapi.types.message.content.abstracts.* diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/get/GetFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/get/GetFile.kt index 8388488113..97e74506f6 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/get/GetFile.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/get/GetFile.kt @@ -2,8 +2,8 @@ package dev.inmo.tgbotapi.requests.get import dev.inmo.tgbotapi.requests.abstracts.FileId 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.abstracts.fileIdField import kotlinx.serialization.* @Serializable diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt index 0f432f60a8..b9a6c6edf0 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt @@ -189,6 +189,13 @@ const val requestContactField = "request_contact" const val requestLocationField = "request_location" 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" diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultDocumentImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultDocumentImpl.kt index f5db3e5966..a28de5bd0f 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultDocumentImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultDocumentImpl.kt @@ -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.parseModeField 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.extensions.makeString import kotlinx.serialization.SerialName diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVideoImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVideoImpl.kt index c9304ef296..f299286c0a 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVideoImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVideoImpl.kt @@ -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.parseModeField 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.extensions.makeString import kotlinx.serialization.SerialName diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/AnimationFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/AnimationFile.kt index 9087f96d7b..7293d908cf 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/AnimationFile.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/AnimationFile.kt @@ -1,9 +1,8 @@ package dev.inmo.tgbotapi.types.files import dev.inmo.tgbotapi.requests.abstracts.FileId -import dev.inmo.tgbotapi.types.FileUniqueId -import dev.inmo.tgbotapi.types.fileUniqueIdField -import dev.inmo.tgbotapi.types.files.abstracts.* +import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.types.files.* import dev.inmo.tgbotapi.utils.MimeType import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/AudioFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/AudioFile.kt index 554b878069..ea624b1344 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/AudioFile.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/AudioFile.kt @@ -3,7 +3,6 @@ package dev.inmo.tgbotapi.types.files import dev.inmo.tgbotapi.CommonAbstracts.Performerable import dev.inmo.tgbotapi.requests.abstracts.FileId import dev.inmo.tgbotapi.types.* -import dev.inmo.tgbotapi.types.files.abstracts.* import dev.inmo.tgbotapi.utils.MimeType import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/CustomNamedMediaFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/CustomNamedMediaFile.kt new file mode 100644 index 0000000000..f5581cc156 --- /dev/null +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/CustomNamedMediaFile.kt @@ -0,0 +1,5 @@ +package dev.inmo.tgbotapi.types.files + +sealed interface CustomNamedMediaFile { + val fileName: String? +} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/DocumentFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/DocumentFile.kt index d869f4cb69..c477da4b4f 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/DocumentFile.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/DocumentFile.kt @@ -1,10 +1,8 @@ package dev.inmo.tgbotapi.types.files import dev.inmo.tgbotapi.requests.abstracts.FileId -import dev.inmo.tgbotapi.types.FileUniqueId -import dev.inmo.tgbotapi.types.fileUniqueIdField -import dev.inmo.tgbotapi.types.files.abstracts.* -import dev.inmo.tgbotapi.types.message.content.media.DocumentContent +import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.types.files.* import dev.inmo.tgbotapi.utils.MimeType import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/File.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/File.kt index bbfcfa8393..f94f9b8f2c 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/File.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/File.kt @@ -1,9 +1,8 @@ package dev.inmo.tgbotapi.types.files import dev.inmo.tgbotapi.requests.abstracts.FileId -import dev.inmo.tgbotapi.types.FileUniqueId -import dev.inmo.tgbotapi.types.fileUniqueIdField -import dev.inmo.tgbotapi.types.files.abstracts.* +import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.types.files.* import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/MimedMediaFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/MimedMediaFile.kt new file mode 100644 index 0000000000..53bc318f11 --- /dev/null +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/MimedMediaFile.kt @@ -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 diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/PassportFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/PassportFile.kt new file mode 100644 index 0000000000..73098d8b26 --- /dev/null +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/PassportFile.kt @@ -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 diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/PathedFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/PathedFile.kt index e1dd2ac001..2ceaf625e1 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/PathedFile.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/PathedFile.kt @@ -1,9 +1,7 @@ package dev.inmo.tgbotapi.types.files import dev.inmo.tgbotapi.requests.abstracts.FileId -import dev.inmo.tgbotapi.types.FileUniqueId -import dev.inmo.tgbotapi.types.fileUniqueIdField -import dev.inmo.tgbotapi.types.files.abstracts.* +import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.utils.* import kotlinx.serialization.* diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/PhotoSize.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/PhotoSize.kt index 78910be5b7..707eed7e2d 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/PhotoSize.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/PhotoSize.kt @@ -1,9 +1,8 @@ package dev.inmo.tgbotapi.types.files import dev.inmo.tgbotapi.requests.abstracts.FileId -import dev.inmo.tgbotapi.types.FileUniqueId -import dev.inmo.tgbotapi.types.fileUniqueIdField -import dev.inmo.tgbotapi.types.files.abstracts.* +import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.types.files.* import dev.inmo.tgbotapi.utils.RiskFeature import kotlinx.serialization.* import kotlinx.serialization.builtins.ListSerializer diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/PlayableMediaFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/PlayableMediaFile.kt new file mode 100644 index 0000000000..f4b5665469 --- /dev/null +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/PlayableMediaFile.kt @@ -0,0 +1,7 @@ +package dev.inmo.tgbotapi.types.files + +import dev.inmo.tgbotapi.types.files.TelegramMediaFile + +sealed interface PlayableMediaFile : TelegramMediaFile { + val duration: Long? +} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/SizedMediaFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/SizedMediaFile.kt new file mode 100644 index 0000000000..88f122885c --- /dev/null +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/SizedMediaFile.kt @@ -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 +} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/Sticker.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/Sticker.kt index 1027fba5c0..f8135965dc 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/Sticker.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/Sticker.kt @@ -1,6 +1,156 @@ 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")) -typealias Sticker = Sticker +@Serializable +@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 = StickerSerializer + } +} + +object StickerSerializer : KSerializer { + 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 diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/abstracts/TelegramMediaFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/TelegramMediaFile.kt similarity index 52% rename from tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/abstracts/TelegramMediaFile.kt rename to tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/TelegramMediaFile.kt index 149391a69c..b6e04f7e06 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/abstracts/TelegramMediaFile.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/TelegramMediaFile.kt @@ -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.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 */ -interface TelegramMediaFile { +sealed interface TelegramMediaFile { val fileId: FileId val fileUniqueId: FileUniqueId val fileSize: Long? diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/ThumbedMediaFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/ThumbedMediaFile.kt new file mode 100644 index 0000000000..b988901009 --- /dev/null +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/ThumbedMediaFile.kt @@ -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? +} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/TitledMediaFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/TitledMediaFile.kt new file mode 100644 index 0000000000..f92d95454d --- /dev/null +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/TitledMediaFile.kt @@ -0,0 +1,5 @@ +package dev.inmo.tgbotapi.types.files + +sealed interface TitledMediaFile { + val title: String? +} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/VideoFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/VideoFile.kt index bce88fc7b9..eb654d1851 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/VideoFile.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/VideoFile.kt @@ -5,7 +5,6 @@ import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.InputMedia.InputMediaVideo import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.ParseMode.ParseMode -import dev.inmo.tgbotapi.types.files.abstracts.* import dev.inmo.tgbotapi.utils.MimeType import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/VideoNoteFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/VideoNoteFile.kt index 528934392a..04b65e14fa 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/VideoNoteFile.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/VideoNoteFile.kt @@ -1,9 +1,8 @@ package dev.inmo.tgbotapi.types.files import dev.inmo.tgbotapi.requests.abstracts.FileId -import dev.inmo.tgbotapi.types.FileUniqueId -import dev.inmo.tgbotapi.types.fileUniqueIdField -import dev.inmo.tgbotapi.types.files.abstracts.* +import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.types.files.* import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/VoiceFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/VoiceFile.kt index 41be71b854..f3a88b1e66 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/VoiceFile.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/VoiceFile.kt @@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.types.files import dev.inmo.tgbotapi.requests.abstracts.FileId 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 kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/abstracts/CustomNamedMediaFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/abstracts/CustomNamedMediaFile.kt deleted file mode 100644 index e81488bb43..0000000000 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/abstracts/CustomNamedMediaFile.kt +++ /dev/null @@ -1,7 +0,0 @@ -package dev.inmo.tgbotapi.types.files.abstracts - -internal const val fileNameField = "file_name" - -interface CustomNamedMediaFile { - val fileName: String? -} \ No newline at end of file diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/abstracts/MimedMediaFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/abstracts/MimedMediaFile.kt deleted file mode 100644 index 72eaab3c7a..0000000000 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/abstracts/MimedMediaFile.kt +++ /dev/null @@ -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 \ No newline at end of file diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/abstracts/OldTypealiases.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/abstracts/OldTypealiases.kt new file mode 100644 index 0000000000..3b5864dfec --- /dev/null +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/abstracts/OldTypealiases.kt @@ -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 diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/abstracts/PlayableMediaFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/abstracts/PlayableMediaFile.kt deleted file mode 100644 index 3211617a56..0000000000 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/abstracts/PlayableMediaFile.kt +++ /dev/null @@ -1,5 +0,0 @@ -package dev.inmo.tgbotapi.types.files.abstracts - -interface PlayableMediaFile : TelegramMediaFile { - val duration: Long? -} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/abstracts/SizedMediaFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/abstracts/SizedMediaFile.kt deleted file mode 100644 index 6aefe5b969..0000000000 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/abstracts/SizedMediaFile.kt +++ /dev/null @@ -1,6 +0,0 @@ -package dev.inmo.tgbotapi.types.files.abstracts - -interface SizedMediaFile : TelegramMediaFile { - val width: Int - val height: Int -} \ No newline at end of file diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/abstracts/ThumbedMediaFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/abstracts/ThumbedMediaFile.kt deleted file mode 100644 index 95859cdd60..0000000000 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/abstracts/ThumbedMediaFile.kt +++ /dev/null @@ -1,7 +0,0 @@ -package dev.inmo.tgbotapi.types.files.abstracts - -import dev.inmo.tgbotapi.types.files.PhotoSize - -interface ThumbedMediaFile : TelegramMediaFile { - val thumb: PhotoSize? -} \ No newline at end of file diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/abstracts/TitledMediaFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/abstracts/TitledMediaFile.kt deleted file mode 100644 index cda38a0e84..0000000000 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/abstracts/TitledMediaFile.kt +++ /dev/null @@ -1,5 +0,0 @@ -package dev.inmo.tgbotapi.types.files.abstracts - -interface TitledMediaFile { - val title: String? -} \ No newline at end of file diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/sticker/Sticker.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/sticker/Sticker.kt index 76482afecf..c0da51eba1 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/sticker/Sticker.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/sticker/Sticker.kt @@ -1,158 +1,19 @@ package dev.inmo.tgbotapi.types.files.sticker -import dev.inmo.tgbotapi.requests.abstracts.FileId -import dev.inmo.tgbotapi.types.* -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 +@Deprecated("Replaced", ReplaceWith("StickerSurrogate", "dev.inmo.tgbotapi.types.files.StickerSurrogate")) +typealias StickerSurrogate = dev.inmo.tgbotapi.types.files.StickerSurrogate -@Serializable -@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 -) +@Deprecated("Replaced", ReplaceWith("Sticker", "dev.inmo.tgbotapi.types.files.Sticker")) +typealias Sticker = dev.inmo.tgbotapi.types.files.Sticker -// TODO:: Serializer -@Serializable(StickerSerializer::class) -sealed interface Sticker : TelegramMediaFile, SizedMediaFile, ThumbedMediaFile { - val emoji: String? - val maskPosition: MaskPosition? - val stickerSetName: StickerSetName? +@Deprecated("Replaced", ReplaceWith("StickerSerializer", "dev.inmo.tgbotapi.types.files.StickerSerializer")) +typealias StickerSerializer = dev.inmo.tgbotapi.types.files.StickerSerializer - val isAnimated - get() = this is AnimatedSticker - val isVideo - get() = this is VideoSticker +@Deprecated("Replaced", ReplaceWith("SimpleSticker", "dev.inmo.tgbotapi.types.files.SimpleSticker")) +typealias SimpleSticker = dev.inmo.tgbotapi.types.files.SimpleSticker - companion object { - fun serializer(): KSerializer = StickerSerializer - } -} +@Deprecated("Replaced", ReplaceWith("AnimatedSticker", "dev.inmo.tgbotapi.types.files.AnimatedSticker")) +typealias AnimatedSticker = dev.inmo.tgbotapi.types.files.AnimatedSticker -object StickerSerializer : KSerializer { - 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 +@Deprecated("Replaced", ReplaceWith("VideoSticker", "dev.inmo.tgbotapi.types.files.VideoSticker")) +typealias VideoSticker = dev.inmo.tgbotapi.types.files.VideoSticker diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/RawMessage.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/RawMessage.kt index 4022e0ddae..f48235fec9 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/RawMessage.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/RawMessage.kt @@ -7,7 +7,7 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import dev.inmo.tgbotapi.types.chat.abstracts.* import dev.inmo.tgbotapi.types.dice.Dice 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.location.Location import dev.inmo.tgbotapi.types.message.ChatEvents.* diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/abstracts/MediaCollectionContent.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/abstracts/MediaCollectionContent.kt index a13d66600d..690234bee4 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/abstracts/MediaCollectionContent.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/abstracts/MediaCollectionContent.kt @@ -1,6 +1,6 @@ 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: MessageContent, MediaContent { val mediaCollection: List diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/abstracts/MediaContent.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/abstracts/MediaContent.kt index 41f8323614..219893ebcb 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/abstracts/MediaContent.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/abstracts/MediaContent.kt @@ -1,7 +1,7 @@ package dev.inmo.tgbotapi.types.message.content.abstracts 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 { val media: TelegramMediaFile diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/media/StickerContent.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/media/StickerContent.kt index 3dc2d9978d..16a81b62ad 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/media/StickerContent.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/media/StickerContent.kt @@ -6,7 +6,7 @@ import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.InputMedia.InputMediaDocument import dev.inmo.tgbotapi.types.MessageIdentifier 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.content.abstracts.MediaContent import kotlinx.serialization.Serializable diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/EncryptedPassportElementWithTranslatableFilesCollection.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/EncryptedPassportElementWithTranslatableFilesCollection.kt index 00ecd47924..689e899964 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/EncryptedPassportElementWithTranslatableFilesCollection.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/EncryptedPassportElementWithTranslatableFilesCollection.kt @@ -2,6 +2,7 @@ package dev.inmo.tgbotapi.types.passport.encrypted import dev.inmo.micro_utils.serialization.base64.Base64BytesToFromStringSerializer import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.types.files.PassportFile import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.* import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/EncryptedPassportElementWithTranslatableIDDocument.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/EncryptedPassportElementWithTranslatableIDDocument.kt index 02d587e8bc..54bccbffd5 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/EncryptedPassportElementWithTranslatableIDDocument.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/EncryptedPassportElementWithTranslatableIDDocument.kt @@ -2,6 +2,7 @@ package dev.inmo.tgbotapi.types.passport.encrypted import dev.inmo.micro_utils.serialization.base64.Base64BytesToFromStringSerializer 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.encrypted.abstracts.* import kotlinx.serialization.SerialName diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/Passport.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/Passport.kt index e79bcb017c..272677f6fb 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/Passport.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/Passport.kt @@ -2,6 +2,7 @@ package dev.inmo.tgbotapi.types.passport.encrypted import dev.inmo.micro_utils.serialization.base64.Base64BytesToFromStringSerializer 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.encrypted.abstracts.* import kotlinx.serialization.SerialName diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/PassportFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/PassportFile.kt index 675105120b..c780c64243 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/PassportFile.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/PassportFile.kt @@ -1,23 +1,4 @@ package dev.inmo.tgbotapi.types.passport.encrypted -import dev.inmo.tgbotapi.requests.abstracts.FileId -import dev.inmo.tgbotapi.types.* -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 +@Deprecated("Replaced", ReplaceWith("PassportFile", "dev.inmo.tgbotapi.types.files.PassportFile")) +typealias PassportFile = dev.inmo.tgbotapi.types.files.PassportFile diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementTranslatable.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementTranslatable.kt index 32c3a2af89..a23954991d 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementTranslatable.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementTranslatable.kt @@ -1,10 +1,10 @@ package dev.inmo.tgbotapi.types.passport.encrypted.abstracts 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 @Serializable(EncryptedElementSerializer::class) interface EncryptedPassportElementTranslatable : EncryptedPassportElement { val translations: List -} \ No newline at end of file +} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithFilesCollection.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithFilesCollection.kt index e9edc842e5..feb70221e7 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithFilesCollection.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithFilesCollection.kt @@ -1,10 +1,10 @@ package dev.inmo.tgbotapi.types.passport.encrypted.abstracts 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 @Serializable(EncryptedElementSerializer::class) interface EncryptedPassportElementWithFilesCollection : EncryptedPassportElement { val files: List -} \ No newline at end of file +} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithFrontSide.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithFrontSide.kt index dbce257cd9..05df670ad9 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithFrontSide.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithFrontSide.kt @@ -1,10 +1,10 @@ package dev.inmo.tgbotapi.types.passport.encrypted.abstracts 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 @Serializable(EncryptedElementSerializer::class) interface EncryptedPassportElementWithFrontSide : EncryptedPassportElement { val frontSide: PassportFile? -} \ No newline at end of file +} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithReverseSide.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithReverseSide.kt index 24bf4f1874..55095522cd 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithReverseSide.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithReverseSide.kt @@ -1,10 +1,10 @@ package dev.inmo.tgbotapi.types.passport.encrypted.abstracts 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 @Serializable(EncryptedElementSerializer::class) interface EncryptedPassportElementWithReverseSide : EncryptedPassportElement { val reverseSide: PassportFile? -} \ No newline at end of file +} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithSelfie.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithSelfie.kt index d36de7e9cc..6601a01eac 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithSelfie.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithSelfie.kt @@ -1,10 +1,10 @@ package dev.inmo.tgbotapi.types.passport.encrypted.abstracts 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 @Serializable(EncryptedElementSerializer::class) interface EncryptedPassportElementWithSelfie : EncryptedPassportElement { val selfie: PassportFile? -} \ No newline at end of file +} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/stickers/StickerSet.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/stickers/StickerSet.kt index 88d3f551d0..84e13732bb 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/stickers/StickerSet.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/stickers/StickerSet.kt @@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.types.stickers import dev.inmo.tgbotapi.types.* 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.Serializable diff --git a/tgbotapi.core/src/jvmMain/kotlin/dev/inmo/tgbotapi/utils/passport/ElementDecryptingWithSecureData.kt b/tgbotapi.core/src/jvmMain/kotlin/dev/inmo/tgbotapi/utils/passport/ElementDecryptingWithSecureData.kt index e184139b0d..e10dd18ab8 100644 --- a/tgbotapi.core/src/jvmMain/kotlin/dev/inmo/tgbotapi/utils/passport/ElementDecryptingWithSecureData.kt +++ b/tgbotapi.core/src/jvmMain/kotlin/dev/inmo/tgbotapi/utils/passport/ElementDecryptingWithSecureData.kt @@ -5,7 +5,7 @@ import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.requests.DownloadFile import dev.inmo.tgbotapi.requests.get.GetFile 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( bytes: EncryptedData diff --git a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/ClassCasts.kt b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/ClassCasts.kt index d505b89d6e..6cd5a943f4 100644 --- a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/ClassCasts.kt +++ b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/ClassCasts.kt @@ -30,9 +30,9 @@ import dev.inmo.tgbotapi.types.chat.abstracts.* 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.files.* +import dev.inmo.tgbotapi.types.files.* +import dev.inmo.tgbotapi.types.files.Sticker import dev.inmo.tgbotapi.types.location.* import dev.inmo.tgbotapi.types.message.* import dev.inmo.tgbotapi.types.message.ChatEvents.* diff --git a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/raw/Message.kt b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/raw/Message.kt index 70cce93332..e54383169d 100644 --- a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/raw/Message.kt +++ b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/raw/Message.kt @@ -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.dice.Dice 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.location.Location import dev.inmo.tgbotapi.types.message.ChatEvents.* diff --git a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/raw/Sticker.kt b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/raw/Sticker.kt index 9de78af393..4a399695be 100644 --- a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/raw/Sticker.kt +++ b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/raw/Sticker.kt @@ -2,7 +2,7 @@ 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.files.* import dev.inmo.tgbotapi.types.stickers.MaskPosition inline val Sticker.file_id: FileId diff --git a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/types/files/ContentAsStorageFile.kt b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/types/files/ContentAsStorageFile.kt index 53b192e74e..59e2978f90 100644 --- a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/types/files/ContentAsStorageFile.kt +++ b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/types/files/ContentAsStorageFile.kt @@ -5,7 +5,7 @@ import dev.inmo.tgbotapi.requests.DownloadFileStream import dev.inmo.tgbotapi.requests.abstracts.FileId import dev.inmo.tgbotapi.requests.get.GetFile 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.utils.*