From a5982ac88123759dc60caf12cb1f272a7719dd6d Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 5 Nov 2020 18:00:40 +0600 Subject: [PATCH] partially restructurize InlineQueryResult and several its implementators --- .../InlineQueryResultVideoCachedImpl.kt | 34 +++++++++++++- .../InlineQueryResultVideoImpl.kt | 44 ++++++++++++++++++- .../InlineQueryResultVoiceCachedImpl.kt | 32 +++++++++++++- .../InlineQueryResultVoiceImpl.kt | 44 ++++++++++++++++++- .../audio/InlineQueryResultAudioCommon.kt | 8 +++- .../InlineQueryResultDocumentCommon.kt | 8 +++- .../results/gif/InlineQueryResultGifCommon.kt | 8 +++- .../InlineQueryResultMpeg4GifCommon.kt | 8 +++- .../photo/InlineQueryResultPhotoCommon.kt | 8 +++- .../video/InlineQueryResultVideoCommon.kt | 8 +++- .../voice/InlineQueryResultVoiceCommon.kt | 8 +++- 11 files changed, 195 insertions(+), 15 deletions(-) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVideoCachedImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVideoCachedImpl.kt index c5368ae68f..3ca7511514 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVideoCachedImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVideoCachedImpl.kt @@ -1,18 +1,43 @@ package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult +import dev.inmo.tgbotapi.CommonAbstracts.* 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 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.toRawMessageEntities import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.ParseMode.parseModeField import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable +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, + entities: List, + replyMarkup: InlineKeyboardMarkup? = null, + inputMessageContent: InputMessageContent? = null +) = InlineQueryResultVideoCachedImpl(id, fileId, title, description, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent) + @Serializable -data class InlineQueryResultVideoCachedImpl( +data class InlineQueryResultVideoCachedImpl internal constructor( @SerialName(idField) override val id: InlineQueryIdentifier, @SerialName(videoFileIdField) @@ -22,13 +47,18 @@ data class InlineQueryResultVideoCachedImpl( @SerialName(descriptionField) override val description: String? = null, @SerialName(captionField) - override val caption: String? = null, + override val text: String? = null, @SerialName(parseModeField) override val parseMode: ParseMode? = null, + @SerialName(captionEntitiesField) + private val rawEntities: List? = null, @SerialName(replyMarkupField) override val replyMarkup: InlineKeyboardMarkup? = null, @SerialName(inputMessageContentField) override val inputMessageContent: InputMessageContent? = null ) : InlineQueryResultVideoCached { override val type: String = inlineQueryResultVideoType + override val entities: List? by lazy { + rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources() + } } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVideoImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVideoImpl.kt index 63ca03891b..2e6262cbec 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVideoImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVideoImpl.kt @@ -1,9 +1,13 @@ package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult +import dev.inmo.tgbotapi.CommonAbstracts.* import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.video.InlineQueryResultVideo import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.video.inlineQueryResultVideoType 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.toRawMessageEntities import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.ParseMode.parseModeField import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup @@ -12,8 +16,39 @@ import dev.inmo.tgbotapi.utils.MimeType import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable +fun InlineQueryResultVideoImpl( + id: InlineQueryIdentifier, + url: String, + thumbUrl: String, + mimeType: MimeType, + title: String, + width: Int? = null, + height: Int? = null, + duration: Int? = null, + description: String? = null, + text: String? = null, + parseMode: ParseMode? = null, + replyMarkup: InlineKeyboardMarkup? = null, + inputMessageContent: InputMessageContent? = null +) = InlineQueryResultVideoImpl(id, url, thumbUrl, mimeType, title, width, height, duration, description, text, parseMode, null, replyMarkup, inputMessageContent) + +fun InlineQueryResultVideoImpl( + id: InlineQueryIdentifier, + url: String, + thumbUrl: String, + mimeType: MimeType, + title: String, + width: Int? = null, + height: Int? = null, + duration: Int? = null, + description: String? = null, + entities: List, + replyMarkup: InlineKeyboardMarkup? = null, + inputMessageContent: InputMessageContent? = null +) = InlineQueryResultVideoImpl(id, url, thumbUrl, mimeType, title, width, height, duration, description, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent) + @Serializable -data class InlineQueryResultVideoImpl( +data class InlineQueryResultVideoImpl internal constructor( @SerialName(idField) override val id: InlineQueryIdentifier, @SerialName(videoUrlField) @@ -33,13 +68,18 @@ data class InlineQueryResultVideoImpl( @SerialName(descriptionField) override val description: String? = null, @SerialName(captionField) - override val caption: String? = null, + override val text: String? = null, @SerialName(parseModeField) override val parseMode: ParseMode? = null, + @SerialName(captionEntitiesField) + private val rawEntities: List? = null, @SerialName(replyMarkupField) override val replyMarkup: InlineKeyboardMarkup? = null, @SerialName(inputMessageContentField) override val inputMessageContent: InputMessageContent? = null ) : InlineQueryResultVideo { override val type: String = inlineQueryResultVideoType + override val entities: List? by lazy { + rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources() + } } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVoiceCachedImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVoiceCachedImpl.kt index e840e1f444..ee2d540148 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVoiceCachedImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVoiceCachedImpl.kt @@ -1,18 +1,41 @@ package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult +import dev.inmo.tgbotapi.CommonAbstracts.* import dev.inmo.tgbotapi.requests.abstracts.FileId import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.voice.InlineQueryResultVoiceCached import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.voice.inlineQueryResultVoiceType 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.parseModeField import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable +fun InlineQueryResultVoiceCachedImpl( + id: InlineQueryIdentifier, + fileId: FileId, + title: String, + text: String? = null, + parseMode: ParseMode? = null, + replyMarkup: InlineKeyboardMarkup? = null, + inputMessageContent: InputMessageContent? = null +) = InlineQueryResultVoiceCachedImpl(id, fileId, title, text, parseMode, null, replyMarkup, inputMessageContent) + +fun InlineQueryResultVoiceCachedImpl( + id: InlineQueryIdentifier, + fileId: FileId, + title: String, + entities: List, + replyMarkup: InlineKeyboardMarkup? = null, + inputMessageContent: InputMessageContent? = null +) = InlineQueryResultVoiceCachedImpl(id, fileId, title, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent) + @Serializable -data class InlineQueryResultVoiceCachedImpl( +data class InlineQueryResultVoiceCachedImpl internal constructor( @SerialName(idField) override val id: InlineQueryIdentifier, @SerialName(voiceFileIdField) @@ -20,13 +43,18 @@ data class InlineQueryResultVoiceCachedImpl( @SerialName(titleField) override val title: String, @SerialName(captionField) - override val caption: String? = null, + override val text: String? = null, @SerialName(parseModeField) override val parseMode: ParseMode? = null, + @SerialName(captionEntitiesField) + private val rawEntities: List? = null, @SerialName(replyMarkupField) override val replyMarkup: InlineKeyboardMarkup? = null, @SerialName(inputMessageContentField) override val inputMessageContent: InputMessageContent? = null ) : InlineQueryResultVoiceCached { override val type: String = inlineQueryResultVoiceType + override val entities: List? by lazy { + rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources() + } } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVoiceImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVoiceImpl.kt index 7a8f85efc6..f507bcc0d9 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVoiceImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVoiceImpl.kt @@ -1,17 +1,52 @@ package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult +import dev.inmo.tgbotapi.CommonAbstracts.* import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.voice.InlineQueryResultVoice import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.voice.inlineQueryResultVoiceType 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.toRawMessageEntities import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.ParseMode.parseModeField import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable +fun InlineQueryResultVoiceImpl( + id: InlineQueryIdentifier, + url: String, + title: String, + duration: Int? = null, + text: String? = null, + parseMode: ParseMode? = null, + replyMarkup: InlineKeyboardMarkup? = null, + inputMessageContent: InputMessageContent? = null +) = InlineQueryResultVoiceImpl( + id, + url, + title, + duration, + text, + parseMode, + null, + replyMarkup, + inputMessageContent +) + +fun InlineQueryResultVoiceImpl( + id: InlineQueryIdentifier, + url: String, + title: String, + duration: Int? = null, + entities: List, + replyMarkup: InlineKeyboardMarkup? = null, + inputMessageContent: InputMessageContent? = null +) = InlineQueryResultVoiceImpl(id, url, title, duration, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent) + @Serializable -data class InlineQueryResultVoiceImpl( +data class InlineQueryResultVoiceImpl internal constructor( @SerialName(idField) override val id: InlineQueryIdentifier, @SerialName(voiceUrlField) @@ -21,13 +56,18 @@ data class InlineQueryResultVoiceImpl( @SerialName(voiceDurationField) override val duration: Int? = null, @SerialName(captionField) - override val caption: String? = null, + override val text: String? = null, @SerialName(parseModeField) override val parseMode: ParseMode? = null, + @SerialName(captionEntitiesField) + private val rawEntities: List? = null, @SerialName(replyMarkupField) override val replyMarkup: InlineKeyboardMarkup? = null, @SerialName(inputMessageContentField) override val inputMessageContent: InputMessageContent? = null ) : InlineQueryResultVoice { override val type: String = inlineQueryResultVoiceType + override val entities: List? by lazy { + rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources() + } } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/results/audio/InlineQueryResultAudioCommon.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/results/audio/InlineQueryResultAudioCommon.kt index 4d044cb2fa..b27d04396d 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/results/audio/InlineQueryResultAudioCommon.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/results/audio/InlineQueryResultAudioCommon.kt @@ -1,6 +1,7 @@ package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.audio import dev.inmo.tgbotapi.CommonAbstracts.CaptionedOutput +import dev.inmo.tgbotapi.CommonAbstracts.TextedOutput import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.WithInputMessageContentInlineQueryResult @@ -8,4 +9,9 @@ const val inlineQueryResultAudioType = "audio" interface InlineQueryResultAudioCommon : InlineQueryResult, CaptionedOutput, - WithInputMessageContentInlineQueryResult + TextedOutput, + WithInputMessageContentInlineQueryResult { + @Deprecated("Will be removed in next major release") + override val caption: String? + get() = text +} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/results/document/InlineQueryResultDocumentCommon.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/results/document/InlineQueryResultDocumentCommon.kt index 6000638253..fa51b3e0e0 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/results/document/InlineQueryResultDocumentCommon.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/results/document/InlineQueryResultDocumentCommon.kt @@ -1,6 +1,7 @@ package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.document import dev.inmo.tgbotapi.CommonAbstracts.CaptionedOutput +import dev.inmo.tgbotapi.CommonAbstracts.TextedOutput import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.* const val inlineQueryResultDocumentType = "document" @@ -9,4 +10,9 @@ interface InlineQueryResultDocumentCommon : InlineQueryResult, TitledInlineQueryResult, DescribedInlineQueryResult, CaptionedOutput, - WithInputMessageContentInlineQueryResult + TextedOutput, + WithInputMessageContentInlineQueryResult { + @Deprecated("Will be removed in next major release") + override val caption: String? + get() = text +} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/results/gif/InlineQueryResultGifCommon.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/results/gif/InlineQueryResultGifCommon.kt index 6c64ec21b0..95e5f14480 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/results/gif/InlineQueryResultGifCommon.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/results/gif/InlineQueryResultGifCommon.kt @@ -1,6 +1,7 @@ package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.gif import dev.inmo.tgbotapi.CommonAbstracts.CaptionedOutput +import dev.inmo.tgbotapi.CommonAbstracts.TextedOutput import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.* const val inlineQueryResultGifType = "gif" @@ -8,4 +9,9 @@ const val inlineQueryResultGifType = "gif" interface InlineQueryResultGifCommon : InlineQueryResult, OptionallyTitledInlineQueryResult, CaptionedOutput, - WithInputMessageContentInlineQueryResult + TextedOutput, + WithInputMessageContentInlineQueryResult { + @Deprecated("Will be removed in next major release") + override val caption: String? + get() = text +} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/results/mpeg4gif/InlineQueryResultMpeg4GifCommon.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/results/mpeg4gif/InlineQueryResultMpeg4GifCommon.kt index f8649eb7b8..69b4e5b88c 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/results/mpeg4gif/InlineQueryResultMpeg4GifCommon.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/results/mpeg4gif/InlineQueryResultMpeg4GifCommon.kt @@ -1,6 +1,7 @@ package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.mpeg4gif import dev.inmo.tgbotapi.CommonAbstracts.CaptionedOutput +import dev.inmo.tgbotapi.CommonAbstracts.TextedOutput import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.* const val inlineQueryResultMpeg4GifType = "mpeg4_gif" @@ -8,4 +9,9 @@ const val inlineQueryResultMpeg4GifType = "mpeg4_gif" interface InlineQueryResultMpeg4GifCommon : InlineQueryResult, OptionallyTitledInlineQueryResult, CaptionedOutput, - WithInputMessageContentInlineQueryResult + TextedOutput, + WithInputMessageContentInlineQueryResult { + @Deprecated("Will be removed in next major release") + override val caption: String? + get() = text +} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/results/photo/InlineQueryResultPhotoCommon.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/results/photo/InlineQueryResultPhotoCommon.kt index b65989092d..1f33a3a9b9 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/results/photo/InlineQueryResultPhotoCommon.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/results/photo/InlineQueryResultPhotoCommon.kt @@ -1,6 +1,7 @@ package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.photo import dev.inmo.tgbotapi.CommonAbstracts.CaptionedOutput +import dev.inmo.tgbotapi.CommonAbstracts.TextedOutput import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.* const val inlineQueryResultPhotoType = "photo" @@ -9,4 +10,9 @@ interface InlineQueryResultPhotoCommon : InlineQueryResult, OptionallyTitledInlineQueryResult, DescribedInlineQueryResult, CaptionedOutput, - WithInputMessageContentInlineQueryResult + TextedOutput, + WithInputMessageContentInlineQueryResult { + @Deprecated("Will be removed in next major release") + override val caption: String? + get() = text +} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/results/video/InlineQueryResultVideoCommon.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/results/video/InlineQueryResultVideoCommon.kt index a82aecbd03..a015faac61 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/results/video/InlineQueryResultVideoCommon.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/results/video/InlineQueryResultVideoCommon.kt @@ -1,6 +1,7 @@ package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.video import dev.inmo.tgbotapi.CommonAbstracts.CaptionedOutput +import dev.inmo.tgbotapi.CommonAbstracts.TextedOutput import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.* const val inlineQueryResultVideoType = "video" @@ -9,4 +10,9 @@ interface InlineQueryResultVideoCommon : InlineQueryResult, TitledInlineQueryResult, DescribedInlineQueryResult, CaptionedOutput, - WithInputMessageContentInlineQueryResult + TextedOutput, + WithInputMessageContentInlineQueryResult { + @Deprecated("Will be removed in next major release") + override val caption: String? + get() = text +} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/results/voice/InlineQueryResultVoiceCommon.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/results/voice/InlineQueryResultVoiceCommon.kt index 8ff23d5ea3..0bb3dee55b 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/results/voice/InlineQueryResultVoiceCommon.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/results/voice/InlineQueryResultVoiceCommon.kt @@ -1,11 +1,17 @@ package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.voice import dev.inmo.tgbotapi.CommonAbstracts.CaptionedOutput +import dev.inmo.tgbotapi.CommonAbstracts.TextedOutput import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.* const val inlineQueryResultVoiceType = "voice" interface InlineQueryResultVoiceCommon : InlineQueryResult, CaptionedOutput, + TextedOutput, WithInputMessageContentInlineQueryResult, - TitledInlineQueryResult + TitledInlineQueryResult { + @Deprecated("Will be removed in next major release") + override val caption: String? + get() = text +}