2020-10-04 11:06:30 +00:00
|
|
|
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
2019-02-07 04:32:32 +00:00
|
|
|
|
2020-10-04 11:06:30 +00:00
|
|
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
|
|
|
import dev.inmo.tgbotapi.types.*
|
|
|
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.video.InlineQueryResultVideoCached
|
|
|
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.video.inlineQueryResultVideoType
|
2021-05-29 09:34:14 +00:00
|
|
|
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
2022-05-01 14:36:07 +00:00
|
|
|
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
2020-10-04 11:06:30 +00:00
|
|
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
|
|
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
|
|
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
2022-05-01 14:36:07 +00:00
|
|
|
import dev.inmo.tgbotapi.types.message.*
|
|
|
|
import dev.inmo.tgbotapi.types.message.RawMessageEntity
|
|
|
|
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
2021-08-08 12:00:42 +00:00
|
|
|
import dev.inmo.tgbotapi.utils.extensions.makeString
|
2019-04-13 02:21:19 +00:00
|
|
|
import kotlinx.serialization.SerialName
|
|
|
|
import kotlinx.serialization.Serializable
|
2019-02-07 04:32:32 +00:00
|
|
|
|
2020-11-05 12:00:40 +00:00
|
|
|
fun InlineQueryResultVideoCachedImpl(
|
|
|
|
id: InlineQueryIdentifier,
|
|
|
|
fileId: FileId,
|
|
|
|
title: String,
|
|
|
|
description: String? = null,
|
|
|
|
text: String? = null,
|
|
|
|
parseMode: ParseMode? = null,
|
|
|
|
replyMarkup: InlineKeyboardMarkup? = null,
|
|
|
|
inputMessageContent: InputMessageContent? = null
|
|
|
|
) = InlineQueryResultVideoCachedImpl(id, fileId, title, description, text, parseMode, null, replyMarkup, inputMessageContent)
|
|
|
|
|
|
|
|
fun InlineQueryResultVideoCachedImpl(
|
|
|
|
id: InlineQueryIdentifier,
|
|
|
|
fileId: FileId,
|
|
|
|
title: String,
|
|
|
|
description: String? = null,
|
2021-05-29 09:34:14 +00:00
|
|
|
entities: TextSourcesList,
|
2020-11-05 12:00:40 +00:00
|
|
|
replyMarkup: InlineKeyboardMarkup? = null,
|
|
|
|
inputMessageContent: InputMessageContent? = null
|
2021-05-29 10:02:55 +00:00
|
|
|
) = InlineQueryResultVideoCachedImpl(
|
|
|
|
id,
|
|
|
|
fileId,
|
|
|
|
title,
|
|
|
|
description,
|
|
|
|
entities.makeString(),
|
|
|
|
null,
|
|
|
|
entities.toRawMessageEntities(),
|
|
|
|
replyMarkup,
|
|
|
|
inputMessageContent
|
|
|
|
)
|
2020-11-05 12:00:40 +00:00
|
|
|
|
2019-02-07 11:32:31 +00:00
|
|
|
@Serializable
|
2020-11-05 12:00:40 +00:00
|
|
|
data class InlineQueryResultVideoCachedImpl internal constructor(
|
2019-02-07 04:32:32 +00:00
|
|
|
@SerialName(idField)
|
2020-09-20 14:16:14 +00:00
|
|
|
override val id: InlineQueryIdentifier,
|
2019-02-07 04:32:32 +00:00
|
|
|
@SerialName(videoFileIdField)
|
|
|
|
override val fileId: FileId,
|
|
|
|
@SerialName(titleField)
|
2019-02-07 05:55:29 +00:00
|
|
|
override val title: String,
|
2019-02-07 04:32:32 +00:00
|
|
|
@SerialName(descriptionField)
|
|
|
|
override val description: String? = null,
|
|
|
|
@SerialName(captionField)
|
2020-11-05 12:00:40 +00:00
|
|
|
override val text: String? = null,
|
2019-02-07 04:32:32 +00:00
|
|
|
@SerialName(parseModeField)
|
|
|
|
override val parseMode: ParseMode? = null,
|
2020-11-05 12:00:40 +00:00
|
|
|
@SerialName(captionEntitiesField)
|
|
|
|
private val rawEntities: List<RawMessageEntity>? = null,
|
2019-02-07 04:32:32 +00:00
|
|
|
@SerialName(replyMarkupField)
|
|
|
|
override val replyMarkup: InlineKeyboardMarkup? = null,
|
|
|
|
@SerialName(inputMessageContentField)
|
|
|
|
override val inputMessageContent: InputMessageContent? = null
|
2019-02-07 11:50:08 +00:00
|
|
|
) : InlineQueryResultVideoCached {
|
|
|
|
override val type: String = inlineQueryResultVideoType
|
2021-05-29 09:34:14 +00:00
|
|
|
override val textSources: TextSourcesList? by lazy {
|
2021-04-28 13:54:57 +00:00
|
|
|
rawEntities ?.asTextSources(text ?: return@lazy null)
|
2020-11-05 12:00:40 +00:00
|
|
|
}
|
2019-02-07 11:50:08 +00:00
|
|
|
}
|