1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2025-12-02 20:35:43 +00:00
This commit is contained in:
2025-02-15 09:49:18 +06:00
parent 80955eeb55
commit 5a696cdac0
7 changed files with 40 additions and 25 deletions

View File

@@ -1,10 +1,8 @@
package dev.inmo.tgbotapi.requests.send.abstracts
import dev.inmo.tgbotapi.requests.abstracts.FileId
import dev.inmo.tgbotapi.requests.abstracts.InputFile
interface CoveredSendMessageRequest<T: Any>: SendMessageRequest<T> {
/**
* Duration of media, usually in seconds
*/
val cover: String?
val cover: InputFile?
}

View File

@@ -53,7 +53,7 @@ fun SendVideo(
chatId = chatId,
video = video,
thumbnail = thumbnail ?.fileId,
cover = cover ?.fileId,
cover = cover,
startTimestamp = startTimestamp,
text = text,
parseMode = parseMode,
@@ -114,7 +114,7 @@ fun SendVideo(
chatId = chatId,
video = video,
thumbnail = thumbnail ?.fileId,
cover = cover ?.fileId,
cover = cover,
startTimestamp = startTimestamp,
text = entities.makeString(),
parseMode = null,
@@ -157,7 +157,7 @@ data class SendVideoData internal constructor(
@SerialName(thumbnailField)
override val thumbnail: String? = null,
@SerialName(coverField)
override val cover: String? = null,
override val cover: InputFile? = null,
@SerialName(startTimestampField)
override val startTimestamp: Seconds? = null,
@SerialName(captionField)

View File

@@ -42,13 +42,16 @@ inline fun VideoFile.toTelegramMediaVideo(
text: String? = null,
parseMode: ParseMode? = null,
spoilered: Boolean = false,
showCaptionAboveMedia: Boolean = false
showCaptionAboveMedia: Boolean = false,
startTimestamp: Seconds? = this.startTimestamp
) = TelegramMediaVideo(
file = fileId,
text = text,
parseMode = parseMode,
spoilered = spoilered,
showCaptionAboveMedia = showCaptionAboveMedia,
cover = cover ?.fileId,
startTimestamp = startTimestamp,
width = width,
height = height,
duration = duration,
@@ -59,12 +62,15 @@ inline fun VideoFile.toTelegramMediaVideo(
inline fun VideoFile.toTelegramMediaVideo(
textSources: TextSourcesList,
spoilered: Boolean = false,
showCaptionAboveMedia: Boolean = false
showCaptionAboveMedia: Boolean = false,
startTimestamp: Seconds? = this.startTimestamp
) = TelegramMediaVideo(
file = fileId,
entities = textSources,
spoilered = spoilered,
showCaptionAboveMedia = showCaptionAboveMedia,
cover = cover ?.fileId,
startTimestamp = startTimestamp,
width = width,
height = height,
duration = duration,
@@ -76,5 +82,7 @@ inline fun VideoFile.toTelegramPaidMediaVideo() = TelegramPaidMediaVideo(
width = width,
height = height,
duration = duration,
cover = cover ?.fileId,
startTimestamp = startTimestamp,
thumb = thumbnail ?.fileId
)

View File

@@ -22,6 +22,8 @@ fun TelegramMediaVideo(
parseMode: ParseMode? = null,
spoilered: Boolean = false,
showCaptionAboveMedia: Boolean = false,
cover: InputFile? = null,
startTimestamp: Seconds? = null,
width: Int? = null,
height: Int? = null,
duration: Long? = null,
@@ -33,6 +35,8 @@ fun TelegramMediaVideo(
rawEntities = null,
spoilered = spoilered,
showCaptionAboveMedia = showCaptionAboveMedia,
cover = cover,
startTimestamp = startTimestamp,
width = width,
height = height,
duration = duration,
@@ -44,6 +48,8 @@ fun TelegramMediaVideo(
entities: TextSourcesList,
spoilered: Boolean = false,
showCaptionAboveMedia: Boolean = false,
cover: InputFile? = null,
startTimestamp: Seconds? = null,
width: Int? = null,
height: Int? = null,
duration: Long? = null,
@@ -55,6 +61,8 @@ fun TelegramMediaVideo(
rawEntities = entities.toRawMessageEntities(),
spoilered = spoilered,
showCaptionAboveMedia = showCaptionAboveMedia,
cover = cover,
startTimestamp = startTimestamp,
width = width,
height = height,
duration = duration,

View File

@@ -59,6 +59,7 @@ data class VideoContent(
override fun asTelegramMedia(): TelegramMediaVideo = media.toTelegramMediaVideo(
textSources = textSources,
spoilered = spoilered,
showCaptionAboveMedia = showCaptionAboveMedia
showCaptionAboveMedia = showCaptionAboveMedia,
startTimestamp = media.startTimestamp,
)
}

View File

@@ -45,6 +45,6 @@ data class VideoNoteContent(
width = media.width,
height = media.height,
duration = media.duration,
thumb = media.thumbnail ?.fileId
thumb = media.thumbnail ?.fileId,
)
}