1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 16:23:48 +00:00

now AnimationContent have caption

This commit is contained in:
InsanusMokrassar 2019-06-28 18:58:35 +08:00
parent 1926a9141b
commit 0cfc7077c0
4 changed files with 17 additions and 5 deletions

View File

@ -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

View File

@ -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)

View File

@ -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<MessageEntity>
) : MediaContent, CaptionedInput {
override fun createResend(
chatId: ChatIdentifier,
disableNotification: Boolean,
replyToMessageId: MessageIdentifier?,
replyMarkup: KeyboardMarkup?
): Request<RawMessage> = createResend(chatId, null, null, disableNotification, replyToMessageId, replyMarkup)
): Request<RawMessage> = createResend(chatId, toHtmlCaptions().firstOrNull(), HTMLParseMode, disableNotification, replyToMessageId, replyMarkup)
@Deprecated("Will be fully replaced by default method")
fun createResend(
chatId: ChatIdentifier,
caption: String?,

View File

@ -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