2020-10-04 11:06:30 +00:00
|
|
|
package dev.inmo.tgbotapi.types.message.content.media
|
|
|
|
|
2021-04-28 13:59:30 +00:00
|
|
|
import dev.inmo.tgbotapi.CommonAbstracts.TextSourcesList
|
2020-10-04 11:06:30 +00:00
|
|
|
import dev.inmo.tgbotapi.requests.abstracts.Request
|
|
|
|
import dev.inmo.tgbotapi.requests.send.media.SendPhoto
|
|
|
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
2020-11-05 18:12:14 +00:00
|
|
|
import dev.inmo.tgbotapi.types.InputMedia.InputMediaPhoto
|
|
|
|
import dev.inmo.tgbotapi.types.InputMedia.toInputMediaPhoto
|
2020-10-04 11:06:30 +00:00
|
|
|
import dev.inmo.tgbotapi.types.MessageIdentifier
|
|
|
|
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
|
|
|
import dev.inmo.tgbotapi.types.files.*
|
|
|
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
2020-11-05 18:12:14 +00:00
|
|
|
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaCollectionContent
|
|
|
|
import dev.inmo.tgbotapi.types.message.content.abstracts.VisualMediaGroupContent
|
2020-10-04 11:06:30 +00:00
|
|
|
|
|
|
|
data class PhotoContent(
|
|
|
|
override val mediaCollection: Photo,
|
2021-04-26 15:25:52 +00:00
|
|
|
override val text: String? = null,
|
2021-04-27 10:08:36 +00:00
|
|
|
override val textSources: TextSourcesList = emptyList()
|
2020-11-02 06:02:12 +00:00
|
|
|
) : MediaCollectionContent<PhotoSize>, VisualMediaGroupContent {
|
2020-10-04 11:06:30 +00:00
|
|
|
override val media: PhotoSize = mediaCollection.biggest() ?: throw IllegalStateException("Can't locate any photo size for this content")
|
|
|
|
|
|
|
|
override fun createResend(
|
|
|
|
chatId: ChatIdentifier,
|
|
|
|
disableNotification: Boolean,
|
|
|
|
replyToMessageId: MessageIdentifier?,
|
2020-11-05 17:48:23 +00:00
|
|
|
allowSendingWithoutReply: Boolean?,
|
2020-10-04 11:06:30 +00:00
|
|
|
replyMarkup: KeyboardMarkup?
|
|
|
|
): Request<ContentMessage<PhotoContent>> = SendPhoto(
|
|
|
|
chatId,
|
|
|
|
media.fileId,
|
2021-02-09 12:26:10 +00:00
|
|
|
textSources,
|
2020-10-04 11:06:30 +00:00
|
|
|
disableNotification,
|
|
|
|
replyToMessageId,
|
2020-11-05 17:48:23 +00:00
|
|
|
allowSendingWithoutReply,
|
2020-10-04 11:06:30 +00:00
|
|
|
replyMarkup
|
|
|
|
)
|
|
|
|
|
2020-11-02 07:16:46 +00:00
|
|
|
override fun toMediaGroupMemberInputMedia(): InputMediaPhoto = asInputMedia()
|
|
|
|
|
2021-02-09 12:26:10 +00:00
|
|
|
override fun asInputMedia(): InputMediaPhoto = media.toInputMediaPhoto(textSources)
|
2020-10-04 11:06:30 +00:00
|
|
|
}
|