mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-26 12:08:43 +00:00
update content resends and different other things
This commit is contained in:
parent
2a89c41a58
commit
8d27349868
@ -74,3 +74,15 @@ fun AudioFile.toInputMediaAudio(
|
|||||||
title,
|
title,
|
||||||
thumb ?.fileId
|
thumb ?.fileId
|
||||||
)
|
)
|
||||||
|
|
||||||
|
fun AudioFile.toInputMediaAudio(
|
||||||
|
textSources: TextSourcesList = emptyList(),
|
||||||
|
title: String? = this.title
|
||||||
|
): InputMediaAudio = InputMediaAudio(
|
||||||
|
fileId,
|
||||||
|
textSources,
|
||||||
|
duration,
|
||||||
|
performer,
|
||||||
|
title,
|
||||||
|
thumb ?.fileId
|
||||||
|
)
|
||||||
|
@ -70,3 +70,11 @@ fun DocumentFile.toInputMediaDocument(
|
|||||||
parseMode,
|
parseMode,
|
||||||
thumb ?.fileId
|
thumb ?.fileId
|
||||||
)
|
)
|
||||||
|
|
||||||
|
fun DocumentFile.toInputMediaDocument(
|
||||||
|
textSources: TextSourcesList = emptyList()
|
||||||
|
) = InputMediaDocument(
|
||||||
|
fileId,
|
||||||
|
textSources,
|
||||||
|
thumb ?.fileId
|
||||||
|
)
|
||||||
|
@ -53,3 +53,10 @@ fun PhotoSize.toInputMediaPhoto(
|
|||||||
caption,
|
caption,
|
||||||
parseMode
|
parseMode
|
||||||
)
|
)
|
||||||
|
|
||||||
|
fun PhotoSize.toInputMediaPhoto(
|
||||||
|
textSources: TextSourcesList = emptyList()
|
||||||
|
): InputMediaPhoto = InputMediaPhoto(
|
||||||
|
fileId,
|
||||||
|
textSources
|
||||||
|
)
|
||||||
|
@ -39,8 +39,9 @@ typealias HTML = HTMLParseMode
|
|||||||
internal object ParseModeSerializerObject : KSerializer<ParseMode> {
|
internal object ParseModeSerializerObject : KSerializer<ParseMode> {
|
||||||
override fun deserialize(decoder: Decoder): ParseMode {
|
override fun deserialize(decoder: Decoder): ParseMode {
|
||||||
return when (decoder.decodeString()) {
|
return when (decoder.decodeString()) {
|
||||||
MarkdownParseMode.parseModeName -> MarkdownParseMode
|
Markdown.parseModeName -> Markdown
|
||||||
HTMLParseMode.parseModeName -> HTMLParseMode
|
MarkdownV2.parseModeName -> MarkdownV2
|
||||||
|
HTML.parseModeName -> HTML
|
||||||
else -> throw IllegalArgumentException("Unknown parse mode")
|
else -> throw IllegalArgumentException("Unknown parse mode")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.types.files
|
package dev.inmo.tgbotapi.types.files
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.TextSourcesList
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.InputMedia.InputMediaVideo
|
import dev.inmo.tgbotapi.types.InputMedia.InputMediaVideo
|
||||||
@ -44,3 +45,15 @@ inline fun VideoFile.toInputMediaVideo(
|
|||||||
duration,
|
duration,
|
||||||
thumb ?.fileId
|
thumb ?.fileId
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
|
inline fun VideoFile.toInputMediaVideo(
|
||||||
|
textSources: TextSourcesList
|
||||||
|
) = InputMediaVideo(
|
||||||
|
fileId,
|
||||||
|
textSources,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
duration,
|
||||||
|
thumb ?.fileId
|
||||||
|
)
|
||||||
|
@ -1,16 +1,15 @@
|
|||||||
package dev.inmo.tgbotapi.types.message.content
|
package dev.inmo.tgbotapi.types.message.content
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.TextPart
|
import dev.inmo.tgbotapi.CommonAbstracts.*
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.TextedInput
|
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.Request
|
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||||
import dev.inmo.tgbotapi.requests.send.SendTextMessage
|
import dev.inmo.tgbotapi.requests.send.SendTextMessage
|
||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
import dev.inmo.tgbotapi.types.MessageIdentifier
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.*
|
import dev.inmo.tgbotapi.types.ParseMode.HTMLParseMode
|
||||||
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
|
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
|
||||||
import dev.inmo.tgbotapi.utils.internal.*
|
|
||||||
|
|
||||||
data class TextContent(
|
data class TextContent(
|
||||||
override val text: String,
|
override val text: String,
|
||||||
@ -24,8 +23,7 @@ data class TextContent(
|
|||||||
replyMarkup: KeyboardMarkup?
|
replyMarkup: KeyboardMarkup?
|
||||||
): Request<ContentMessage<TextContent>> = SendTextMessage(
|
): Request<ContentMessage<TextContent>> = SendTextMessage(
|
||||||
chatId,
|
chatId,
|
||||||
toHtmlTexts().first(),
|
textSources,
|
||||||
HTMLParseMode,
|
|
||||||
false,
|
false,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
@ -48,6 +46,10 @@ data class TextContent(
|
|||||||
HTMLParseMode
|
HTMLParseMode
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Deprecated(
|
||||||
|
"Useless due to fact that createResend currently use textSource and that will guarantee correct sending of message",
|
||||||
|
ReplaceWith("createResend")
|
||||||
|
)
|
||||||
fun createResends(
|
fun createResends(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
disableNotification: Boolean,
|
disableNotification: Boolean,
|
||||||
@ -55,20 +57,7 @@ data class TextContent(
|
|||||||
allowSendingWithoutReply: Boolean?,
|
allowSendingWithoutReply: Boolean?,
|
||||||
replyMarkup: KeyboardMarkup?,
|
replyMarkup: KeyboardMarkup?,
|
||||||
parseMode: ParseMode = HTMLParseMode
|
parseMode: ParseMode = HTMLParseMode
|
||||||
): List<Request<ContentMessage<TextContent>>> = when (parseMode) {
|
): List<Request<ContentMessage<TextContent>>> = listOf(
|
||||||
is MarkdownParseMode -> toMarkdownTexts()
|
createResend(chatId, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
is MarkdownV2ParseMode -> toMarkdownV2Texts()
|
)
|
||||||
is HTMLParseMode -> toHtmlTexts()
|
|
||||||
}.map {
|
|
||||||
SendTextMessage(
|
|
||||||
chatId,
|
|
||||||
it,
|
|
||||||
parseMode,
|
|
||||||
false,
|
|
||||||
disableNotification,
|
|
||||||
replyToMessageId,
|
|
||||||
allowSendingWithoutReply,
|
|
||||||
replyMarkup
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,16 @@
|
|||||||
package dev.inmo.tgbotapi.types.message.content.media
|
package dev.inmo.tgbotapi.types.message.content.media
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.CaptionedInput
|
import dev.inmo.tgbotapi.CommonAbstracts.*
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.TextPart
|
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.Request
|
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||||
import dev.inmo.tgbotapi.requests.send.media.SendAnimation
|
import dev.inmo.tgbotapi.requests.send.media.SendAnimation
|
||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.InputMedia.InputMediaAnimation
|
import dev.inmo.tgbotapi.types.InputMedia.InputMediaAnimation
|
||||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
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.buttons.KeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.files.AnimationFile
|
import dev.inmo.tgbotapi.types.files.AnimationFile
|
||||||
import dev.inmo.tgbotapi.types.files.DocumentFile
|
import dev.inmo.tgbotapi.types.files.DocumentFile
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaContent
|
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaContent
|
||||||
import dev.inmo.tgbotapi.utils.internal.toHtmlCaptions
|
|
||||||
import dev.inmo.tgbotapi.utils.internal.toMarkdownV2Captions
|
|
||||||
|
|
||||||
data class AnimationContent(
|
data class AnimationContent(
|
||||||
override val media: AnimationFile,
|
override val media: AnimationFile,
|
||||||
@ -33,8 +28,7 @@ data class AnimationContent(
|
|||||||
chatId,
|
chatId,
|
||||||
media.fileId,
|
media.fileId,
|
||||||
media.thumb ?.fileId,
|
media.thumb ?.fileId,
|
||||||
toHtmlCaptions().firstOrNull(),
|
textSources,
|
||||||
HTMLParseMode,
|
|
||||||
media.duration,
|
media.duration,
|
||||||
media.width,
|
media.width,
|
||||||
media.height,
|
media.height,
|
||||||
@ -46,8 +40,7 @@ data class AnimationContent(
|
|||||||
|
|
||||||
override fun asInputMedia(): InputMediaAnimation = InputMediaAnimation(
|
override fun asInputMedia(): InputMediaAnimation = InputMediaAnimation(
|
||||||
media.fileId,
|
media.fileId,
|
||||||
toMarkdownV2Captions().firstOrNull(),
|
textSources,
|
||||||
MarkdownV2,
|
|
||||||
media.width,
|
media.width,
|
||||||
media.height,
|
media.height,
|
||||||
media.duration,
|
media.duration,
|
||||||
|
@ -1,18 +1,17 @@
|
|||||||
package dev.inmo.tgbotapi.types.message.content.media
|
package dev.inmo.tgbotapi.types.message.content.media
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.TextPart
|
import dev.inmo.tgbotapi.CommonAbstracts.TextPart
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.textSources
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.Request
|
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||||
import dev.inmo.tgbotapi.requests.send.media.SendAudio
|
import dev.inmo.tgbotapi.requests.send.media.SendAudio
|
||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.InputMedia.InputMediaAudio
|
import dev.inmo.tgbotapi.types.InputMedia.InputMediaAudio
|
||||||
import dev.inmo.tgbotapi.types.InputMedia.toInputMediaAudio
|
import dev.inmo.tgbotapi.types.InputMedia.toInputMediaAudio
|
||||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
import dev.inmo.tgbotapi.types.MessageIdentifier
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.HTMLParseMode
|
|
||||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.files.AudioFile
|
import dev.inmo.tgbotapi.types.files.AudioFile
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.content.abstracts.AudioMediaGroupContent
|
import dev.inmo.tgbotapi.types.message.content.abstracts.AudioMediaGroupContent
|
||||||
import dev.inmo.tgbotapi.utils.internal.toHtmlCaptions
|
|
||||||
|
|
||||||
data class AudioContent(
|
data class AudioContent(
|
||||||
override val media: AudioFile,
|
override val media: AudioFile,
|
||||||
@ -29,8 +28,7 @@ data class AudioContent(
|
|||||||
chatId,
|
chatId,
|
||||||
media.fileId,
|
media.fileId,
|
||||||
media.thumb ?.fileId,
|
media.thumb ?.fileId,
|
||||||
toHtmlCaptions().firstOrNull(),
|
textSources,
|
||||||
HTMLParseMode,
|
|
||||||
media.duration,
|
media.duration,
|
||||||
media.performer,
|
media.performer,
|
||||||
media.title,
|
media.title,
|
||||||
@ -42,8 +40,5 @@ data class AudioContent(
|
|||||||
|
|
||||||
override fun toMediaGroupMemberInputMedia(): InputMediaAudio = asInputMedia()
|
override fun toMediaGroupMemberInputMedia(): InputMediaAudio = asInputMedia()
|
||||||
|
|
||||||
override fun asInputMedia(): InputMediaAudio = media.toInputMediaAudio(
|
override fun asInputMedia(): InputMediaAudio = media.toInputMediaAudio(textSources)
|
||||||
toHtmlCaptions().firstOrNull(),
|
|
||||||
HTMLParseMode
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,18 @@
|
|||||||
package dev.inmo.tgbotapi.types.message.content.media
|
package dev.inmo.tgbotapi.types.message.content.media
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.CaptionedInput
|
import dev.inmo.tgbotapi.CommonAbstracts.*
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.TextPart
|
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.Request
|
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||||
import dev.inmo.tgbotapi.requests.send.media.SendDocument
|
import dev.inmo.tgbotapi.requests.send.media.SendDocument
|
||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.InputMedia.InputMediaDocument
|
import dev.inmo.tgbotapi.types.InputMedia.InputMediaDocument
|
||||||
import dev.inmo.tgbotapi.types.InputMedia.toInputMediaDocument
|
import dev.inmo.tgbotapi.types.InputMedia.toInputMediaDocument
|
||||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
import dev.inmo.tgbotapi.types.MessageIdentifier
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.HTMLParseMode
|
|
||||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.files.DocumentFile
|
import dev.inmo.tgbotapi.types.files.DocumentFile
|
||||||
import dev.inmo.tgbotapi.types.files.asDocumentFile
|
import dev.inmo.tgbotapi.types.files.asDocumentFile
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.content.abstracts.DocumentMediaGroupContent
|
import dev.inmo.tgbotapi.types.message.content.abstracts.DocumentMediaGroupContent
|
||||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaContent
|
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaContent
|
||||||
import dev.inmo.tgbotapi.utils.internal.toHtmlCaptions
|
|
||||||
|
|
||||||
data class DocumentContent(
|
data class DocumentContent(
|
||||||
override val media: DocumentFile,
|
override val media: DocumentFile,
|
||||||
@ -32,8 +29,7 @@ data class DocumentContent(
|
|||||||
chatId,
|
chatId,
|
||||||
media.fileId,
|
media.fileId,
|
||||||
media.thumb ?.fileId,
|
media.thumb ?.fileId,
|
||||||
toHtmlCaptions().firstOrNull(),
|
textSources,
|
||||||
HTMLParseMode,
|
|
||||||
disableNotification,
|
disableNotification,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
@ -42,10 +38,7 @@ data class DocumentContent(
|
|||||||
|
|
||||||
override fun toMediaGroupMemberInputMedia(): InputMediaDocument = asInputMedia()
|
override fun toMediaGroupMemberInputMedia(): InputMediaDocument = asInputMedia()
|
||||||
|
|
||||||
override fun asInputMedia(): InputMediaDocument = media.toInputMediaDocument(
|
override fun asInputMedia(): InputMediaDocument = media.toInputMediaDocument(textSources)
|
||||||
toHtmlCaptions().firstOrNull(),
|
|
||||||
HTMLParseMode
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
|
@ -1,19 +1,18 @@
|
|||||||
package dev.inmo.tgbotapi.types.message.content.media
|
package dev.inmo.tgbotapi.types.message.content.media
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.TextPart
|
import dev.inmo.tgbotapi.CommonAbstracts.TextPart
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.textSources
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.Request
|
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||||
import dev.inmo.tgbotapi.requests.send.media.SendPhoto
|
import dev.inmo.tgbotapi.requests.send.media.SendPhoto
|
||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.InputMedia.InputMediaPhoto
|
import dev.inmo.tgbotapi.types.InputMedia.InputMediaPhoto
|
||||||
import dev.inmo.tgbotapi.types.InputMedia.toInputMediaPhoto
|
import dev.inmo.tgbotapi.types.InputMedia.toInputMediaPhoto
|
||||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
import dev.inmo.tgbotapi.types.MessageIdentifier
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.HTMLParseMode
|
|
||||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.files.*
|
import dev.inmo.tgbotapi.types.files.*
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaCollectionContent
|
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaCollectionContent
|
||||||
import dev.inmo.tgbotapi.types.message.content.abstracts.VisualMediaGroupContent
|
import dev.inmo.tgbotapi.types.message.content.abstracts.VisualMediaGroupContent
|
||||||
import dev.inmo.tgbotapi.utils.internal.toHtmlCaptions
|
|
||||||
|
|
||||||
data class PhotoContent(
|
data class PhotoContent(
|
||||||
override val mediaCollection: Photo,
|
override val mediaCollection: Photo,
|
||||||
@ -31,8 +30,7 @@ data class PhotoContent(
|
|||||||
): Request<ContentMessage<PhotoContent>> = SendPhoto(
|
): Request<ContentMessage<PhotoContent>> = SendPhoto(
|
||||||
chatId,
|
chatId,
|
||||||
media.fileId,
|
media.fileId,
|
||||||
toHtmlCaptions().firstOrNull(),
|
textSources,
|
||||||
HTMLParseMode,
|
|
||||||
disableNotification,
|
disableNotification,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
@ -41,8 +39,5 @@ data class PhotoContent(
|
|||||||
|
|
||||||
override fun toMediaGroupMemberInputMedia(): InputMediaPhoto = asInputMedia()
|
override fun toMediaGroupMemberInputMedia(): InputMediaPhoto = asInputMedia()
|
||||||
|
|
||||||
override fun asInputMedia(): InputMediaPhoto = media.toInputMediaPhoto(
|
override fun asInputMedia(): InputMediaPhoto = media.toInputMediaPhoto(textSources)
|
||||||
toHtmlCaptions().firstOrNull(),
|
|
||||||
HTMLParseMode
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,17 @@
|
|||||||
package dev.inmo.tgbotapi.types.message.content.media
|
package dev.inmo.tgbotapi.types.message.content.media
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.TextPart
|
import dev.inmo.tgbotapi.CommonAbstracts.TextPart
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.textSources
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.Request
|
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||||
import dev.inmo.tgbotapi.requests.send.media.SendVideo
|
import dev.inmo.tgbotapi.requests.send.media.SendVideo
|
||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.InputMedia.InputMediaVideo
|
import dev.inmo.tgbotapi.types.InputMedia.InputMediaVideo
|
||||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
import dev.inmo.tgbotapi.types.MessageIdentifier
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.HTMLParseMode
|
|
||||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.files.VideoFile
|
import dev.inmo.tgbotapi.types.files.VideoFile
|
||||||
import dev.inmo.tgbotapi.types.files.toInputMediaVideo
|
import dev.inmo.tgbotapi.types.files.toInputMediaVideo
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.content.abstracts.VisualMediaGroupContent
|
import dev.inmo.tgbotapi.types.message.content.abstracts.VisualMediaGroupContent
|
||||||
import dev.inmo.tgbotapi.utils.internal.toHtmlCaptions
|
|
||||||
|
|
||||||
data class VideoContent(
|
data class VideoContent(
|
||||||
override val media: VideoFile,
|
override val media: VideoFile,
|
||||||
@ -29,8 +28,7 @@ data class VideoContent(
|
|||||||
chatId,
|
chatId,
|
||||||
media.fileId,
|
media.fileId,
|
||||||
media.thumb ?.fileId,
|
media.thumb ?.fileId,
|
||||||
toHtmlCaptions().firstOrNull(),
|
textSources,
|
||||||
HTMLParseMode,
|
|
||||||
media.duration,
|
media.duration,
|
||||||
media.width,
|
media.width,
|
||||||
media.height,
|
media.height,
|
||||||
@ -43,8 +41,5 @@ data class VideoContent(
|
|||||||
|
|
||||||
override fun toMediaGroupMemberInputMedia(): InputMediaVideo = asInputMedia()
|
override fun toMediaGroupMemberInputMedia(): InputMediaVideo = asInputMedia()
|
||||||
|
|
||||||
override fun asInputMedia(): InputMediaVideo = media.toInputMediaVideo(
|
override fun asInputMedia(): InputMediaVideo = media.toInputMediaVideo(textSources)
|
||||||
toHtmlCaptions().firstOrNull(),
|
|
||||||
HTMLParseMode
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,15 @@
|
|||||||
package dev.inmo.tgbotapi.types.message.content.media
|
package dev.inmo.tgbotapi.types.message.content.media
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.CaptionedInput
|
import dev.inmo.tgbotapi.CommonAbstracts.*
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.TextPart
|
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.Request
|
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||||
import dev.inmo.tgbotapi.requests.send.media.SendVoice
|
import dev.inmo.tgbotapi.requests.send.media.SendVoice
|
||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.InputMedia.InputMediaAudio
|
import dev.inmo.tgbotapi.types.InputMedia.InputMediaAudio
|
||||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
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.buttons.KeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.files.VoiceFile
|
import dev.inmo.tgbotapi.types.files.VoiceFile
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaContent
|
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaContent
|
||||||
import dev.inmo.tgbotapi.utils.internal.toHtmlCaptions
|
|
||||||
import dev.inmo.tgbotapi.utils.internal.toMarkdownV2Captions
|
|
||||||
|
|
||||||
data class VoiceContent(
|
data class VoiceContent(
|
||||||
override val media: VoiceFile,
|
override val media: VoiceFile,
|
||||||
@ -30,8 +25,7 @@ data class VoiceContent(
|
|||||||
): Request<ContentMessage<VoiceContent>> = SendVoice(
|
): Request<ContentMessage<VoiceContent>> = SendVoice(
|
||||||
chatId,
|
chatId,
|
||||||
media.fileId,
|
media.fileId,
|
||||||
toHtmlCaptions().firstOrNull(),
|
textSources,
|
||||||
HTMLParseMode,
|
|
||||||
media.duration,
|
media.duration,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
@ -41,8 +35,7 @@ data class VoiceContent(
|
|||||||
|
|
||||||
override fun asInputMedia(): InputMediaAudio = InputMediaAudio(
|
override fun asInputMedia(): InputMediaAudio = InputMediaAudio(
|
||||||
media.fileId,
|
media.fileId,
|
||||||
toMarkdownV2Captions().firstOrNull(),
|
textSources,
|
||||||
MarkdownV2,
|
|
||||||
media.duration
|
media.duration
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user