diff --git a/CHANGELOG.md b/CHANGELOG.md index ac4a12c738..9bb5fd249c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ * Now old uncommon `CaptionedMediaContent` and `CaptionedInputMedia` are replaced by almost the same interfaces `CaptionedInput` and `CaptionedOutput`. They are both implementing `Captioned` interface +* `AnimationContent` now is `CaptionedInput` ## 0.15.0 diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/RawMessage.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/RawMessage.kt index c8467d9e15..7ee48d369e 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/RawMessage.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/RawMessage.kt @@ -122,7 +122,12 @@ data class RawMessage( caption, adaptedCaptionEntities ) - animation != null -> AnimationContent(animation, document) + animation != null -> AnimationContent( + animation, + document, + caption, + adaptedCaptionEntities + ) sticker != null -> StickerContent(sticker) game != null -> GameContent(game) video_note != null -> VideoNoteContent(video_note) diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/AnimationContent.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/AnimationContent.kt index 5a43c7185b..c4934231fc 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/AnimationContent.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/AnimationContent.kt @@ -1,27 +1,34 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media +import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.CaptionedInput import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendAnimation import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier +import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.MessageEntity import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier +import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.HTMLParseMode import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.files.AnimationFile import com.github.insanusmokrassar.TelegramBotAPI.types.files.DocumentFile import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent +import com.github.insanusmokrassar.TelegramBotAPI.utils.toHtmlCaptions data class AnimationContent( override val media: AnimationFile, - val includedDocument: DocumentFile? -) : MediaContent { + val includedDocument: DocumentFile?, + override val caption: String?, + override val captionEntities: List +) : MediaContent, CaptionedInput { override fun createResend( chatId: ChatIdentifier, disableNotification: Boolean, replyToMessageId: MessageIdentifier?, replyMarkup: KeyboardMarkup? - ): Request = createResend(chatId, null, null, disableNotification, replyToMessageId, replyMarkup) + ): Request = createResend(chatId, toHtmlCaptions().firstOrNull(), HTMLParseMode, disableNotification, replyToMessageId, replyMarkup) + @Deprecated("Will be fully replaced by default method") fun createResend( chatId: ChatIdentifier, caption: String?, diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/DocumentContent.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/DocumentContent.kt index 4a6e363fc4..dba87ea226 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/DocumentContent.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/DocumentContent.kt @@ -10,7 +10,6 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.HTMLParseMode import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.files.DocumentFile import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage -import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.CaptionedMediaContent import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent import com.github.insanusmokrassar.TelegramBotAPI.utils.toHtmlCaptions