1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-06-01 07:25:23 +00:00
tgbotapi/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/caption/EditInlineMessageCaption.kt

61 lines
1.9 KiB
Kotlin
Raw Normal View History

2020-10-04 11:06:30 +00:00
package dev.inmo.tgbotapi.requests.edit.caption
2018-12-26 08:07:24 +00:00
2020-10-04 11:06:30 +00:00
import dev.inmo.tgbotapi.requests.edit.abstracts.*
import dev.inmo.tgbotapi.types.*
2022-05-01 14:36:07 +00:00
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
2022-05-01 14:43:03 +00:00
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.message.parseModeField
2020-10-04 11:06:30 +00:00
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-12-02 08:35:37 +00:00
import kotlinx.serialization.*
2018-12-26 08:07:24 +00:00
fun EditInlineMessageCaption(
2024-03-16 14:36:48 +00:00
inlineMessageId: InlineMessageId,
text: String,
parseMode: ParseMode? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = EditInlineMessageCaption(
inlineMessageId,
text,
parseMode,
null,
replyMarkup
)
fun EditInlineMessageCaption(
2024-03-16 14:36:48 +00:00
inlineMessageId: InlineMessageId,
2021-05-29 09:34:14 +00:00
entities: TextSourcesList,
replyMarkup: InlineKeyboardMarkup? = null
) = EditInlineMessageCaption(
inlineMessageId,
entities.makeString(),
null,
entities.toRawMessageEntities(),
replyMarkup
)
2018-12-26 08:07:24 +00:00
@Serializable
data class EditInlineMessageCaption internal constructor(
2018-12-26 08:07:24 +00:00
@SerialName(inlineMessageIdField)
2024-03-16 14:36:48 +00:00
override val inlineMessageId: InlineMessageId,
2018-12-26 08:07:24 +00:00
@SerialName(captionField)
override val text: String,
@SerialName(parseModeField)
override val parseMode: ParseMode? = null,
@SerialName(captionEntitiesField)
private val rawEntities: List<RawMessageEntity>? = null,
2018-12-26 08:07:24 +00:00
@SerialName(replyMarkupField)
override val replyMarkup: InlineKeyboardMarkup? = null
) : EditInlineMessage, EditTextChatMessage, EditReplyMessage {
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)
}
2018-12-26 08:07:24 +00:00
override fun method(): String = editMessageCaptionMethod
2019-12-02 08:35:37 +00:00
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
2018-12-26 08:07:24 +00:00
}