mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 16:23:48 +00:00
Update all classes which must have "entities"/"caption_entities" fields (#189)
This commit is contained in:
parent
a5982ac881
commit
d5e283e7ba
@ -59,6 +59,7 @@
|
|||||||
* `PrivateMessage` - works like previous `CommonMessageImpl`
|
* `PrivateMessage` - works like previous `CommonMessageImpl`
|
||||||
* Previous `CommonMessageImpl` safely renamed to `PrivateMessageImpl`
|
* Previous `CommonMessageImpl` safely renamed to `PrivateMessageImpl`
|
||||||
* New property `PromoteChatMember#isAnonymous`
|
* New property `PromoteChatMember#isAnonymous`
|
||||||
|
* Update all classes which must have `entities`/`caption_entities` fields
|
||||||
* `API`:
|
* `API`:
|
||||||
* Extensions `TelegramBot#pinChatMessage` now support any `Chat` and `Message`s from any `Chat`
|
* Extensions `TelegramBot#pinChatMessage` now support any `Chat` and `Message`s from any `Chat`
|
||||||
* New extensions `TelegramBot#unpinAllChatMessages`
|
* New extensions `TelegramBot#unpinAllChatMessages`
|
||||||
|
@ -1,30 +1,56 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.*
|
||||||
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.InlineQueries.InlineQueryResult.abstracts.results.audio.InlineQueryResultAudioCached
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.audio.InlineQueryResultAudioCached
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.audio.inlineQueryResultAudioType
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.audio.inlineQueryResultAudioType
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.RawMessageEntity
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.asTextParts
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
fun InlineQueryResultAudioCachedImpl(
|
||||||
|
id: InlineQueryIdentifier,
|
||||||
|
fileId: FileId,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
|
inputMessageContent: InputMessageContent? = null
|
||||||
|
) = InlineQueryResultAudioCachedImpl(id, fileId, text, parseMode, null, replyMarkup, inputMessageContent)
|
||||||
|
|
||||||
|
fun InlineQueryResultAudioCachedImpl(
|
||||||
|
id: InlineQueryIdentifier,
|
||||||
|
fileId: FileId,
|
||||||
|
entities: List<TextSource>,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
|
inputMessageContent: InputMessageContent? = null
|
||||||
|
) = InlineQueryResultAudioCachedImpl(id, fileId, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class InlineQueryResultAudioCachedImpl(
|
data class InlineQueryResultAudioCachedImpl internal constructor(
|
||||||
@SerialName(idField)
|
@SerialName(idField)
|
||||||
override val id: InlineQueryIdentifier,
|
override val id: InlineQueryIdentifier,
|
||||||
@SerialName(audioFileIdField)
|
@SerialName(audioFileIdField)
|
||||||
override val fileId: FileId,
|
override val fileId: FileId,
|
||||||
@SerialName(captionField)
|
@SerialName(captionField)
|
||||||
override val caption: String? = null,
|
override val text: String? = null,
|
||||||
@SerialName(parseModeField)
|
@SerialName(parseModeField)
|
||||||
override val parseMode: ParseMode? = null,
|
override val parseMode: ParseMode? = null,
|
||||||
|
@SerialName(captionEntitiesField)
|
||||||
|
private val rawEntities: List<RawMessageEntity>? = null,
|
||||||
@SerialName(replyMarkupField)
|
@SerialName(replyMarkupField)
|
||||||
override val replyMarkup: InlineKeyboardMarkup? = null,
|
override val replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
@SerialName(inputMessageContentField)
|
@SerialName(inputMessageContentField)
|
||||||
override val inputMessageContent: InputMessageContent? = null
|
override val inputMessageContent: InputMessageContent? = null
|
||||||
) : InlineQueryResultAudioCached {
|
) : InlineQueryResultAudioCached {
|
||||||
override val type: String = inlineQueryResultAudioType
|
override val type: String = inlineQueryResultAudioType
|
||||||
|
override val entities: List<TextSource>? by lazy {
|
||||||
|
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,44 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.*
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.audio.InlineQueryResultAudio
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.audio.InlineQueryResultAudio
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.audio.inlineQueryResultAudioType
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.audio.inlineQueryResultAudioType
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.RawMessageEntity
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.asTextParts
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
fun InlineQueryResultAudioImpl(
|
||||||
|
id: InlineQueryIdentifier,
|
||||||
|
url: String,
|
||||||
|
title: String,
|
||||||
|
performer: String? = null,
|
||||||
|
duration: Int? = null,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
|
inputMessageContent: InputMessageContent? = null
|
||||||
|
) = InlineQueryResultAudioImpl(id, url, title, performer, duration, text, parseMode, null, replyMarkup, inputMessageContent)
|
||||||
|
|
||||||
|
fun InlineQueryResultAudioImpl(
|
||||||
|
id: InlineQueryIdentifier,
|
||||||
|
url: String,
|
||||||
|
title: String,
|
||||||
|
performer: String? = null,
|
||||||
|
duration: Int? = null,
|
||||||
|
entities: List<TextSource>,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
|
inputMessageContent: InputMessageContent? = null
|
||||||
|
) = InlineQueryResultAudioImpl(id, url, title, performer, duration, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class InlineQueryResultAudioImpl(
|
data class InlineQueryResultAudioImpl internal constructor(
|
||||||
@SerialName(idField)
|
@SerialName(idField)
|
||||||
override val id: InlineQueryIdentifier,
|
override val id: InlineQueryIdentifier,
|
||||||
@SerialName(audioUrlField)
|
@SerialName(audioUrlField)
|
||||||
@ -23,13 +50,18 @@ data class InlineQueryResultAudioImpl(
|
|||||||
@SerialName(audioDurationField)
|
@SerialName(audioDurationField)
|
||||||
override val duration: Int? = null,
|
override val duration: Int? = null,
|
||||||
@SerialName(captionField)
|
@SerialName(captionField)
|
||||||
override val caption: String? = null,
|
override val text: String? = null,
|
||||||
@SerialName(parseModeField)
|
@SerialName(parseModeField)
|
||||||
override val parseMode: ParseMode? = null,
|
override val parseMode: ParseMode? = null,
|
||||||
|
@SerialName(captionEntitiesField)
|
||||||
|
private val rawEntities: List<RawMessageEntity>? = null,
|
||||||
@SerialName(replyMarkupField)
|
@SerialName(replyMarkupField)
|
||||||
override val replyMarkup: InlineKeyboardMarkup? = null,
|
override val replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
@SerialName(inputMessageContentField)
|
@SerialName(inputMessageContentField)
|
||||||
override val inputMessageContent: InputMessageContent? = null
|
override val inputMessageContent: InputMessageContent? = null
|
||||||
) : InlineQueryResultAudio {
|
) : InlineQueryResultAudio {
|
||||||
override val type: String = inlineQueryResultAudioType
|
override val type: String = inlineQueryResultAudioType
|
||||||
|
override val entities: List<TextSource>? by lazy {
|
||||||
|
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,43 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.*
|
||||||
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.InlineQueries.InlineQueryResult.abstracts.results.document.InlineQueryResultDocumentCached
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.document.InlineQueryResultDocumentCached
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.document.inlineQueryResultDocumentType
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.document.inlineQueryResultDocumentType
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.RawMessageEntity
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.asTextParts
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
fun InlineQueryResultDocumentCachedImpl(
|
||||||
|
id: InlineQueryIdentifier,
|
||||||
|
fileId: FileId,
|
||||||
|
title: String,
|
||||||
|
description: String? = null,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
|
inputMessageContent: InputMessageContent? = null
|
||||||
|
) = InlineQueryResultDocumentCachedImpl(id, fileId, title, description, text, parseMode, null, replyMarkup, inputMessageContent)
|
||||||
|
|
||||||
|
fun InlineQueryResultDocumentCachedImpl(
|
||||||
|
id: InlineQueryIdentifier,
|
||||||
|
fileId: FileId,
|
||||||
|
title: String,
|
||||||
|
description: String? = null,
|
||||||
|
entities: List<TextSource>,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
|
inputMessageContent: InputMessageContent? = null
|
||||||
|
) = InlineQueryResultDocumentCachedImpl(id, fileId, title, description, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class InlineQueryResultDocumentCachedImpl(
|
data class InlineQueryResultDocumentCachedImpl internal constructor(
|
||||||
@SerialName(idField)
|
@SerialName(idField)
|
||||||
override val id: InlineQueryIdentifier,
|
override val id: InlineQueryIdentifier,
|
||||||
@SerialName(documentFileIdField)
|
@SerialName(documentFileIdField)
|
||||||
@ -22,13 +47,18 @@ data class InlineQueryResultDocumentCachedImpl(
|
|||||||
@SerialName(descriptionField)
|
@SerialName(descriptionField)
|
||||||
override val description: String? = null,
|
override val description: String? = null,
|
||||||
@SerialName(captionField)
|
@SerialName(captionField)
|
||||||
override val caption: String? = null,
|
override val text: String? = null,
|
||||||
@SerialName(parseModeField)
|
@SerialName(parseModeField)
|
||||||
override val parseMode: ParseMode? = null,
|
override val parseMode: ParseMode? = null,
|
||||||
|
@SerialName(captionEntitiesField)
|
||||||
|
private val rawEntities: List<RawMessageEntity>? = null,
|
||||||
@SerialName(replyMarkupField)
|
@SerialName(replyMarkupField)
|
||||||
override val replyMarkup: InlineKeyboardMarkup? = null,
|
override val replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
@SerialName(inputMessageContentField)
|
@SerialName(inputMessageContentField)
|
||||||
override val inputMessageContent: InputMessageContent? = null
|
override val inputMessageContent: InputMessageContent? = null
|
||||||
) : InlineQueryResultDocumentCached {
|
) : InlineQueryResultDocumentCached {
|
||||||
override val type: String = inlineQueryResultDocumentType
|
override val type: String = inlineQueryResultDocumentType
|
||||||
|
override val entities: List<TextSource>? by lazy {
|
||||||
|
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.*
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.document.InlineQueryResultDocument
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.document.InlineQueryResultDocument
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.document.inlineQueryResultDocumentType
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.document.inlineQueryResultDocumentType
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.RawMessageEntity
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.asTextParts
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
@ -12,8 +16,37 @@ import dev.inmo.tgbotapi.utils.MimeType
|
|||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
fun InlineQueryResultDocumentImpl(
|
||||||
|
id: InlineQueryIdentifier,
|
||||||
|
url: String,
|
||||||
|
title: String,
|
||||||
|
mimeType: MimeType,
|
||||||
|
thumbUrl: String? = null,
|
||||||
|
thumbWidth: Int? = null,
|
||||||
|
thumbHeight: Int? = null,
|
||||||
|
description: String? = null,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
|
inputMessageContent: InputMessageContent? = null
|
||||||
|
) = InlineQueryResultDocumentImpl(id, url, title, mimeType, thumbUrl, thumbWidth, thumbHeight, description, text, parseMode, null, replyMarkup, inputMessageContent)
|
||||||
|
|
||||||
|
fun InlineQueryResultDocumentImpl(
|
||||||
|
id: InlineQueryIdentifier,
|
||||||
|
url: String,
|
||||||
|
title: String,
|
||||||
|
mimeType: MimeType,
|
||||||
|
thumbUrl: String? = null,
|
||||||
|
thumbWidth: Int? = null,
|
||||||
|
thumbHeight: Int? = null,
|
||||||
|
description: String? = null,
|
||||||
|
entities: List<TextSource>,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
|
inputMessageContent: InputMessageContent? = null
|
||||||
|
) = InlineQueryResultDocumentImpl(id, url, title, mimeType, thumbUrl, thumbWidth, thumbHeight, description, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class InlineQueryResultDocumentImpl(
|
data class InlineQueryResultDocumentImpl internal constructor(
|
||||||
@SerialName(idField)
|
@SerialName(idField)
|
||||||
override val id: InlineQueryIdentifier,
|
override val id: InlineQueryIdentifier,
|
||||||
@SerialName(documentUrlField)
|
@SerialName(documentUrlField)
|
||||||
@ -31,13 +64,18 @@ data class InlineQueryResultDocumentImpl(
|
|||||||
@SerialName(descriptionField)
|
@SerialName(descriptionField)
|
||||||
override val description: String? = null,
|
override val description: String? = null,
|
||||||
@SerialName(captionField)
|
@SerialName(captionField)
|
||||||
override val caption: String? = null,
|
override val text: String? = null,
|
||||||
@SerialName(parseModeField)
|
@SerialName(parseModeField)
|
||||||
override val parseMode: ParseMode? = null,
|
override val parseMode: ParseMode? = null,
|
||||||
|
@SerialName(captionEntitiesField)
|
||||||
|
private val rawEntities: List<RawMessageEntity>? = null,
|
||||||
@SerialName(replyMarkupField)
|
@SerialName(replyMarkupField)
|
||||||
override val replyMarkup: InlineKeyboardMarkup? = null,
|
override val replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
@SerialName(inputMessageContentField)
|
@SerialName(inputMessageContentField)
|
||||||
override val inputMessageContent: InputMessageContent? = null
|
override val inputMessageContent: InputMessageContent? = null
|
||||||
) : InlineQueryResultDocument {
|
) : InlineQueryResultDocument {
|
||||||
override val type: String = inlineQueryResultDocumentType
|
override val type: String = inlineQueryResultDocumentType
|
||||||
|
override val entities: List<TextSource>? by lazy {
|
||||||
|
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,41 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.*
|
||||||
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.InlineQueries.InlineQueryResult.abstracts.results.gif.InlineQueryResultGifCached
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.gif.InlineQueryResultGifCached
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.gif.inlineQueryResultGifType
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.gif.inlineQueryResultGifType
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.RawMessageEntity
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.asTextParts
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
fun InlineQueryResultGifCachedImpl(
|
||||||
|
id: InlineQueryIdentifier,
|
||||||
|
fileId: FileId,
|
||||||
|
title: String? = null,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
|
inputMessageContent: InputMessageContent? = null
|
||||||
|
) = InlineQueryResultGifCachedImpl(id, fileId, title, text, parseMode, null, replyMarkup, inputMessageContent)
|
||||||
|
|
||||||
|
fun InlineQueryResultGifCachedImpl(
|
||||||
|
id: InlineQueryIdentifier,
|
||||||
|
fileId: FileId,
|
||||||
|
title: String? = null,
|
||||||
|
entities: List<TextSource>,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
|
inputMessageContent: InputMessageContent? = null
|
||||||
|
) = InlineQueryResultGifCachedImpl(id, fileId, title, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class InlineQueryResultGifCachedImpl(
|
data class InlineQueryResultGifCachedImpl internal constructor(
|
||||||
@SerialName(idField)
|
@SerialName(idField)
|
||||||
override val id: InlineQueryIdentifier,
|
override val id: InlineQueryIdentifier,
|
||||||
@SerialName(gifFileIdField)
|
@SerialName(gifFileIdField)
|
||||||
@ -20,13 +43,18 @@ data class InlineQueryResultGifCachedImpl(
|
|||||||
@SerialName(titleField)
|
@SerialName(titleField)
|
||||||
override val title: String? = null,
|
override val title: String? = null,
|
||||||
@SerialName(captionField)
|
@SerialName(captionField)
|
||||||
override val caption: String? = null,
|
override val text: String? = null,
|
||||||
@SerialName(parseModeField)
|
@SerialName(parseModeField)
|
||||||
override val parseMode: ParseMode? = null,
|
override val parseMode: ParseMode? = null,
|
||||||
|
@SerialName(captionEntitiesField)
|
||||||
|
private val rawEntities: List<RawMessageEntity>? = null,
|
||||||
@SerialName(replyMarkupField)
|
@SerialName(replyMarkupField)
|
||||||
override val replyMarkup: InlineKeyboardMarkup? = null,
|
override val replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
@SerialName(inputMessageContentField)
|
@SerialName(inputMessageContentField)
|
||||||
override val inputMessageContent: InputMessageContent? = null
|
override val inputMessageContent: InputMessageContent? = null
|
||||||
) : InlineQueryResultGifCached {
|
) : InlineQueryResultGifCached {
|
||||||
override val type: String = inlineQueryResultGifType
|
override val type: String = inlineQueryResultGifType
|
||||||
|
override val entities: List<TextSource>? by lazy {
|
||||||
|
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.*
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.gif.InlineQueryResultGif
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.gif.InlineQueryResultGif
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.gif.inlineQueryResultGifType
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.gif.inlineQueryResultGifType
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.RawMessageEntity
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.asTextParts
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
@ -11,8 +15,37 @@ import dev.inmo.tgbotapi.utils.MimeType
|
|||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
fun InlineQueryResultGifImpl(
|
||||||
|
id: InlineQueryIdentifier,
|
||||||
|
url: String,
|
||||||
|
thumbUrl: String,
|
||||||
|
thumbMimeType: MimeType? = null,
|
||||||
|
width: Int? = null,
|
||||||
|
height: Int? = null,
|
||||||
|
duration: Int? = null,
|
||||||
|
title: String? = null,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
|
inputMessageContent: InputMessageContent? = null
|
||||||
|
) = InlineQueryResultGifImpl(id, url, thumbUrl, thumbMimeType, width, height, duration, title, text, parseMode, null, replyMarkup, inputMessageContent)
|
||||||
|
|
||||||
|
fun InlineQueryResultGifImpl(
|
||||||
|
id: InlineQueryIdentifier,
|
||||||
|
url: String,
|
||||||
|
thumbUrl: String,
|
||||||
|
thumbMimeType: MimeType? = null,
|
||||||
|
width: Int? = null,
|
||||||
|
height: Int? = null,
|
||||||
|
duration: Int? = null,
|
||||||
|
title: String? = null,
|
||||||
|
entities: List<TextSource>,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
|
inputMessageContent: InputMessageContent? = null
|
||||||
|
) = InlineQueryResultGifImpl(id, url, thumbUrl, thumbMimeType, width, height, duration, title, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class InlineQueryResultGifImpl(
|
data class InlineQueryResultGifImpl internal constructor(
|
||||||
@SerialName(idField)
|
@SerialName(idField)
|
||||||
override val id: InlineQueryIdentifier,
|
override val id: InlineQueryIdentifier,
|
||||||
@SerialName(gifUrlField)
|
@SerialName(gifUrlField)
|
||||||
@ -30,15 +63,20 @@ data class InlineQueryResultGifImpl(
|
|||||||
@SerialName(titleField)
|
@SerialName(titleField)
|
||||||
override val title: String? = null,
|
override val title: String? = null,
|
||||||
@SerialName(captionField)
|
@SerialName(captionField)
|
||||||
override val caption: String? = null,
|
override val text: String? = null,
|
||||||
@SerialName(parseModeField)
|
@SerialName(parseModeField)
|
||||||
override val parseMode: ParseMode? = null,
|
override val parseMode: ParseMode? = null,
|
||||||
|
@SerialName(captionEntitiesField)
|
||||||
|
private val rawEntities: List<RawMessageEntity>? = null,
|
||||||
@SerialName(replyMarkupField)
|
@SerialName(replyMarkupField)
|
||||||
override val replyMarkup: InlineKeyboardMarkup? = null,
|
override val replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
@SerialName(inputMessageContentField)
|
@SerialName(inputMessageContentField)
|
||||||
override val inputMessageContent: InputMessageContent? = null
|
override val inputMessageContent: InputMessageContent? = null
|
||||||
) : InlineQueryResultGif {
|
) : InlineQueryResultGif {
|
||||||
override val type: String = inlineQueryResultGifType
|
override val type: String = inlineQueryResultGifType
|
||||||
|
override val entities: List<TextSource>? by lazy {
|
||||||
|
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
||||||
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
if (thumbMimeType != null && thumbMimeType !in telegramInlineModeGifPermittedMimeTypes) {
|
if (thumbMimeType != null && thumbMimeType !in telegramInlineModeGifPermittedMimeTypes) {
|
||||||
|
@ -1,18 +1,41 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.*
|
||||||
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.InlineQueries.InlineQueryResult.abstracts.results.mpeg4gif.InlineQueryResultMpeg4GifCached
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.mpeg4gif.InlineQueryResultMpeg4GifCached
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.mpeg4gif.inlineQueryResultMpeg4GifType
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.mpeg4gif.inlineQueryResultMpeg4GifType
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.RawMessageEntity
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.asTextParts
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
fun InlineQueryResultMpeg4GifCachedImpl(
|
||||||
|
id: InlineQueryIdentifier,
|
||||||
|
fileId: FileId,
|
||||||
|
title: String? = null,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
|
inputMessageContent: InputMessageContent? = null
|
||||||
|
) = InlineQueryResultMpeg4GifCachedImpl(id, fileId, title, text, parseMode, null, replyMarkup, inputMessageContent)
|
||||||
|
|
||||||
|
fun InlineQueryResultMpeg4GifCachedImpl(
|
||||||
|
id: InlineQueryIdentifier,
|
||||||
|
fileId: FileId,
|
||||||
|
title: String? = null,
|
||||||
|
entities: List<TextSource>,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
|
inputMessageContent: InputMessageContent? = null
|
||||||
|
) = InlineQueryResultMpeg4GifCachedImpl(id, fileId, title, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class InlineQueryResultMpeg4GifCachedImpl(
|
data class InlineQueryResultMpeg4GifCachedImpl internal constructor(
|
||||||
@SerialName(idField)
|
@SerialName(idField)
|
||||||
override val id: InlineQueryIdentifier,
|
override val id: InlineQueryIdentifier,
|
||||||
@SerialName(mpeg4GifFileIdField)
|
@SerialName(mpeg4GifFileIdField)
|
||||||
@ -20,13 +43,18 @@ data class InlineQueryResultMpeg4GifCachedImpl(
|
|||||||
@SerialName(titleField)
|
@SerialName(titleField)
|
||||||
override val title: String? = null,
|
override val title: String? = null,
|
||||||
@SerialName(captionField)
|
@SerialName(captionField)
|
||||||
override val caption: String? = null,
|
override val text: String? = null,
|
||||||
@SerialName(parseModeField)
|
@SerialName(parseModeField)
|
||||||
override val parseMode: ParseMode? = null,
|
override val parseMode: ParseMode? = null,
|
||||||
|
@SerialName(captionEntitiesField)
|
||||||
|
private val rawEntities: List<RawMessageEntity>? = null,
|
||||||
@SerialName(replyMarkupField)
|
@SerialName(replyMarkupField)
|
||||||
override val replyMarkup: InlineKeyboardMarkup? = null,
|
override val replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
@SerialName(inputMessageContentField)
|
@SerialName(inputMessageContentField)
|
||||||
override val inputMessageContent: InputMessageContent? = null
|
override val inputMessageContent: InputMessageContent? = null
|
||||||
) : InlineQueryResultMpeg4GifCached {
|
) : InlineQueryResultMpeg4GifCached {
|
||||||
override val type: String = inlineQueryResultMpeg4GifType
|
override val type: String = inlineQueryResultMpeg4GifType
|
||||||
|
override val entities: List<TextSource>? by lazy {
|
||||||
|
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.*
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.mpeg4gif.InlineQueryResultMpeg4Gif
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.mpeg4gif.InlineQueryResultMpeg4Gif
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.mpeg4gif.inlineQueryResultMpeg4GifType
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.mpeg4gif.inlineQueryResultMpeg4GifType
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.RawMessageEntity
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.asTextParts
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
@ -11,8 +15,37 @@ import dev.inmo.tgbotapi.utils.MimeType
|
|||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
fun InlineQueryResultMpeg4GifImpl(
|
||||||
|
id: InlineQueryIdentifier,
|
||||||
|
url: String,
|
||||||
|
thumbUrl: String,
|
||||||
|
thumbMimeType: MimeType? = null,
|
||||||
|
width: Int? = null,
|
||||||
|
height: Int? = null,
|
||||||
|
duration: Int? = null,
|
||||||
|
title: String? = null,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
|
inputMessageContent: InputMessageContent? = null
|
||||||
|
) = InlineQueryResultMpeg4GifImpl(id, url, thumbUrl, thumbMimeType, width, height, duration, title, text, parseMode, null, replyMarkup, inputMessageContent)
|
||||||
|
|
||||||
|
fun InlineQueryResultMpeg4GifImpl(
|
||||||
|
id: InlineQueryIdentifier,
|
||||||
|
url: String,
|
||||||
|
thumbUrl: String,
|
||||||
|
thumbMimeType: MimeType? = null,
|
||||||
|
width: Int? = null,
|
||||||
|
height: Int? = null,
|
||||||
|
duration: Int? = null,
|
||||||
|
title: String? = null,
|
||||||
|
entities: List<TextSource>,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
|
inputMessageContent: InputMessageContent? = null
|
||||||
|
) = InlineQueryResultMpeg4GifImpl(id, url, thumbUrl, thumbMimeType, width, height, duration, title, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class InlineQueryResultMpeg4GifImpl(
|
data class InlineQueryResultMpeg4GifImpl internal constructor(
|
||||||
@SerialName(idField)
|
@SerialName(idField)
|
||||||
override val id: InlineQueryIdentifier,
|
override val id: InlineQueryIdentifier,
|
||||||
@SerialName(mpeg4GifUrlField)
|
@SerialName(mpeg4GifUrlField)
|
||||||
@ -30,15 +63,20 @@ data class InlineQueryResultMpeg4GifImpl(
|
|||||||
@SerialName(titleField)
|
@SerialName(titleField)
|
||||||
override val title: String? = null,
|
override val title: String? = null,
|
||||||
@SerialName(captionField)
|
@SerialName(captionField)
|
||||||
override val caption: String? = null,
|
override val text: String? = null,
|
||||||
@SerialName(parseModeField)
|
@SerialName(parseModeField)
|
||||||
override val parseMode: ParseMode? = null,
|
override val parseMode: ParseMode? = null,
|
||||||
|
@SerialName(captionEntitiesField)
|
||||||
|
private val rawEntities: List<RawMessageEntity>? = null,
|
||||||
@SerialName(replyMarkupField)
|
@SerialName(replyMarkupField)
|
||||||
override val replyMarkup: InlineKeyboardMarkup? = null,
|
override val replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
@SerialName(inputMessageContentField)
|
@SerialName(inputMessageContentField)
|
||||||
override val inputMessageContent: InputMessageContent? = null
|
override val inputMessageContent: InputMessageContent? = null
|
||||||
) : InlineQueryResultMpeg4Gif {
|
) : InlineQueryResultMpeg4Gif {
|
||||||
override val type: String = inlineQueryResultMpeg4GifType
|
override val type: String = inlineQueryResultMpeg4GifType
|
||||||
|
override val entities: List<TextSource>? by lazy {
|
||||||
|
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
||||||
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
if (thumbMimeType != null && thumbMimeType !in telegramInlineModeGifPermittedMimeTypes) {
|
if (thumbMimeType != null && thumbMimeType !in telegramInlineModeGifPermittedMimeTypes) {
|
||||||
|
@ -1,18 +1,42 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.*
|
||||||
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.InlineQueries.InlineQueryResult.abstracts.results.photo.InlineQueryResultPhotoCached
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.photo.InlineQueryResultPhotoCached
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.photo.inlineQueryResultPhotoType
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.photo.inlineQueryResultPhotoType
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.RawMessageEntity
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
fun InlineQueryResultPhotoCachedImpl(
|
||||||
|
id: InlineQueryIdentifier,
|
||||||
|
fileId: FileId,
|
||||||
|
title: String? = null,
|
||||||
|
description: String? = null,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
|
inputMessageContent: InputMessageContent? = null
|
||||||
|
) = InlineQueryResultPhotoCachedImpl(id, fileId, title, description, text, parseMode, null, replyMarkup, inputMessageContent)
|
||||||
|
|
||||||
|
fun InlineQueryResultPhotoCachedImpl(
|
||||||
|
id: InlineQueryIdentifier,
|
||||||
|
fileId: FileId,
|
||||||
|
title: String? = null,
|
||||||
|
description: String? = null,
|
||||||
|
entities: List<TextSource>,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
|
inputMessageContent: InputMessageContent? = null
|
||||||
|
) = InlineQueryResultPhotoCachedImpl(id, fileId, title, description, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class InlineQueryResultPhotoCachedImpl(
|
data class InlineQueryResultPhotoCachedImpl internal constructor(
|
||||||
@SerialName(idField)
|
@SerialName(idField)
|
||||||
override val id: InlineQueryIdentifier,
|
override val id: InlineQueryIdentifier,
|
||||||
@SerialName(photoFileIdField)
|
@SerialName(photoFileIdField)
|
||||||
@ -22,13 +46,18 @@ data class InlineQueryResultPhotoCachedImpl(
|
|||||||
@SerialName(descriptionField)
|
@SerialName(descriptionField)
|
||||||
override val description: String? = null,
|
override val description: String? = null,
|
||||||
@SerialName(captionField)
|
@SerialName(captionField)
|
||||||
override val caption: String? = null,
|
override val text: String? = null,
|
||||||
@SerialName(parseModeField)
|
@SerialName(parseModeField)
|
||||||
override val parseMode: ParseMode? = null,
|
override val parseMode: ParseMode? = null,
|
||||||
|
@SerialName(captionEntitiesField)
|
||||||
|
private val rawEntities: List<RawMessageEntity>? = null,
|
||||||
@SerialName(replyMarkupField)
|
@SerialName(replyMarkupField)
|
||||||
override val replyMarkup: InlineKeyboardMarkup? = null,
|
override val replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
@SerialName(inputMessageContentField)
|
@SerialName(inputMessageContentField)
|
||||||
override val inputMessageContent: InputMessageContent? = null
|
override val inputMessageContent: InputMessageContent? = null
|
||||||
) : InlineQueryResultPhotoCached {
|
) : InlineQueryResultPhotoCached {
|
||||||
override val type: String = inlineQueryResultPhotoType
|
override val type: String = inlineQueryResultPhotoType
|
||||||
|
override val entities: List<TextSource>? by lazy {
|
||||||
|
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,17 +1,48 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.*
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.photo.InlineQueryResultPhoto
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.photo.InlineQueryResultPhoto
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.photo.inlineQueryResultPhotoType
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.photo.inlineQueryResultPhotoType
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.RawMessageEntity
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.asTextParts
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
fun InlineQueryResultPhotoImpl(
|
||||||
|
id: InlineQueryIdentifier,
|
||||||
|
url: String,
|
||||||
|
thumbUrl: String,
|
||||||
|
width: Int? = null,
|
||||||
|
height: Int? = null,
|
||||||
|
title: String? = null,
|
||||||
|
description: String? = null,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
|
inputMessageContent: InputMessageContent? = null
|
||||||
|
) = InlineQueryResultPhotoImpl(id, url, thumbUrl, width, height, title, description, text, parseMode, null, replyMarkup, inputMessageContent)
|
||||||
|
|
||||||
|
fun InlineQueryResultPhotoImpl(
|
||||||
|
id: InlineQueryIdentifier,
|
||||||
|
url: String,
|
||||||
|
thumbUrl: String,
|
||||||
|
width: Int? = null,
|
||||||
|
height: Int? = null,
|
||||||
|
title: String? = null,
|
||||||
|
description: String? = null,
|
||||||
|
entities: List<TextSource>,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
|
inputMessageContent: InputMessageContent? = null
|
||||||
|
) = InlineQueryResultPhotoImpl(id, url, thumbUrl, width, height, title, description, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class InlineQueryResultPhotoImpl(
|
data class InlineQueryResultPhotoImpl internal constructor(
|
||||||
@SerialName(idField)
|
@SerialName(idField)
|
||||||
override val id: InlineQueryIdentifier,
|
override val id: InlineQueryIdentifier,
|
||||||
@SerialName(photoUrlField)
|
@SerialName(photoUrlField)
|
||||||
@ -27,13 +58,18 @@ data class InlineQueryResultPhotoImpl(
|
|||||||
@SerialName(descriptionField)
|
@SerialName(descriptionField)
|
||||||
override val description: String? = null,
|
override val description: String? = null,
|
||||||
@SerialName(captionField)
|
@SerialName(captionField)
|
||||||
override val caption: String? = null,
|
override val text: String? = null,
|
||||||
@SerialName(parseModeField)
|
@SerialName(parseModeField)
|
||||||
override val parseMode: ParseMode? = null,
|
override val parseMode: ParseMode? = null,
|
||||||
|
@SerialName(captionEntitiesField)
|
||||||
|
private val rawEntities: List<RawMessageEntity>? = null,
|
||||||
@SerialName(replyMarkupField)
|
@SerialName(replyMarkupField)
|
||||||
override val replyMarkup: InlineKeyboardMarkup? = null,
|
override val replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
@SerialName(inputMessageContentField)
|
@SerialName(inputMessageContentField)
|
||||||
override val inputMessageContent: InputMessageContent? = null
|
override val inputMessageContent: InputMessageContent? = null
|
||||||
) : InlineQueryResultPhoto {
|
) : InlineQueryResultPhoto {
|
||||||
override val type: String = inlineQueryResultPhotoType
|
override val type: String = inlineQueryResultPhotoType
|
||||||
|
override val entities: List<TextSource>? by lazy {
|
||||||
|
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,49 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent
|
package dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.CaptionedOutput
|
import dev.inmo.tgbotapi.CommonAbstracts.*
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.types.DisableWebPagePreview
|
import dev.inmo.tgbotapi.CommonAbstracts.types.DisableWebPagePreview
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.RawMessageEntity
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.asTextParts
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.disableWebPagePreviewField
|
|
||||||
import dev.inmo.tgbotapi.types.messageTextField
|
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents the [InputMessageContent] of a text message to be sent as the result of an inline query.
|
||||||
|
*/
|
||||||
|
fun InputTextMessageContent(
|
||||||
|
text: String,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableWebPagePreview: Boolean? = null
|
||||||
|
) = InputTextMessageContent(text, parseMode, null, disableWebPagePreview)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents the [InputMessageContent] of a text message to be sent as the result of an inline query.
|
||||||
|
*/
|
||||||
|
fun InputTextMessageContent(
|
||||||
|
entities: List<TextSource>,
|
||||||
|
disableWebPagePreview: Boolean? = null
|
||||||
|
) = InputTextMessageContent(entities.makeString(), null, entities.toRawMessageEntities(), disableWebPagePreview)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class InputTextMessageContent(
|
data class InputTextMessageContent internal constructor(
|
||||||
@SerialName(messageTextField)
|
@SerialName(messageTextField)
|
||||||
override val caption: String,
|
override val text: String,
|
||||||
@SerialName(parseModeField)
|
@SerialName(parseModeField)
|
||||||
override val parseMode: ParseMode? = null,
|
override val parseMode: ParseMode? = null,
|
||||||
|
@SerialName(entitiesField)
|
||||||
|
private val rawEntities: List<RawMessageEntity>? = null,
|
||||||
@SerialName(disableWebPagePreviewField)
|
@SerialName(disableWebPagePreviewField)
|
||||||
override val disableWebPagePreview: Boolean? = null
|
override val disableWebPagePreview: Boolean? = null
|
||||||
) : CaptionedOutput, DisableWebPagePreview, InputMessageContent
|
) : CaptionedOutput, TextedOutput, DisableWebPagePreview, InputMessageContent {
|
||||||
|
@Deprecated("Will be removed in next major release")
|
||||||
|
override val caption: String?
|
||||||
|
get() = text
|
||||||
|
override val entities: List<TextSource>? by lazy {
|
||||||
|
rawEntities ?.asTextParts(text) ?.justTextSources()
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user