2018-12-26 08:07:24 +00:00
|
|
|
package com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media
|
|
|
|
|
2019-01-17 02:19:33 +00:00
|
|
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
|
|
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendPhoto
|
|
|
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
2019-01-21 02:22:51 +00:00
|
|
|
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.InputMediaPhoto
|
|
|
|
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.MediaGroupMemberInputMedia
|
2018-12-26 08:07:24 +00:00
|
|
|
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.MessageEntity
|
2019-01-17 02:19:33 +00:00
|
|
|
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
2019-03-30 12:12:00 +00:00
|
|
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.HTMLParseMode
|
2019-01-17 02:19:33 +00:00
|
|
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
2018-12-26 08:07:24 +00:00
|
|
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize
|
2019-01-17 02:19:33 +00:00
|
|
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.biggest
|
|
|
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage
|
2018-12-26 08:07:24 +00:00
|
|
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.*
|
2019-03-30 12:12:00 +00:00
|
|
|
import com.github.insanusmokrassar.TelegramBotAPI.utils.toHtmlCaptions
|
2018-12-26 08:07:24 +00:00
|
|
|
|
|
|
|
data class PhotoContent(
|
2019-03-21 01:18:54 +00:00
|
|
|
override val mediaCollection: List<PhotoSize>,
|
2018-12-26 08:07:24 +00:00
|
|
|
override val caption: String? = null,
|
|
|
|
override val captionEntities: List<MessageEntity> = emptyList()
|
2019-01-17 02:19:33 +00:00
|
|
|
) : MediaCollectionContent<PhotoSize>, CaptionedMediaContent, MediaGroupContent {
|
2019-03-21 01:18:54 +00:00
|
|
|
override val media: PhotoSize = mediaCollection.biggest() ?: throw IllegalStateException("Can't locate any photo size for this content")
|
|
|
|
|
2019-01-17 02:19:33 +00:00
|
|
|
override fun createResend(
|
|
|
|
chatId: ChatIdentifier,
|
|
|
|
disableNotification: Boolean,
|
|
|
|
replyToMessageId: MessageIdentifier?,
|
|
|
|
replyMarkup: KeyboardMarkup?
|
|
|
|
): Request<RawMessage> = SendPhoto(
|
|
|
|
chatId,
|
2019-03-21 01:18:54 +00:00
|
|
|
media.fileId,
|
2019-03-30 12:12:00 +00:00
|
|
|
toHtmlCaptions().firstOrNull(),
|
|
|
|
HTMLParseMode,
|
2019-01-17 02:19:33 +00:00
|
|
|
disableNotification,
|
|
|
|
replyToMessageId,
|
|
|
|
replyMarkup
|
|
|
|
)
|
2019-01-21 02:22:51 +00:00
|
|
|
|
|
|
|
override fun toMediaGroupMemberInputMedia(): MediaGroupMemberInputMedia = InputMediaPhoto(
|
2019-03-21 01:18:54 +00:00
|
|
|
media.fileId,
|
2019-03-30 12:12:00 +00:00
|
|
|
toHtmlCaptions().firstOrNull(),
|
|
|
|
HTMLParseMode
|
2019-01-21 02:22:51 +00:00
|
|
|
)
|
2019-01-17 02:19:33 +00:00
|
|
|
}
|