mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-06-18 07:45:27 +00:00
64 lines
2.1 KiB
Kotlin
64 lines
2.1 KiB
Kotlin
|
package dev.inmo.tgbotapi.types.message.content.media
|
||
|
|
||
|
import dev.inmo.tgbotapi.CommonAbstracts.TextPart
|
||
|
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||
|
import dev.inmo.tgbotapi.requests.send.media.SendVideo
|
||
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||
|
import dev.inmo.tgbotapi.types.InputMedia.InputMediaVideo
|
||
|
import dev.inmo.tgbotapi.types.InputMedia.MediaGroupMemberInputMedia
|
||
|
import dev.inmo.tgbotapi.types.MessageIdentifier
|
||
|
import dev.inmo.tgbotapi.types.ParseMode.HTMLParseMode
|
||
|
import dev.inmo.tgbotapi.types.ParseMode.MarkdownV2
|
||
|
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||
|
import dev.inmo.tgbotapi.types.files.VideoFile
|
||
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||
|
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaGroupContent
|
||
|
import dev.inmo.tgbotapi.utils.toHtmlCaptions
|
||
|
import dev.inmo.tgbotapi.utils.toMarkdownV2Captions
|
||
|
|
||
|
data class VideoContent(
|
||
|
override val media: VideoFile,
|
||
|
override val caption: String? = null,
|
||
|
override val captionEntities: List<TextPart> = emptyList()
|
||
|
) : MediaGroupContent {
|
||
|
override fun createResend(
|
||
|
chatId: ChatIdentifier,
|
||
|
disableNotification: Boolean,
|
||
|
replyToMessageId: MessageIdentifier?,
|
||
|
replyMarkup: KeyboardMarkup?
|
||
|
): Request<ContentMessage<VideoContent>> = SendVideo(
|
||
|
chatId,
|
||
|
media.fileId,
|
||
|
media.thumb ?.fileId,
|
||
|
toHtmlCaptions().firstOrNull(),
|
||
|
HTMLParseMode,
|
||
|
media.duration,
|
||
|
media.width,
|
||
|
media.height,
|
||
|
null,
|
||
|
disableNotification,
|
||
|
replyToMessageId,
|
||
|
replyMarkup
|
||
|
)
|
||
|
|
||
|
override fun toMediaGroupMemberInputMedia(): MediaGroupMemberInputMedia = InputMediaVideo(
|
||
|
media.fileId,
|
||
|
toHtmlCaptions().firstOrNull(),
|
||
|
HTMLParseMode,
|
||
|
media.width,
|
||
|
media.height,
|
||
|
media.duration,
|
||
|
media.thumb ?.fileId
|
||
|
)
|
||
|
|
||
|
override fun asInputMedia(): InputMediaVideo = InputMediaVideo(
|
||
|
media.fileId,
|
||
|
toMarkdownV2Captions().firstOrNull(),
|
||
|
MarkdownV2,
|
||
|
media.width,
|
||
|
media.height,
|
||
|
media.duration,
|
||
|
media.thumb ?.fileId
|
||
|
)
|
||
|
}
|