diff --git a/.github/write-good.yml b/.github/write-good.yml deleted file mode 100644 index 3edb5151f9..0000000000 --- a/.github/write-good.yml +++ /dev/null @@ -1 +0,0 @@ -spellchecker: true diff --git a/docs/build.gradle b/docs/build.gradle index d543950490..babb90dfde 100644 --- a/docs/build.gradle +++ b/docs/build.gradle @@ -26,7 +26,7 @@ repositories { kotlin { jvm() - js(BOTH) { + js(IR) { browser() nodejs() } diff --git a/tgbotapi.core/build.gradle b/tgbotapi.core/build.gradle index 5c01929c53..1948d03bc0 100644 --- a/tgbotapi.core/build.gradle +++ b/tgbotapi.core/build.gradle @@ -29,10 +29,8 @@ repositories { } kotlin { - jvm { - compilations.main.kotlinOptions.useIR = true - } - js(BOTH) { + jvm() + js(IR) { browser() nodejs() } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/CommonAbstracts/TextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/CommonAbstracts/TextSource.kt index e91b6ff18c..2f5e3a38e9 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/CommonAbstracts/TextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/CommonAbstracts/TextSource.kt @@ -4,12 +4,12 @@ import dev.inmo.tgbotapi.types.MessageEntity.textsources.* import dev.inmo.tgbotapi.types.MessageEntity.textsources.MultilevelTextSource import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList -import dev.inmo.tgbotapi.types.captionLength -import dev.inmo.tgbotapi.types.textLength +import dev.inmo.tgbotapi.types.MessageEntity.textsources.makeString import dev.inmo.tgbotapi.types.MessageEntity.textsources.separateForCaption import dev.inmo.tgbotapi.types.MessageEntity.textsources.separateForMessage import dev.inmo.tgbotapi.types.MessageEntity.textsources.separateForText -import dev.inmo.tgbotapi.types.MessageEntity.textsources.makeString +import dev.inmo.tgbotapi.types.captionLength +import dev.inmo.tgbotapi.types.textLength const val DirectInvocationOfTextSourceConstructor = "It is strongly not recommended to use constructors directly instead of factory methods" @@ -30,7 +30,7 @@ inline operator fun dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource @Suppress("NOTHING_TO_INLINE") @Deprecated("Replaced", ReplaceWith("plus", "dev.inmo.tgbotapi.types.MessageEntity.textsources.plus")) -inline operator fun dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource.plus(other: List) = +inline operator fun dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource.plus(other: List) = listOf(this) + other @Suppress("NOTHING_TO_INLINE") @@ -40,7 +40,7 @@ inline operator fun dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource @Suppress("NOTHING_TO_INLINE") @Deprecated("Replaced", ReplaceWith("plus", "dev.inmo.tgbotapi.types.MessageEntity.textsources.plus")) -inline operator fun List.plus(text: String) = this + regular(text) +inline operator fun List.plus(text: String) = this + regular(text) @Deprecated( "Replaced", @@ -49,13 +49,13 @@ inline operator fun List.makeString() = makeString() +fun List.makeString() = makeString() @Deprecated( "Replaced", ReplaceWith("separateForMessage", "dev.inmo.tgbotapi.types.MessageEntity.textsources.separateForMessage") ) -fun List.separateForMessage(limit: IntRange, numberOfParts: Int? = null) = +fun List.separateForMessage(limit: IntRange, numberOfParts: Int? = null) = separateForMessage(limit, numberOfParts) /** diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/CommonAbstracts/Texted.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/CommonAbstracts/Texted.kt index f1f7dec69b..d2348af1ac 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/CommonAbstracts/Texted.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/CommonAbstracts/Texted.kt @@ -8,9 +8,9 @@ interface Texted { } interface TextedWithTextSources : Texted { /** - * Full list of [TextSource] built from source[TextedInput.textEntities] + * Full list of [TextSource]s */ - val textSources: List? + val textSources: List? } interface ParsableOutput : Texted { @@ -18,7 +18,7 @@ interface ParsableOutput : Texted { } interface EntitiesOutput : TextedWithTextSources { - val entities: List? + val entities: List? get() = textSources } @@ -26,11 +26,4 @@ interface TextedOutput : ParsableOutput, EntitiesOutput interface TextedInput : TextedWithTextSources { override val textSources: List - /** - * Here must be full list of entities. This list must contains [TextPart]s with - * [dev.inmo.tgbotapi.types.MessageEntity.textsources.RegularTextSource] in case if source text contains parts of - * regular text - */ - val textEntities: List - get() = textSources.toTextParts() } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/StopPoll.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/StopPoll.kt index 307fe0dda2..1d5bfefd72 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/StopPoll.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/StopPoll.kt @@ -6,6 +6,7 @@ import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import dev.inmo.tgbotapi.types.polls.Poll +import dev.inmo.tgbotapi.types.polls.PollSerializer import kotlinx.serialization.* @Serializable @@ -19,7 +20,7 @@ data class StopPoll( ) : MessageAction, SimpleRequest, ReplyMarkup { override fun method(): String = "stopPoll" override val resultDeserializer: DeserializationStrategy - get() = Poll.serializer() + get() = PollSerializer override val requestSerializer: SerializationStrategy<*> get() = serializer() } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/abstracts/InputFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/abstracts/InputFile.kt index 29ba40120d..1a02259ba6 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/abstracts/InputFile.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/abstracts/InputFile.kt @@ -1,5 +1,6 @@ package dev.inmo.tgbotapi.requests.abstracts +import dev.inmo.tgbotapi.utils.RiskFeature import dev.inmo.tgbotapi.utils.StorageFile import kotlinx.serialization.* import kotlinx.serialization.descriptors.* @@ -30,8 +31,8 @@ data class FileId( fun String.toInputFile() = FileId(this) -@Serializer(InputFile::class) -internal object InputFileSerializer : KSerializer { +@RiskFeature +object InputFileSerializer : KSerializer { override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor(FileId::class.toString(), PrimitiveKind.STRING) override fun serialize(encoder: Encoder, value: InputFile) = encoder.encodeString(value.fileId) override fun deserialize(decoder: Decoder): FileId = FileId(decoder.decodeString()) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/answers/AnswerInlineQuery.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/answers/AnswerInlineQuery.kt index c295a99dcc..0971c24ed5 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/answers/AnswerInlineQuery.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/answers/AnswerInlineQuery.kt @@ -4,7 +4,7 @@ import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.serializers.InlineQueryResultSerializer -import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InlineQuery +import dev.inmo.tgbotapi.utils.RiskFeature import kotlinx.serialization.* import kotlinx.serialization.builtins.ListSerializer import kotlinx.serialization.builtins.serializer @@ -26,7 +26,7 @@ data class AnswerInlineQuery( val switchPmText: String? = null, @SerialName(switchPmParameterField) val switchPmParameter: String? = null -): SimpleRequest { +) : SimpleRequest { override fun method(): String = "answerInlineQuery" override val resultDeserializer: DeserializationStrategy get() = Boolean.serializer() @@ -34,7 +34,7 @@ data class AnswerInlineQuery( get() = serializer() } -fun InlineQuery.createAnswer( +fun dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery.createAnswer( results: List = emptyList(), cachedTime: Int? = null, isPersonal: Boolean? = null, @@ -51,6 +51,7 @@ fun InlineQuery.createAnswer( switchPmParameter ) -internal object InlineQueryAnswersResultsSerializer: KSerializer> by ListSerializer( +@RiskFeature +object InlineQueryAnswersResultsSerializer : KSerializer> by ListSerializer( InlineQueryResultSerializer ) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/answers/payments/AnswerShippingQuery.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/answers/payments/AnswerShippingQuery.kt index 468e81a323..9eeae332f3 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/answers/payments/AnswerShippingQuery.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/answers/payments/AnswerShippingQuery.kt @@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.requests.answers.payments.abstracts.AnswerShippingQuery import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.payments.ShippingOption import dev.inmo.tgbotapi.types.payments.ShippingQuery +import dev.inmo.tgbotapi.utils.RiskFeature import kotlinx.serialization.* import kotlinx.serialization.builtins.ListSerializer @@ -21,7 +22,8 @@ data class AnswerShippingQueryOk( get() = serializer() } -internal object ShippingOptionsSerializer : KSerializer> by ListSerializer( +@RiskFeature +object ShippingOptionsSerializer : KSerializer> by ListSerializer( ShippingOption.serializer() ) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/caption/EditChatMessageCaption.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/caption/EditChatMessageCaption.kt index 9a74b6823a..fdc8cc8e55 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/caption/EditChatMessageCaption.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/caption/EditChatMessageCaption.kt @@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.requests.edit.abstracts.* import dev.inmo.tgbotapi.requests.edit.media.MediaContentMessageResultDeserializer import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.MessageEntity.* +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.ParseMode.parseModeField import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup @@ -32,7 +33,7 @@ fun EditChatMessageCaption( fun EditChatMessageCaption( chatId: ChatIdentifier, messageId: MessageIdentifier, - entities: List, + entities: TextSourcesList, replyMarkup: InlineKeyboardMarkup? = null ) = EditChatMessageCaption( chatId, @@ -58,7 +59,7 @@ data class EditChatMessageCaption internal constructor( @SerialName(replyMarkupField) override val replyMarkup: InlineKeyboardMarkup? = null ) : EditChatMessage, EditTextChatMessage, EditReplyMessage { - override val textSources: List? by lazy { + override val textSources: TextSourcesList? by lazy { rawEntities ?.asTextSources(text) } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/caption/EditInlineMessageCaption.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/caption/EditInlineMessageCaption.kt index 1b93d918bc..21a96caf51 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/caption/EditInlineMessageCaption.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/caption/EditInlineMessageCaption.kt @@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.CommonAbstracts.makeString import dev.inmo.tgbotapi.requests.edit.abstracts.* import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.MessageEntity.* +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.ParseMode.parseModeField import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup @@ -24,7 +25,7 @@ fun EditInlineMessageCaption( fun EditInlineMessageCaption( inlineMessageId: InlineMessageIdentifier, - entities: List, + entities: TextSourcesList, replyMarkup: InlineKeyboardMarkup? = null ) = EditInlineMessageCaption( inlineMessageId, @@ -47,7 +48,7 @@ data class EditInlineMessageCaption internal constructor( @SerialName(replyMarkupField) override val replyMarkup: InlineKeyboardMarkup? = null ) : EditInlineMessage, EditTextChatMessage, EditReplyMessage { - override val textSources: List? by lazy { + override val textSources: TextSourcesList? by lazy { rawEntities ?.asTextSources(text) } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/text/EditChatMessageText.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/text/EditChatMessageText.kt index 6f825dc46e..82644f8e4e 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/text/EditChatMessageText.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/text/EditChatMessageText.kt @@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.requests.edit.abstracts.* import dev.inmo.tgbotapi.requests.send.TextContentMessageResultDeserializer import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.MessageEntity.* +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.ParseMode.parseModeField import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup @@ -34,7 +35,7 @@ fun EditChatMessageText( fun EditChatMessageText( chatId: ChatIdentifier, messageId: MessageIdentifier, - entities: List, + entities: TextSourcesList, disableWebPagePreview: Boolean? = null, replyMarkup: InlineKeyboardMarkup? = null ) = EditChatMessageText( @@ -64,7 +65,7 @@ data class EditChatMessageText internal constructor( @SerialName(replyMarkupField) override val replyMarkup: InlineKeyboardMarkup? = null ) : EditChatMessage, EditTextChatMessage, EditReplyMessage, EditDisableWebPagePreviewMessage { - override val textSources: List? by lazy { + override val textSources: TextSourcesList? by lazy { rawEntities ?.asTextSources(text) } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/text/EditInlineMessageText.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/text/EditInlineMessageText.kt index 89c8f1f4f5..2d92305b31 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/text/EditInlineMessageText.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/text/EditInlineMessageText.kt @@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.CommonAbstracts.makeString import dev.inmo.tgbotapi.requests.edit.abstracts.* import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.MessageEntity.* +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.ParseMode.parseModeField import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup @@ -26,7 +27,7 @@ fun EditInlineMessageText( fun EditInlineMessageText( inlineMessageId: InlineMessageIdentifier, - entities: List, + entities: TextSourcesList, disableWebPagePreview: Boolean? = null, replyMarkup: InlineKeyboardMarkup? = null ) = EditInlineMessageText( @@ -53,7 +54,7 @@ data class EditInlineMessageText internal constructor( @SerialName(replyMarkupField) override val replyMarkup: InlineKeyboardMarkup? = null ) : EditInlineMessage, EditTextChatMessage, EditReplyMessage, EditDisableWebPagePreviewMessage { - override val textSources: List? by lazy { + override val textSources: TextSourcesList? by lazy { rawEntities ?.asTextSources(text) } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/games/abstracts/GetGameHighScores.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/games/abstracts/GetGameHighScores.kt index fe7ea58aca..1c68b30ab8 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/games/abstracts/GetGameHighScores.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/games/abstracts/GetGameHighScores.kt @@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.requests.games.abstracts import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest import dev.inmo.tgbotapi.types.UserId import dev.inmo.tgbotapi.types.games.GameHighScore +import dev.inmo.tgbotapi.utils.RiskFeature import kotlinx.serialization.DeserializationStrategy import kotlinx.serialization.KSerializer import kotlinx.serialization.builtins.ListSerializer @@ -15,4 +16,5 @@ interface GetGameHighScores : SimpleRequest> { get() = GameHighScoresSerializer } -internal object GameHighScoresSerializer : KSerializer> by ListSerializer(GameHighScore.serializer()) +@RiskFeature +object GameHighScoresSerializer : KSerializer> by ListSerializer(GameHighScore.serializer()) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/CopyMessage.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/CopyMessage.kt index 7c2484eaa4..61f88c08e3 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/CopyMessage.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/CopyMessage.kt @@ -1,6 +1,7 @@ package dev.inmo.tgbotapi.requests.send -import dev.inmo.tgbotapi.CommonAbstracts.* +import dev.inmo.tgbotapi.CommonAbstracts.TextedOutput +import dev.inmo.tgbotapi.CommonAbstracts.makeString import dev.inmo.tgbotapi.CommonAbstracts.types.MessageAction import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageRequest @@ -28,7 +29,7 @@ fun CopyMessage( fromChatId: ChatIdentifier, toChatId: ChatIdentifier, messageId: MessageIdentifier, - entities: List, + entities: List, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, allowSendingWithoutReply: Boolean? = null, diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendMessage.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendMessage.kt index 6e5b019b13..3449b0bc01 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendMessage.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendMessage.kt @@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.CommonAbstracts.types.DisableWebPagePreview import dev.inmo.tgbotapi.requests.send.abstracts.* import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.MessageEntity.* +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.ParseMode.parseModeField import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup @@ -40,7 +41,7 @@ fun SendTextMessage( fun SendTextMessage( chatId: ChatIdentifier, - entities: List, + entities: TextSourcesList, disableWebPagePreview: Boolean? = null, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, @@ -83,7 +84,7 @@ data class SendTextMessage internal constructor( TextableSendMessageRequest>, DisableWebPagePreview { - override val textSources: List? by lazy { + override val textSources: TextSourcesList? by lazy { rawEntities ?.asTextSources(text) } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendAnimation.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendAnimation.kt index f2d2f7c6a4..cd05c978d3 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendAnimation.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendAnimation.kt @@ -6,6 +6,7 @@ import dev.inmo.tgbotapi.requests.send.abstracts.* import dev.inmo.tgbotapi.requests.send.media.base.* import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.MessageEntity.* +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.ParseMode.parseModeField import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup @@ -65,7 +66,7 @@ fun SendAnimation( chatId: ChatIdentifier, animation: InputFile, thumb: InputFile? = null, - entities: List, + entities: TextSourcesList, duration: Long? = null, width: Int? = null, height: Int? = null, @@ -144,7 +145,7 @@ data class SendAnimationData internal constructor( DuratedSendMessageRequest>, SizedSendMessageRequest> { - override val textSources: List? by lazy { + override val textSources: TextSourcesList? by lazy { rawEntities ?.asTextSources(text ?: return@lazy null) } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendAudio.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendAudio.kt index 44640436ac..ca2040d1f2 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendAudio.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendAudio.kt @@ -1,6 +1,7 @@ package dev.inmo.tgbotapi.requests.send.media -import dev.inmo.tgbotapi.CommonAbstracts.* +import dev.inmo.tgbotapi.CommonAbstracts.Performerable +import dev.inmo.tgbotapi.CommonAbstracts.makeString import dev.inmo.tgbotapi.requests.abstracts.* import dev.inmo.tgbotapi.requests.send.abstracts.* import dev.inmo.tgbotapi.requests.send.media.base.* @@ -66,7 +67,7 @@ fun SendAudio( chatId: ChatIdentifier, audio: InputFile, thumb: InputFile? = null, - entities: List, + entities: List, duration: Long? = null, performer: String? = null, title: String? = null, diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendDocument.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendDocument.kt index d6de45940d..0e17106f28 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendDocument.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendDocument.kt @@ -6,6 +6,7 @@ import dev.inmo.tgbotapi.requests.send.abstracts.* import dev.inmo.tgbotapi.requests.send.media.base.* import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.MessageEntity.* +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.ParseMode.parseModeField import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup @@ -79,7 +80,7 @@ fun SendDocument( chatId: ChatIdentifier, document: InputFile, thumb: InputFile? = null, - entities: List, + entities: TextSourcesList, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, allowSendingWithoutReply: Boolean? = null, @@ -157,7 +158,7 @@ data class SendDocumentData internal constructor( TextableSendMessageRequest>, ThumbedSendMessageRequest> { - override val textSources: List? by lazy { + override val textSources: TextSourcesList? by lazy { rawEntities ?.asTextSources(text ?: return@lazy null) } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendPhoto.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendPhoto.kt index 79dd2aa5c7..a6ad86c385 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendPhoto.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendPhoto.kt @@ -6,6 +6,7 @@ import dev.inmo.tgbotapi.requests.send.abstracts.* import dev.inmo.tgbotapi.requests.send.media.base.* import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.MessageEntity.* +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.ParseMode.parseModeField import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup @@ -47,7 +48,7 @@ fun SendPhoto( fun SendPhoto( chatId: ChatIdentifier, photo: InputFile, - entities: List, + entities: TextSourcesList, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, allowSendingWithoutReply: Boolean? = null, @@ -100,7 +101,7 @@ data class SendPhotoData internal constructor( ReplyingMarkupSendMessageRequest>, TextableSendMessageRequest> { - override val textSources: List? by lazy { + override val textSources: TextSourcesList? by lazy { rawEntities ?.asTextSources(text ?: return@lazy null) } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVideo.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVideo.kt index 327bc141a0..ce0366c437 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVideo.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVideo.kt @@ -6,6 +6,7 @@ import dev.inmo.tgbotapi.requests.send.abstracts.* import dev.inmo.tgbotapi.requests.send.media.base.* import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.MessageEntity.* +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.ParseMode.parseModeField import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup @@ -67,7 +68,7 @@ fun SendVideo( chatId: ChatIdentifier, video: InputFile, thumb: InputFile? = null, - entities: List, + entities: TextSourcesList, duration: Long? = null, width: Int? = null, height: Int? = null, @@ -150,7 +151,7 @@ data class SendVideoData internal constructor( DuratedSendMessageRequest>, SizedSendMessageRequest> { - override val textSources: List? by lazy { + override val textSources: TextSourcesList? by lazy { rawEntities ?.asTextSources(text ?: return@lazy null) } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVoice.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVoice.kt index f154ac84ae..0a951a97e5 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVoice.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVoice.kt @@ -6,6 +6,7 @@ import dev.inmo.tgbotapi.requests.send.abstracts.* import dev.inmo.tgbotapi.requests.send.media.base.* import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.MessageEntity.* +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.ParseMode.parseModeField import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup @@ -56,7 +57,7 @@ fun SendVoice( fun SendVoice( chatId: ChatIdentifier, voice: InputFile, - entities: List, + entities: TextSourcesList, duration: Long? = null, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, @@ -120,7 +121,7 @@ data class SendVoiceData internal constructor( TextableSendMessageRequest>, DuratedSendMessageRequest> { - override val textSources: List? by lazy { + override val textSources: TextSourcesList? by lazy { rawEntities ?.asTextSources(text ?: return@lazy null) } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/polls/SendPoll.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/polls/SendPoll.kt index ea65c9eda9..72bc2cb98a 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/polls/SendPoll.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/polls/SendPoll.kt @@ -1,7 +1,8 @@ package dev.inmo.tgbotapi.requests.send.polls import com.soywiz.klock.DateTime -import dev.inmo.tgbotapi.CommonAbstracts.* +import dev.inmo.tgbotapi.CommonAbstracts.TextedOutput +import dev.inmo.tgbotapi.CommonAbstracts.makeString import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageRequest import dev.inmo.tgbotapi.requests.send.abstracts.SendMessageRequest import dev.inmo.tgbotapi.types.* @@ -268,7 +269,7 @@ fun SendQuizPoll( correctOptionId: Int, isAnonymous: Boolean = true, isClosed: Boolean = false, - entities: List, + entities: List, closeInfo: ScheduledCloseInfo? = null, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatIdentifier.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatIdentifier.kt index 3633593f94..4cbee6bedd 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatIdentifier.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatIdentifier.kt @@ -1,7 +1,9 @@ package dev.inmo.tgbotapi.types import dev.inmo.micro_utils.common.Warning +import dev.inmo.tgbotapi.utils.RiskFeature import kotlinx.serialization.* +import kotlinx.serialization.descriptors.SerialDescriptor import kotlinx.serialization.encoding.Decoder import kotlinx.serialization.encoding.Encoder import kotlinx.serialization.json.JsonPrimitive @@ -52,10 +54,12 @@ data class Username( fun String.toUsername(): Username = Username(this) -@Serializer(ChatIdentifier::class) -internal object ChatIdentifierSerializer : KSerializer { +@RiskFeature +object ChatIdentifierSerializer : KSerializer { + private val internalSerializer = JsonPrimitive.serializer() + override val descriptor: SerialDescriptor = internalSerializer.descriptor override fun deserialize(decoder: Decoder): ChatIdentifier { - val id = JsonPrimitive.serializer().deserialize(decoder) + val id = internalSerializer.deserialize(decoder) return id.longOrNull ?.let { ChatId(it) } ?: id.content.let { @@ -73,4 +77,4 @@ internal object ChatIdentifierSerializer : KSerializer { is Username -> encoder.encodeString(value.username) } } -} \ No newline at end of file +} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatInviteLink.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatInviteLink.kt index fe4bc031e7..945e2b9616 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatInviteLink.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatInviteLink.kt @@ -79,7 +79,6 @@ data class CommonInviteLink( get() = expireDate ?.asDate } -@Serializer(ChatInviteLink::class) object ChatInviteLinkSerializer : KSerializer { override val descriptor: SerialDescriptor get() = RawChatInviteLink.serializer().descriptor diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatMember/MemberChatMemberImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatMember/MemberChatMemberImpl.kt index 35cafb6bd3..3adbac1b3c 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatMember/MemberChatMemberImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatMember/MemberChatMemberImpl.kt @@ -1,7 +1,6 @@ package dev.inmo.tgbotapi.types.ChatMember import dev.inmo.tgbotapi.types.* -import dev.inmo.tgbotapi.types.ChatMember.abstracts.ChatMember import dev.inmo.tgbotapi.types.ChatMember.abstracts.MemberChatMember import kotlinx.serialization.* diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatMember/abstracts/AdministratorChatMember.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatMember/abstracts/AdministratorChatMember.kt index cd05b4e9c9..5751852819 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatMember/abstracts/AdministratorChatMember.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatMember/abstracts/AdministratorChatMember.kt @@ -20,7 +20,6 @@ interface AdministratorChatMember : SpecialRightsChatMember { val customTitle: String? } -@Serializer(AdministratorChatMember::class) @RiskFeature object AdministratorChatMemberSerializer : KSerializer { override val descriptor: SerialDescriptor = ChatMemberSerializer.descriptor diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatMember/abstracts/ChatMember.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatMember/abstracts/ChatMember.kt index e325c7999b..d5c5acfde0 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatMember/abstracts/ChatMember.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatMember/abstracts/ChatMember.kt @@ -17,7 +17,6 @@ sealed interface ChatMember { val user: User } -@Serializer(ChatMember::class) @RiskFeature object ChatMemberSerializer : KSerializer { override val descriptor: SerialDescriptor = JsonObject.serializer().descriptor @@ -27,9 +26,9 @@ object ChatMemberSerializer : KSerializer { return when (json[statusField] ?.jsonPrimitive ?.content ?: error("Status field of chat member must be specified, but incoming json contains next: $json")) { "creator" -> nonstrictJsonFormat.decodeFromJsonElement(CreatorChatMember.serializer(), json) "administrator" -> nonstrictJsonFormat.decodeFromJsonElement(AdministratorChatMemberImpl.serializer(), json) - "member" -> nonstrictJsonFormat.decodeFromJsonElement(MemberChatMember.serializer(), json) + "member" -> nonstrictJsonFormat.decodeFromJsonElement(MemberChatMemberImpl.serializer(), json) "restricted" -> nonstrictJsonFormat.decodeFromJsonElement(RestrictedChatMember.serializer(), json) - "left" -> nonstrictJsonFormat.decodeFromJsonElement(LeftChatMember.serializer(), json) + "left" -> nonstrictJsonFormat.decodeFromJsonElement(LeftChatMemberImpl.serializer(), json) "kicked" -> nonstrictJsonFormat.decodeFromJsonElement(KickedChatMember.serializer(), json) else -> error("Unknown type of chat member in json: $json") } @@ -39,9 +38,9 @@ object ChatMemberSerializer : KSerializer { when (value) { is CreatorChatMember -> CreatorChatMember.serializer() is AdministratorChatMemberImpl -> AdministratorChatMemberImpl.serializer() - is MemberChatMember -> MemberChatMember.serializer() + is MemberChatMember -> MemberChatMemberImpl.serializer() is RestrictedChatMember -> RestrictedChatMember.serializer() - is LeftChatMember -> LeftChatMember.serializer() + is LeftChatMember -> LeftChatMemberImpl.serializer() is KickedChatMember -> KickedChatMember.serializer() } } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultArticle.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultArticle.kt index 85d68f304f..870e3e7fc8 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultArticle.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultArticle.kt @@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.* -import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent +import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -36,4 +36,4 @@ class InlineQueryResultArticle( WithInputMessageContentInlineQueryResult, UrlInlineQueryResult { override val type: String = "article" -} \ No newline at end of file +} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultAudioCachedImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultAudioCachedImpl.kt index 19a1abf34e..2d0c578208 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultAudioCachedImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultAudioCachedImpl.kt @@ -5,8 +5,9 @@ import dev.inmo.tgbotapi.requests.abstracts.FileId 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.inlineQueryResultAudioType -import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent +import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent import dev.inmo.tgbotapi.types.MessageEntity.* +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.ParseMode.parseModeField import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup @@ -25,7 +26,7 @@ fun InlineQueryResultAudioCachedImpl( fun InlineQueryResultAudioCachedImpl( id: InlineQueryIdentifier, fileId: FileId, - entities: List, + entities: TextSourcesList, replyMarkup: InlineKeyboardMarkup? = null, inputMessageContent: InputMessageContent? = null ) = InlineQueryResultAudioCachedImpl(id, fileId, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent) @@ -48,7 +49,7 @@ data class InlineQueryResultAudioCachedImpl internal constructor( override val inputMessageContent: InputMessageContent? = null ) : InlineQueryResultAudioCached { override val type: String = inlineQueryResultAudioType - override val textSources: List? by lazy { + override val textSources: TextSourcesList? by lazy { rawEntities ?.asTextSources(text ?: return@lazy null) } } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultAudioImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultAudioImpl.kt index b9536aa9ea..3ba051f937 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultAudioImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultAudioImpl.kt @@ -4,8 +4,9 @@ import dev.inmo.tgbotapi.CommonAbstracts.makeString 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.inlineQueryResultAudioType -import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent +import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent import dev.inmo.tgbotapi.types.MessageEntity.* +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.ParseMode.parseModeField import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup @@ -30,7 +31,7 @@ fun InlineQueryResultAudioImpl( title: String, performer: String? = null, duration: Int? = null, - entities: List, + entities: TextSourcesList, replyMarkup: InlineKeyboardMarkup? = null, inputMessageContent: InputMessageContent? = null ) = InlineQueryResultAudioImpl(id, url, title, performer, duration, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent) @@ -59,7 +60,7 @@ data class InlineQueryResultAudioImpl internal constructor( override val inputMessageContent: InputMessageContent? = null ) : InlineQueryResultAudio { override val type: String = inlineQueryResultAudioType - override val textSources: List? by lazy { + override val textSources: TextSourcesList? by lazy { rawEntities ?.asTextSources(text ?: return@lazy null) } } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultContact.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultContact.kt index bd929a4862..6403a79c8e 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultContact.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultContact.kt @@ -3,7 +3,7 @@ package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult import dev.inmo.tgbotapi.CommonAbstracts.CommonContactData import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.* -import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent +import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultDocumentCachedImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultDocumentCachedImpl.kt index 65cd621ac6..49fe37fcf9 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultDocumentCachedImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultDocumentCachedImpl.kt @@ -5,8 +5,10 @@ import dev.inmo.tgbotapi.requests.abstracts.FileId 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.inlineQueryResultDocumentType -import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent +import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent import dev.inmo.tgbotapi.types.MessageEntity.* +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.ParseMode.parseModeField import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup @@ -29,7 +31,7 @@ fun InlineQueryResultDocumentCachedImpl( fileId: FileId, title: String, description: String? = null, - entities: List, + entities: TextSourcesList, replyMarkup: InlineKeyboardMarkup? = null, inputMessageContent: InputMessageContent? = null ) = InlineQueryResultDocumentCachedImpl(id, fileId, title, description, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent) @@ -56,7 +58,7 @@ data class InlineQueryResultDocumentCachedImpl internal constructor( override val inputMessageContent: InputMessageContent? = null ) : InlineQueryResultDocumentCached { override val type: String = inlineQueryResultDocumentType - override val textSources: List? by lazy { + override val textSources: TextSourcesList? by lazy { rawEntities ?.asTextSources(text ?: return@lazy null) } } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultDocumentImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultDocumentImpl.kt index c17285846a..62a37d5ffd 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultDocumentImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultDocumentImpl.kt @@ -4,8 +4,9 @@ import dev.inmo.tgbotapi.CommonAbstracts.makeString 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.inlineQueryResultDocumentType -import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent +import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent import dev.inmo.tgbotapi.types.MessageEntity.* +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.ParseMode.parseModeField import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup @@ -38,7 +39,7 @@ fun InlineQueryResultDocumentImpl( thumbWidth: Int? = null, thumbHeight: Int? = null, description: String? = null, - entities: List, + entities: TextSourcesList, replyMarkup: InlineKeyboardMarkup? = null, inputMessageContent: InputMessageContent? = null ) = InlineQueryResultDocumentImpl(id, url, title, mimeType, thumbUrl, thumbWidth, thumbHeight, description, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent) @@ -73,7 +74,7 @@ data class InlineQueryResultDocumentImpl internal constructor( override val inputMessageContent: InputMessageContent? = null ) : InlineQueryResultDocument { override val type: String = inlineQueryResultDocumentType - override val textSources: List? by lazy { + override val textSources: TextSourcesList? by lazy { rawEntities ?.asTextSources(text ?: return@lazy null) } } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultGifCachedImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultGifCachedImpl.kt index b08013b5d8..07a5139df1 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultGifCachedImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultGifCachedImpl.kt @@ -5,8 +5,9 @@ import dev.inmo.tgbotapi.requests.abstracts.FileId 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.inlineQueryResultGifType -import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent +import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent import dev.inmo.tgbotapi.types.MessageEntity.* +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.ParseMode.parseModeField import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup @@ -27,7 +28,7 @@ fun InlineQueryResultGifCachedImpl( id: InlineQueryIdentifier, fileId: FileId, title: String? = null, - entities: List, + entities: TextSourcesList, replyMarkup: InlineKeyboardMarkup? = null, inputMessageContent: InputMessageContent? = null ) = InlineQueryResultGifCachedImpl(id, fileId, title, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent) @@ -52,7 +53,7 @@ data class InlineQueryResultGifCachedImpl internal constructor( override val inputMessageContent: InputMessageContent? = null ) : InlineQueryResultGifCached { override val type: String = inlineQueryResultGifType - override val textSources: List? by lazy { + override val textSources: TextSourcesList? by lazy { rawEntities ?.asTextSources(text ?: return@lazy null) } } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultGifImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultGifImpl.kt index c9fbfd01bf..69e491a43a 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultGifImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultGifImpl.kt @@ -4,8 +4,9 @@ import dev.inmo.tgbotapi.CommonAbstracts.makeString 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.inlineQueryResultGifType -import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent +import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent import dev.inmo.tgbotapi.types.MessageEntity.* +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.ParseMode.parseModeField import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup @@ -37,7 +38,7 @@ fun InlineQueryResultGifImpl( height: Int? = null, duration: Int? = null, title: String? = null, - entities: List, + entities: TextSourcesList, replyMarkup: InlineKeyboardMarkup? = null, inputMessageContent: InputMessageContent? = null ) = InlineQueryResultGifImpl(id, url, thumbUrl, thumbMimeType, width, height, duration, title, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent) @@ -72,7 +73,7 @@ data class InlineQueryResultGifImpl internal constructor( override val inputMessageContent: InputMessageContent? = null ) : InlineQueryResultGif { override val type: String = inlineQueryResultGifType - override val textSources: List? by lazy { + override val textSources: TextSourcesList? by lazy { rawEntities ?.asTextSources(text ?: return@lazy null) } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultLocation.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultLocation.kt index 5b6d19776f..7a7f383371 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultLocation.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultLocation.kt @@ -3,7 +3,7 @@ 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.* -import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent +import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultMpeg4GifCachedImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultMpeg4GifCachedImpl.kt index 9d4b3eaf71..76f9dc7c5e 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultMpeg4GifCachedImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultMpeg4GifCachedImpl.kt @@ -5,8 +5,9 @@ import dev.inmo.tgbotapi.requests.abstracts.FileId 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.inlineQueryResultMpeg4GifType -import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent +import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent import dev.inmo.tgbotapi.types.MessageEntity.* +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.ParseMode.parseModeField import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup @@ -27,7 +28,7 @@ fun InlineQueryResultMpeg4GifCachedImpl( id: InlineQueryIdentifier, fileId: FileId, title: String? = null, - entities: List, + entities: TextSourcesList, replyMarkup: InlineKeyboardMarkup? = null, inputMessageContent: InputMessageContent? = null ) = InlineQueryResultMpeg4GifCachedImpl(id, fileId, title, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent) @@ -52,7 +53,7 @@ data class InlineQueryResultMpeg4GifCachedImpl internal constructor( override val inputMessageContent: InputMessageContent? = null ) : InlineQueryResultMpeg4GifCached { override val type: String = inlineQueryResultMpeg4GifType - override val textSources: List? by lazy { + override val textSources: TextSourcesList? by lazy { rawEntities ?.asTextSources(text ?: return@lazy null) } } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultMpeg4GifImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultMpeg4GifImpl.kt index 7abd6fb13c..b789a849e1 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultMpeg4GifImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultMpeg4GifImpl.kt @@ -4,8 +4,9 @@ import dev.inmo.tgbotapi.CommonAbstracts.makeString 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.inlineQueryResultMpeg4GifType -import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent +import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent import dev.inmo.tgbotapi.types.MessageEntity.* +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.ParseMode.parseModeField import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup @@ -37,7 +38,7 @@ fun InlineQueryResultMpeg4GifImpl( height: Int? = null, duration: Int? = null, title: String? = null, - entities: List, + entities: TextSourcesList, replyMarkup: InlineKeyboardMarkup? = null, inputMessageContent: InputMessageContent? = null ) = InlineQueryResultMpeg4GifImpl(id, url, thumbUrl, thumbMimeType, width, height, duration, title, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent) @@ -72,7 +73,7 @@ data class InlineQueryResultMpeg4GifImpl internal constructor( override val inputMessageContent: InputMessageContent? = null ) : InlineQueryResultMpeg4Gif { override val type: String = inlineQueryResultMpeg4GifType - override val textSources: List? by lazy { + override val textSources: TextSourcesList? by lazy { rawEntities ?.asTextSources(text ?: return@lazy null) } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultPhotoCachedImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultPhotoCachedImpl.kt index 8a55e29fde..b39a025b5c 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultPhotoCachedImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultPhotoCachedImpl.kt @@ -5,8 +5,9 @@ import dev.inmo.tgbotapi.requests.abstracts.FileId 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.inlineQueryResultPhotoType -import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent +import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent import dev.inmo.tgbotapi.types.MessageEntity.* +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.ParseMode.parseModeField import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup @@ -29,7 +30,7 @@ fun InlineQueryResultPhotoCachedImpl( fileId: FileId, title: String? = null, description: String? = null, - entities: List, + entities: TextSourcesList, replyMarkup: InlineKeyboardMarkup? = null, inputMessageContent: InputMessageContent? = null ) = InlineQueryResultPhotoCachedImpl(id, fileId, title, description, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent) @@ -56,7 +57,7 @@ data class InlineQueryResultPhotoCachedImpl internal constructor( override val inputMessageContent: InputMessageContent? = null ) : InlineQueryResultPhotoCached { override val type: String = inlineQueryResultPhotoType - override val textSources: List? by lazy { + override val textSources: TextSourcesList? by lazy { rawEntities ?.asTextSources(text ?: return@lazy null) } } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultPhotoImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultPhotoImpl.kt index fb1443a03e..d3e9c722d2 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultPhotoImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultPhotoImpl.kt @@ -4,8 +4,9 @@ import dev.inmo.tgbotapi.CommonAbstracts.makeString 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.inlineQueryResultPhotoType -import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent +import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent import dev.inmo.tgbotapi.types.MessageEntity.* +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.ParseMode.parseModeField import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup @@ -34,7 +35,7 @@ fun InlineQueryResultPhotoImpl( height: Int? = null, title: String? = null, description: String? = null, - entities: List, + entities: TextSourcesList, replyMarkup: InlineKeyboardMarkup? = null, inputMessageContent: InputMessageContent? = null ) = InlineQueryResultPhotoImpl(id, url, thumbUrl, width, height, title, description, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent) @@ -67,7 +68,7 @@ data class InlineQueryResultPhotoImpl internal constructor( override val inputMessageContent: InputMessageContent? = null ) : InlineQueryResultPhoto { override val type: String = inlineQueryResultPhotoType - override val textSources: List? by lazy { + override val textSources: TextSourcesList? by lazy { rawEntities ?.asTextSources(text ?: return@lazy null) } } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultStickerCached.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultStickerCached.kt index a1defa2d23..936574e4ca 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultStickerCached.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultStickerCached.kt @@ -3,7 +3,7 @@ package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult import dev.inmo.tgbotapi.requests.abstracts.FileId import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.* -import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent +import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVenue.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVenue.kt index e514afb1dd..a3dc134bfd 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVenue.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVenue.kt @@ -4,7 +4,7 @@ import dev.inmo.tgbotapi.CommonAbstracts.CommonVenueData import dev.inmo.tgbotapi.CommonAbstracts.Locationed import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.* -import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent +import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable 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 bc50c0dc02..6b61eee0d3 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 @@ -5,8 +5,9 @@ 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.InlineQueries.InputMessageContent.InputMessageContent import dev.inmo.tgbotapi.types.MessageEntity.* +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.ParseMode.parseModeField import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup @@ -29,7 +30,7 @@ fun InlineQueryResultVideoCachedImpl( fileId: FileId, title: String, description: String? = null, - entities: List, + entities: TextSourcesList, replyMarkup: InlineKeyboardMarkup? = null, inputMessageContent: InputMessageContent? = null ) = InlineQueryResultVideoCachedImpl(id, fileId, title, description, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent) @@ -56,7 +57,7 @@ data class InlineQueryResultVideoCachedImpl internal constructor( override val inputMessageContent: InputMessageContent? = null ) : InlineQueryResultVideoCached { override val type: String = inlineQueryResultVideoType - override val textSources: List? by lazy { + override val textSources: TextSourcesList? by lazy { rawEntities ?.asTextSources(text ?: return@lazy null) } } 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 9677902fb2..478e8590b9 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 @@ -4,8 +4,9 @@ import dev.inmo.tgbotapi.CommonAbstracts.makeString 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.InlineQueries.InputMessageContent.InputMessageContent import dev.inmo.tgbotapi.types.MessageEntity.* +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.ParseMode.parseModeField import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup @@ -40,7 +41,7 @@ fun InlineQueryResultVideoImpl( height: Int? = null, duration: Int? = null, description: String? = null, - entities: List, + 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) @@ -77,7 +78,7 @@ data class InlineQueryResultVideoImpl internal constructor( override val inputMessageContent: InputMessageContent? = null ) : InlineQueryResultVideo { override val type: String = inlineQueryResultVideoType - override val textSources: List? by lazy { + override val textSources: List? by lazy { rawEntities ?.asTextSources(text ?: return@lazy null) } } 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 1d948491cd..52969b6696 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 @@ -5,8 +5,10 @@ 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.InlineQueries.InputMessageContent.InputMessageContent import dev.inmo.tgbotapi.types.MessageEntity.* +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.ParseMode.parseModeField import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup @@ -27,7 +29,7 @@ fun InlineQueryResultVoiceCachedImpl( id: InlineQueryIdentifier, fileId: FileId, title: String, - entities: List, + entities: TextSourcesList, replyMarkup: InlineKeyboardMarkup? = null, inputMessageContent: InputMessageContent? = null ) = InlineQueryResultVoiceCachedImpl(id, fileId, title, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent) @@ -52,7 +54,7 @@ data class InlineQueryResultVoiceCachedImpl internal constructor( override val inputMessageContent: InputMessageContent? = null ) : InlineQueryResultVoiceCached { override val type: String = inlineQueryResultVoiceType - override val textSources: List? by lazy { + override val textSources: TextSourcesList? by lazy { rawEntities ?.asTextSources(text ?: return@lazy null) } } 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 8374fe7996..4239a43126 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 @@ -4,8 +4,10 @@ import dev.inmo.tgbotapi.CommonAbstracts.makeString 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.InlineQueries.InputMessageContent.InputMessageContent import dev.inmo.tgbotapi.types.MessageEntity.* +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.ParseMode.parseModeField import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup @@ -38,7 +40,7 @@ fun InlineQueryResultVoiceImpl( url: String, title: String, duration: Int? = null, - entities: List, + entities: TextSourcesList, replyMarkup: InlineKeyboardMarkup? = null, inputMessageContent: InputMessageContent? = null ) = InlineQueryResultVoiceImpl(id, url, title, duration, entities.makeString(), null, entities.toRawMessageEntities(), replyMarkup, inputMessageContent) @@ -65,7 +67,7 @@ data class InlineQueryResultVoiceImpl internal constructor( override val inputMessageContent: InputMessageContent? = null ) : InlineQueryResultVoice { override val type: String = inlineQueryResultVoiceType - override val textSources: List? by lazy { + override val textSources: TextSourcesList? by lazy { rawEntities ?.asTextSources(text ?: return@lazy null) } } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/WithInputMessageContentInlineQueryResult.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/WithInputMessageContentInlineQueryResult.kt index 3205267932..b3cf50e24f 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/WithInputMessageContentInlineQueryResult.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/WithInputMessageContentInlineQueryResult.kt @@ -1,6 +1,6 @@ package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts -import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent +import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent interface WithInputMessageContentInlineQueryResult : InlineQueryResult { val inputMessageContent: InputMessageContent? diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/serializers/InlineQueryResultSerializer.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/serializers/InlineQueryResultSerializer.kt index 29a852e5fa..cc8d150dba 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/serializers/InlineQueryResultSerializer.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/serializers/InlineQueryResultSerializer.kt @@ -2,13 +2,14 @@ package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.serializers import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.* import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult +import dev.inmo.tgbotapi.utils.RiskFeature import kotlinx.serialization.* import kotlinx.serialization.descriptors.* import kotlinx.serialization.encoding.Decoder import kotlinx.serialization.encoding.Encoder -@Serializer(InlineQueryResult::class) -internal object InlineQueryResultSerializer : KSerializer { +@RiskFeature +object InlineQueryResultSerializer : KSerializer { @InternalSerializationApi override val descriptor: SerialDescriptor = buildSerialDescriptor(InlineQueryResult::class.toString(), PolymorphicKind.OPEN) override fun serialize(encoder: Encoder, value: InlineQueryResult) { @@ -39,4 +40,4 @@ internal object InlineQueryResultSerializer : KSerializer { override fun deserialize(decoder: Decoder): InlineQueryResult { throw TODO() } -} \ No newline at end of file +} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputTextMessageContent.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputTextMessageContent.kt index 6e959bec6b..ef056d4857 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputTextMessageContent.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputTextMessageContent.kt @@ -1,10 +1,11 @@ package dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent -import dev.inmo.tgbotapi.CommonAbstracts.* +import dev.inmo.tgbotapi.CommonAbstracts.TextedOutput import dev.inmo.tgbotapi.CommonAbstracts.types.DisableWebPagePreview import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.MessageEntity.* -import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList +import dev.inmo.tgbotapi.types.MessageEntity.textsources.makeString import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.ParseMode.parseModeField import kotlinx.serialization.SerialName @@ -23,7 +24,7 @@ fun InputTextMessageContent( * Represents the [InputMessageContent] of a text message to be sent as the result of an inline query. */ fun InputTextMessageContent( - entities: List, + entities: TextSourcesList, disableWebPagePreview: Boolean? = null ) = InputTextMessageContent(entities.makeString(), null, entities.toRawMessageEntities(), disableWebPagePreview) @@ -38,7 +39,7 @@ data class InputTextMessageContent internal constructor( @SerialName(disableWebPagePreviewField) override val disableWebPagePreview: Boolean? = null ) : TextedOutput, DisableWebPagePreview, InputMessageContent { - override val textSources: List? by lazy { + override val textSources: TextSourcesList? by lazy { rawEntities ?.asTextSources(text) } } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InputMessageContentSerializer.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InputMessageContentSerializer.kt index 39052ffbc4..815272fb5a 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InputMessageContentSerializer.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InputMessageContentSerializer.kt @@ -1,14 +1,14 @@ package dev.inmo.tgbotapi.types.InlineQueries import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.* -import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent +import dev.inmo.tgbotapi.utils.RiskFeature import kotlinx.serialization.* import kotlinx.serialization.descriptors.* import kotlinx.serialization.encoding.Decoder import kotlinx.serialization.encoding.Encoder -@Serializer(InputMessageContent::class) -internal object InputMessageContentSerializer : KSerializer { +@RiskFeature +object InputMessageContentSerializer : KSerializer { @InternalSerializationApi override val descriptor: SerialDescriptor = buildSerialDescriptor(InputMessageContent::class.toString(), PolymorphicKind.OPEN) override fun serialize(encoder: Encoder, value: InputMessageContent) { diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InputMedia/InputMediaAnimation.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InputMedia/InputMediaAnimation.kt index 093545046d..4f64b24563 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InputMedia/InputMediaAnimation.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InputMedia/InputMediaAnimation.kt @@ -1,11 +1,13 @@ package dev.inmo.tgbotapi.types.InputMedia -import dev.inmo.tgbotapi.CommonAbstracts.* +import dev.inmo.tgbotapi.CommonAbstracts.TextedOutput +import dev.inmo.tgbotapi.CommonAbstracts.makeString import dev.inmo.tgbotapi.requests.abstracts.InputFile import dev.inmo.tgbotapi.requests.abstracts.fileIdToSend import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.MessageEntity.* import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.ParseMode.parseModeField import kotlinx.serialization.SerialName @@ -23,7 +25,7 @@ fun InputMediaAnimation( fun InputMediaAnimation( file: InputFile, - entities: List, + entities: TextSourcesList, width: Int? = null, height: Int? = null, duration: Long? = null, @@ -45,7 +47,7 @@ data class InputMediaAnimation internal constructor( override val thumb: InputFile? = null ) : InputMedia, SizedInputMedia, DuratedInputMedia, ThumbedInputMedia, TextedOutput { override val type: String = "animation" - override val textSources: List? by lazy { + override val textSources: TextSourcesList? by lazy { rawEntities ?.asTextSources(text ?: return@lazy null) } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InputMedia/InputMediaAudio.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InputMedia/InputMediaAudio.kt index 52a432005e..fcd164a2b1 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InputMedia/InputMediaAudio.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InputMedia/InputMediaAudio.kt @@ -15,7 +15,7 @@ internal const val audioInputMediaType = "audio" fun InputMediaAudio( file: InputFile, - entities: List, + entities: TextSourcesList, duration: Long? = null, performer: String? = null, title: String? = null, @@ -51,7 +51,7 @@ data class InputMediaAudio internal constructor( override val thumb: InputFile? = null ) : InputMedia, AudioMediaGroupMemberInputMedia, DuratedInputMedia, ThumbedInputMedia, TitledInputMedia, Performerable { override val type: String = audioInputMediaType - override val textSources: List? by lazy { + override val textSources: TextSourcesList? by lazy { rawEntities ?.asTextSources(text ?: return@lazy null) } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InputMedia/InputMediaDocument.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InputMedia/InputMediaDocument.kt index ea8410de98..3da2e9bb7c 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InputMedia/InputMediaDocument.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InputMedia/InputMediaDocument.kt @@ -1,10 +1,11 @@ package dev.inmo.tgbotapi.types.InputMedia -import dev.inmo.tgbotapi.CommonAbstracts.* +import dev.inmo.tgbotapi.CommonAbstracts.makeString import dev.inmo.tgbotapi.requests.abstracts.* import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.MessageEntity.* import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.ParseMode.parseModeField import dev.inmo.tgbotapi.types.files.DocumentFile @@ -22,7 +23,7 @@ fun InputMediaDocument( fun InputMediaDocument( file: InputFile, - entities: List, + entities: TextSourcesList, thumb: InputFile? = null, disableContentTypeDetection: Boolean? = null ) = InputMediaDocument(file, entities.makeString(), null, entities.toRawMessageEntities(), thumb, disableContentTypeDetection) @@ -51,7 +52,7 @@ data class InputMediaDocument internal constructor( val disableContentTypeDetection: Boolean? = null ) : InputMedia, DocumentMediaGroupMemberInputMedia, ThumbedInputMedia { override val type: String = documentInputMediaType - override val textSources: List? by lazy { + override val textSources: TextSourcesList? by lazy { rawEntities ?.asTextSources(text ?: return@lazy null) } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InputMedia/InputMediaPhoto.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InputMedia/InputMediaPhoto.kt index 1f80d4260c..c6c6f671ac 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InputMedia/InputMediaPhoto.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InputMedia/InputMediaPhoto.kt @@ -1,11 +1,12 @@ package dev.inmo.tgbotapi.types.InputMedia -import dev.inmo.tgbotapi.CommonAbstracts.* +import dev.inmo.tgbotapi.CommonAbstracts.makeString import dev.inmo.tgbotapi.requests.abstracts.InputFile import dev.inmo.tgbotapi.requests.abstracts.fileIdToSend import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.MessageEntity.* import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.ParseMode.parseModeField import dev.inmo.tgbotapi.types.files.PhotoSize @@ -21,7 +22,7 @@ fun InputMediaPhoto( fun InputMediaPhoto( file: InputFile, - entities: List + entities: TextSourcesList ) = InputMediaPhoto(file, entities.makeString(), null, entities.toRawMessageEntities()) @Serializable @@ -35,7 +36,7 @@ data class InputMediaPhoto internal constructor( private val rawEntities: List? = null ) : InputMedia, VisualMediaGroupMemberInputMedia { override val type: String = photoInputMediaType - override val textSources: List? by lazy { + override val textSources: TextSourcesList? by lazy { rawEntities ?.asTextSources(text ?: return@lazy null) } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InputMedia/InputMediaSerializer.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InputMedia/InputMediaSerializer.kt index 1d29dbb037..a5358762e1 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InputMedia/InputMediaSerializer.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InputMedia/InputMediaSerializer.kt @@ -1,12 +1,13 @@ package dev.inmo.tgbotapi.types.InputMedia +import dev.inmo.tgbotapi.utils.RiskFeature import kotlinx.serialization.* import kotlinx.serialization.descriptors.* import kotlinx.serialization.encoding.Decoder import kotlinx.serialization.encoding.Encoder -@Serializer(InputMedia::class) -internal object InputMediaSerializer : KSerializer { +@RiskFeature +object InputMediaSerializer : KSerializer { @InternalSerializationApi override val descriptor: SerialDescriptor = buildSerialDescriptor(InputMedia::class.toString(), PolymorphicKind.OPEN) override fun serialize(encoder: Encoder, value: InputMedia) { diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InputMedia/InputMediaVideo.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InputMedia/InputMediaVideo.kt index 3a8355a486..fbe67ad528 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InputMedia/InputMediaVideo.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InputMedia/InputMediaVideo.kt @@ -5,6 +5,8 @@ import dev.inmo.tgbotapi.requests.abstracts.InputFile import dev.inmo.tgbotapi.requests.abstracts.fileIdToSend import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.MessageEntity.* +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.ParseMode.parseModeField import kotlinx.serialization.* @@ -23,7 +25,7 @@ fun InputMediaVideo( fun InputMediaVideo( file: InputFile, - entities: List, + entities: TextSourcesList, width: Int? = null, height: Int? = null, duration: Long? = null, @@ -45,7 +47,7 @@ data class InputMediaVideo internal constructor ( override val thumb: InputFile? = null ) : InputMedia, SizedInputMedia, DuratedInputMedia, ThumbedInputMedia, VisualMediaGroupMemberInputMedia { override val type: String = videoInputMediaType - override val textSources: List? by lazy { + override val textSources: TextSourcesList? by lazy { rawEntities ?.asTextSources(text ?: return@lazy null) } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InputMedia/MediaGroupMemberInputMediaSerializer.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InputMedia/MediaGroupMemberInputMediaSerializer.kt index 2933aa558b..2777e576f0 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InputMedia/MediaGroupMemberInputMediaSerializer.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InputMedia/MediaGroupMemberInputMediaSerializer.kt @@ -1,6 +1,7 @@ package dev.inmo.tgbotapi.types.InputMedia import dev.inmo.tgbotapi.types.typeField +import dev.inmo.tgbotapi.utils.RiskFeature import dev.inmo.tgbotapi.utils.nonstrictJsonFormat import kotlinx.serialization.* import kotlinx.serialization.descriptors.* @@ -8,8 +9,8 @@ import kotlinx.serialization.encoding.Decoder import kotlinx.serialization.encoding.Encoder import kotlinx.serialization.json.* -@Serializer(MediaGroupMemberInputMedia::class) -internal object MediaGroupMemberInputMediaSerializer : KSerializer { +@RiskFeature +object MediaGroupMemberInputMediaSerializer : KSerializer { @InternalSerializationApi override val descriptor: SerialDescriptor = buildSerialDescriptor(MediaGroupMemberInputMedia::class.toString(), PolymorphicKind.OPEN) override fun serialize(encoder: Encoder, value: MediaGroupMemberInputMedia) { @@ -32,4 +33,4 @@ internal object MediaGroupMemberInputMediaSerializer : KSerializer error("Illegal type of incoming MediaGroupMemberInputMedia") } } -} \ No newline at end of file +} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/RawMessageEntity.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/RawMessageEntity.kt index f4572c11c7..577e378c72 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/RawMessageEntity.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/RawMessageEntity.kt @@ -1,6 +1,5 @@ package dev.inmo.tgbotapi.types.MessageEntity -import dev.inmo.tgbotapi.CommonAbstracts.MultilevelTextSource import dev.inmo.tgbotapi.types.MessageEntity.textsources.* import dev.inmo.tgbotapi.types.User import kotlinx.serialization.Serializable @@ -21,8 +20,8 @@ internal data class RawMessageEntity( internal fun RawMessageEntity.asTextSource( source: String, - subParts: List -): dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource { + subParts: TextSourcesList +): TextSource { val sourceSubstring: String = source.substring(range) val subPartsWithRegulars by lazy { subParts.fillWithRegulars(sourceSubstring) @@ -58,9 +57,9 @@ private inline operator fun > ClosedRange.contains(other: C return start <= other.start && endInclusive >= other.endInclusive } -internal fun List.fillWithRegulars(source: String): List { +internal fun TextSourcesList.fillWithRegulars(source: String): TextSourcesList { var index = 0 - val result = mutableListOf() + val result = mutableListOf() for (i in 0 until size) { val textSource = get(i) val thisSourceInStart = source.startsWith(textSource.source, index) @@ -83,9 +82,9 @@ internal fun List. private fun createTextSources( originalFullString: String, entities: RawMessageEntities -): List { +): TextSourcesList { val mutableEntities = entities.toMutableList().apply { sortBy { it.offset } } - val resultList = mutableListOf() + val resultList = mutableListOf() while (mutableEntities.isNotEmpty()) { var parent = mutableEntities.removeFirst() @@ -139,7 +138,7 @@ private fun createTextSources( return resultList } -internal fun dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource.toRawMessageEntities(offset: Int = 0): List { +internal fun TextSource.toRawMessageEntities(offset: Int = 0): List { val source = source val length = source.length return listOfNotNull( @@ -169,7 +168,7 @@ internal fun dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource.toRawM } -internal fun List.toRawMessageEntities(preOffset: Int = 0): List { +internal fun TextSourcesList.toRawMessageEntities(preOffset: Int = 0): List { var i = preOffset return flatMap { textSource -> textSource.toRawMessageEntities(i).also { @@ -184,9 +183,9 @@ fun String.removeLeading(word: String) = if (startsWith(word)) { this } -internal fun List.toRawMessageEntities(): List = toRawMessageEntities(0) +internal fun TextSourcesList.toRawMessageEntities(): List = toRawMessageEntities(0) -internal fun RawMessageEntities.asTextSources(sourceString: String): List = +internal fun RawMessageEntities.asTextSources(sourceString: String): TextSourcesList = createTextSources(sourceString, this).fillWithRegulars(sourceString) internal typealias RawMessageEntities = List diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/BoldTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/BoldTextSource.kt index 2b1ea32e05..40c5a53b3b 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/BoldTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/BoldTextSource.kt @@ -10,7 +10,7 @@ import kotlinx.serialization.Serializable @Serializable data class BoldTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor ( override val source: String, - override val subsources: List + override val subsources: TextSourcesList ) : MultilevelTextSource { override val markdown: String by lazy { source.boldMarkdown() } override val markdownV2: String by lazy { boldMarkdownV2() } @@ -18,7 +18,7 @@ data class BoldTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) } @Suppress("NOTHING_TO_INLINE") -inline fun bold(parts: List) = BoldTextSource(parts.makeString(), parts) +inline fun bold(parts: TextSourcesList) = BoldTextSource(parts.makeString(), parts) @Suppress("NOTHING_TO_INLINE") inline fun bold(vararg parts: TextSource) = bold(parts.toList()) @Suppress("NOTHING_TO_INLINE") diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/CashTagTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/CashTagTextSource.kt index de6f10874f..9e07f371d9 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/CashTagTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/CashTagTextSource.kt @@ -10,7 +10,7 @@ import kotlinx.serialization.Serializable @Serializable data class CashTagTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor ( override val source: String, - override val subsources: List + override val subsources: TextSourcesList ) : MultilevelTextSource { override val markdown: String by lazy { source.cashTagMarkdown() } override val markdownV2: String by lazy { cashTagMarkdownV2() } @@ -18,7 +18,7 @@ data class CashTagTextSource @RiskFeature(DirectInvocationOfTextSourceConstructo } @Suppress("NOTHING_TO_INLINE") -inline fun cashTag(parts: List) = CashTagTextSource(parts.makeString(), parts) +inline fun cashTag(parts: TextSourcesList) = CashTagTextSource(parts.makeString(), parts) @Suppress("NOTHING_TO_INLINE") inline fun cashTag(vararg parts: TextSource) = cashTag(parts.toList()) @Suppress("NOTHING_TO_INLINE") diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/EMailTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/EMailTextSource.kt index dd45431454..0e99978665 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/EMailTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/EMailTextSource.kt @@ -10,7 +10,7 @@ import kotlinx.serialization.Serializable @Serializable data class EMailTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor ( override val source: String, - override val subsources: List + override val subsources: TextSourcesList ) : MultilevelTextSource { override val markdown: String by lazy { source.emailMarkdown() } override val markdownV2: String by lazy { emailMarkdownV2(source) } @@ -18,7 +18,7 @@ data class EMailTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) } @Suppress("NOTHING_TO_INLINE") -inline fun email(parts: List) = EMailTextSource(parts.makeString(), parts) +inline fun email(parts: TextSourcesList) = EMailTextSource(parts.makeString(), parts) @Suppress("NOTHING_TO_INLINE") inline fun email(vararg parts: TextSource) = email(parts.toList()) @Suppress("NOTHING_TO_INLINE") diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/HashTagTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/HashTagTextSource.kt index ffcc885cb1..2138cd9485 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/HashTagTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/HashTagTextSource.kt @@ -10,7 +10,7 @@ import kotlinx.serialization.Serializable @Serializable data class HashTagTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor ( override val source: String, - override val subsources: List + override val subsources: TextSourcesList ) : MultilevelTextSource { override val markdown: String by lazy { source.hashTagMarkdown() } override val markdownV2: String by lazy { hashTagMarkdownV2() } @@ -24,7 +24,7 @@ data class HashTagTextSource @RiskFeature(DirectInvocationOfTextSourceConstructo } @Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_API_USAGE") -inline fun hashtag(parts: List) = (regular("#") + parts).let { HashTagTextSource(it.makeString(), it) } +inline fun hashtag(parts: TextSourcesList) = (regular("#") + parts).let { HashTagTextSource(it.makeString(), it) } @Suppress("NOTHING_TO_INLINE") inline fun hashtag(vararg parts: TextSource) = hashtag(parts.toList()) /** diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/ItalicTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/ItalicTextSource.kt index ab5846fb2f..18c3125996 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/ItalicTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/ItalicTextSource.kt @@ -10,7 +10,7 @@ import kotlinx.serialization.Serializable @Serializable data class ItalicTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor ( override val source: String, - override val subsources: List + override val subsources: TextSourcesList ) : MultilevelTextSource { override val markdown: String by lazy { source.italicMarkdown() } override val markdownV2: String by lazy { italicMarkdownV2() } @@ -18,7 +18,7 @@ data class ItalicTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor } @Suppress("NOTHING_TO_INLINE") -inline fun italic(parts: List) = ItalicTextSource(parts.makeString(), parts) +inline fun italic(parts: TextSourcesList) = ItalicTextSource(parts.makeString(), parts) @Suppress("NOTHING_TO_INLINE") inline fun italic(vararg parts: TextSource) = italic(parts.toList()) @Suppress("NOTHING_TO_INLINE") diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/MentionTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/MentionTextSource.kt index 169f9aa784..6c84646821 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/MentionTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/MentionTextSource.kt @@ -17,7 +17,7 @@ private val String.withoutCommercialAt @Serializable data class MentionTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor ( override val source: String, - override val subsources: List + override val subsources: TextSourcesList ) : MultilevelTextSource { override val markdown: String by lazy { source.mentionMarkdown() } override val markdownV2: String by lazy { mentionMarkdownV2() } @@ -31,7 +31,7 @@ data class MentionTextSource @RiskFeature(DirectInvocationOfTextSourceConstructo } @Suppress("NOTHING_TO_INLINE") -inline fun mention(parts: List) = (regular("@") + parts).let { MentionTextSource(it.makeString(), it) } +inline fun mention(parts: TextSourcesList) = (regular("@") + parts).let { MentionTextSource(it.makeString(), it) } @Suppress("NOTHING_TO_INLINE") inline fun mention(vararg parts: TextSource) = mention(parts.toList()) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/PhoneNumberTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/PhoneNumberTextSource.kt index fe329bfac0..67350033eb 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/PhoneNumberTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/PhoneNumberTextSource.kt @@ -10,7 +10,7 @@ import kotlinx.serialization.Serializable @Serializable data class PhoneNumberTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor ( override val source: String, - override val subsources: List + override val subsources: TextSourcesList ) : MultilevelTextSource { override val markdown: String by lazy { source.phoneMarkdown() } override val markdownV2: String by lazy { phoneMarkdownV2() } @@ -18,7 +18,7 @@ data class PhoneNumberTextSource @RiskFeature(DirectInvocationOfTextSourceConstr } @Suppress("NOTHING_TO_INLINE") -inline fun phone(parts: List) = PhoneNumberTextSource(parts.makeString(), parts) +inline fun phone(parts: TextSourcesList) = PhoneNumberTextSource(parts.makeString(), parts) @Suppress("NOTHING_TO_INLINE") inline fun phone(vararg parts: TextSource) = phone(parts.toList()) @Suppress("NOTHING_TO_INLINE") diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/StrikethroughTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/StrikethroughTextSource.kt index 2efea3020b..7965ae799f 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/StrikethroughTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/StrikethroughTextSource.kt @@ -10,7 +10,7 @@ import kotlinx.serialization.Serializable @Serializable data class StrikethroughTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor ( override val source: String, - override val subsources: List + override val subsources: TextSourcesList ) : MultilevelTextSource { override val html: String by lazy { strikethroughHTML() } override val markdownV2: String by lazy { strikethroughMarkdownV2() } @@ -18,7 +18,7 @@ data class StrikethroughTextSource @RiskFeature(DirectInvocationOfTextSourceCons } @Suppress("NOTHING_TO_INLINE") -inline fun strikethrough(parts: List) = StrikethroughTextSource(parts.makeString(), parts) +inline fun strikethrough(parts: TextSourcesList) = StrikethroughTextSource(parts.makeString(), parts) @Suppress("NOTHING_TO_INLINE") inline fun strikethrough(vararg parts: TextSource) = strikethrough(parts.toList()) @Suppress("NOTHING_TO_INLINE") diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/TextMentionTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/TextMentionTextSource.kt index 791ec21d88..7a9e6ad792 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/TextMentionTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/TextMentionTextSource.kt @@ -12,7 +12,7 @@ import kotlinx.serialization.Serializable data class TextMentionTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor ( override val source: String, val user: User, - override val subsources: List + override val subsources: TextSourcesList ) : MultilevelTextSource { override val markdown: String by lazy { source.textMentionMarkdown(user.id) } override val markdownV2: String by lazy { textMentionMarkdownV2(user.id) } @@ -20,17 +20,17 @@ data class TextMentionTextSource @RiskFeature(DirectInvocationOfTextSourceConstr } @Suppress("NOTHING_TO_INLINE") -inline fun mention(parts: List, user: User) = TextMentionTextSource(parts.makeString(), user, parts) +inline fun mention(parts: TextSourcesList, user: User) = TextMentionTextSource(parts.makeString(), user, parts) @Suppress("NOTHING_TO_INLINE") -inline fun User.mention(parts: List) = mention(parts, this) +inline fun User.mention(parts: TextSourcesList) = mention(parts, this) @Suppress("NOTHING_TO_INLINE") -inline fun mention(parts: List, userId: UserId) = mention(parts, CommonUser(userId, "")) +inline fun mention(parts: TextSourcesList, userId: UserId) = mention(parts, CommonUser(userId, "")) @Suppress("NOTHING_TO_INLINE") -inline fun UserId.mention(parts: List) = mention(parts, this) +inline fun UserId.mention(parts: TextSourcesList) = mention(parts, this) @Suppress("NOTHING_TO_INLINE") -inline fun mention(parts: List, id: Identifier) = mention(parts, UserId(id)) +inline fun mention(parts: TextSourcesList, id: Identifier) = mention(parts, UserId(id)) @Suppress("NOTHING_TO_INLINE") -inline fun Identifier.mention(parts: List) = mention(parts, this) +inline fun Identifier.mention(parts: TextSourcesList) = mention(parts, this) @Suppress("NOTHING_TO_INLINE") inline fun mention(user: User, vararg parts: TextSource) = mention(parts.toList(), user) @Suppress("NOTHING_TO_INLINE") diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/TextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/TextSource.kt index e909b2aed3..3ac89386a4 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/TextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/TextSource.kt @@ -7,6 +7,7 @@ import kotlinx.serialization.Serializable const val DirectInvocationOfTextSourceConstructor = "It is strongly not recommended to use constructors directly instead of factory methods" typealias TextSourcesList = List +typealias MutableTextSourcesList = MutableList @Serializable(TextSourceSerializer::class) sealed interface TextSource { diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/UnderlineTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/UnderlineTextSource.kt index 969cda18ad..0a61ab2905 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/UnderlineTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MessageEntity/textsources/UnderlineTextSource.kt @@ -10,7 +10,7 @@ import kotlinx.serialization.Serializable @Serializable data class UnderlineTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor ( override val source: String, - override val subsources: List + override val subsources: TextSourcesList ) : MultilevelTextSource { override val markdown: String by lazy { source.underlineMarkdown() } override val markdownV2: String by lazy { underlineMarkdownV2() } @@ -18,7 +18,7 @@ data class UnderlineTextSource @RiskFeature(DirectInvocationOfTextSourceConstruc } @Suppress("NOTHING_TO_INLINE") -inline fun underline(parts: List) = UnderlineTextSource(parts.makeString(), parts) +inline fun underline(parts: TextSourcesList) = UnderlineTextSource(parts.makeString(), parts) @Suppress("NOTHING_TO_INLINE") inline fun underline(vararg parts: TextSource) = underline(parts.toList()) @Suppress("NOTHING_TO_INLINE") diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ParseMode/ParseMode.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ParseMode/ParseMode.kt index a889a1f1bb..cf2222ddd2 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ParseMode/ParseMode.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ParseMode/ParseMode.kt @@ -1,5 +1,6 @@ package dev.inmo.tgbotapi.types.ParseMode +import dev.inmo.tgbotapi.utils.RiskFeature import kotlinx.serialization.* import kotlinx.serialization.builtins.serializer import kotlinx.serialization.descriptors.SerialDescriptor @@ -45,8 +46,8 @@ typealias HTML = HTMLParseMode */ var defaultParseMode: ParseMode = HTML -@Serializer(ParseMode::class) -internal object ParseModeSerializerObject : KSerializer { +@RiskFeature +object ParseModeSerializerObject : KSerializer { override val descriptor: SerialDescriptor = String.serializer().descriptor override fun deserialize(decoder: Decoder): ParseMode { return when (decoder.decodeString()) { diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/TelegramDate.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/TelegramDate.kt index 0be809987d..8ac8a5c12e 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/TelegramDate.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/TelegramDate.kt @@ -1,9 +1,13 @@ package dev.inmo.tgbotapi.types import com.soywiz.klock.DateTime +import dev.inmo.tgbotapi.utils.RiskFeature import kotlinx.serialization.* +import kotlinx.serialization.builtins.serializer +import kotlinx.serialization.descriptors.SerialDescriptor import kotlinx.serialization.encoding.Decoder import kotlinx.serialization.encoding.Encoder +import kotlinx.serialization.json.JsonPrimitive @Serializable(TelegramDateSerializer::class) data class TelegramDate( @@ -24,8 +28,10 @@ data class TelegramDate( fun DateTime.toTelegramDate(): TelegramDate = TelegramDate(this) -@Serializer(TelegramDate::class) -internal object TelegramDateSerializer : KSerializer { +@RiskFeature +object TelegramDateSerializer : KSerializer { + override val descriptor: SerialDescriptor = Long.serializer().descriptor + override fun serialize(encoder: Encoder, value: TelegramDate) { encoder.encodeLong( value.date diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/User.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/User.kt index bb9707428a..5c7fd10e41 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/User.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/User.kt @@ -2,9 +2,10 @@ package dev.inmo.tgbotapi.types import dev.inmo.tgbotapi.types.chat.abstracts.PrivateChat import dev.inmo.tgbotapi.types.chat.extended.ExtendedPrivateChatImpl -import dev.inmo.tgbotapi.utils.PreviewFeature +import dev.inmo.tgbotapi.utils.* import dev.inmo.tgbotapi.utils.nonstrictJsonFormat import kotlinx.serialization.* +import kotlinx.serialization.descriptors.SerialDescriptor import kotlinx.serialization.encoding.Decoder import kotlinx.serialization.encoding.Encoder import kotlinx.serialization.json.* @@ -68,10 +69,12 @@ data class ExtendedBot( } -@Serializer(User::class) -internal object UserSerializer : KSerializer { +@RiskFeature +object UserSerializer : KSerializer { + private val internalSerializer = JsonObject.serializer() + override val descriptor: SerialDescriptor = internalSerializer.descriptor override fun deserialize(decoder: Decoder): User { - val asJson = JsonObject.serializer().deserialize(decoder) + val asJson = internalSerializer.deserialize(decoder) return when { asJson[isBotField] ?.jsonPrimitive ?.booleanOrNull != true -> nonstrictJsonFormat.decodeFromJsonElement( diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/UserProfilePhotos.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/UserProfilePhotos.kt index 2ccb208d9b..2b677b27e7 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/UserProfilePhotos.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/UserProfilePhotos.kt @@ -2,6 +2,7 @@ package dev.inmo.tgbotapi.types import dev.inmo.tgbotapi.types.files.Photo import dev.inmo.tgbotapi.types.files.PhotoSerializer +import dev.inmo.tgbotapi.utils.RiskFeature import kotlinx.serialization.* import kotlinx.serialization.builtins.ListSerializer @@ -13,6 +14,7 @@ data class UserProfilePhotos ( val photos: List ) -internal object UserProfilePhotosPhotosSerializer : KSerializer> by ListSerializer( +@RiskFeature +object UserProfilePhotosPhotosSerializer : KSerializer> by ListSerializer( PhotoSerializer ) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/actions/BotAction.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/actions/BotAction.kt index 9df136fb8f..a79b14781d 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/actions/BotAction.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/actions/BotAction.kt @@ -14,8 +14,7 @@ sealed interface BotAction { val actionName: String } -@Serializer(BotAction::class) -internal object BotActionSerializer: KSerializer { +object BotActionSerializer: KSerializer { override val descriptor: SerialDescriptor = String.serializer().descriptor override fun serialize(encoder: Encoder, value: BotAction) { diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/InlineKeyboardButtons/InlineKeyboardButtonSerializer.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/InlineKeyboardButtons/InlineKeyboardButtonSerializer.kt index c8a3be6343..20772f4eae 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/InlineKeyboardButtons/InlineKeyboardButtonSerializer.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/InlineKeyboardButtons/InlineKeyboardButtonSerializer.kt @@ -1,6 +1,7 @@ package dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.utils.RiskFeature import dev.inmo.tgbotapi.utils.nonstrictJsonFormat import kotlinx.serialization.InternalSerializationApi import kotlinx.serialization.KSerializer @@ -10,7 +11,8 @@ import kotlinx.serialization.encoding.Encoder import kotlinx.serialization.json.JsonElement import kotlinx.serialization.json.JsonObject -internal object InlineKeyboardButtonSerializer : KSerializer { +@RiskFeature +object InlineKeyboardButtonSerializer : KSerializer { @InternalSerializationApi override val descriptor: SerialDescriptor = buildSerialDescriptor( "dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.InlineKeyboardButton", diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/KeyboardButton.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/KeyboardButton.kt index c7e3016b09..8993a1ab30 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/KeyboardButton.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/KeyboardButton.kt @@ -1,6 +1,7 @@ package dev.inmo.tgbotapi.types.buttons import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.utils.RiskFeature import dev.inmo.tgbotapi.utils.nonstrictJsonFormat import kotlinx.serialization.* import kotlinx.serialization.descriptors.SerialDescriptor @@ -47,8 +48,8 @@ data class RequestPollKeyboardButton( val requestPoll: KeyboardButtonPollType ) : KeyboardButton -@Serializer(KeyboardButton::class) -internal object KeyboardButtonSerializer : KSerializer { +@RiskFeature +object KeyboardButtonSerializer : KSerializer { private val internalSerializer = JsonElement.serializer() override val descriptor: SerialDescriptor = internalSerializer.descriptor diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/KeyboardButtonPollType.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/KeyboardButtonPollType.kt index c3b68fb990..681c44f03f 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/KeyboardButtonPollType.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/KeyboardButtonPollType.kt @@ -1,6 +1,7 @@ package dev.inmo.tgbotapi.types.buttons import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.utils.RiskFeature import kotlinx.serialization.* import kotlinx.serialization.descriptors.SerialDescriptor import kotlinx.serialization.encoding.Decoder @@ -25,8 +26,8 @@ object QuizKeyboardButtonPollType : KeyboardButtonPollType { override val type: String = quizPollType } -@Serializer(KeyboardButtonPollType::class) -internal object KeyboardButtonPollTypeSerializer : KSerializer { +@RiskFeature +object KeyboardButtonPollTypeSerializer : KSerializer { private val internalSerializer = JsonElement.serializer() override val descriptor: SerialDescriptor = internalSerializer.descriptor diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/KeyboardMarkupSerializer.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/KeyboardMarkupSerializer.kt index f30a9a16c1..328d9f61fa 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/KeyboardMarkupSerializer.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/KeyboardMarkupSerializer.kt @@ -1,12 +1,13 @@ package dev.inmo.tgbotapi.types.buttons +import dev.inmo.tgbotapi.utils.RiskFeature import kotlinx.serialization.* import kotlinx.serialization.descriptors.* import kotlinx.serialization.encoding.Decoder import kotlinx.serialization.encoding.Encoder -@Serializer(KeyboardMarkup::class) -internal object KeyboardMarkupSerializer : KSerializer { +@RiskFeature +object KeyboardMarkupSerializer : KSerializer { @InternalSerializationApi override val descriptor: SerialDescriptor = buildSerialDescriptor( KeyboardMarkup::class.toString(), diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ChatSerializers.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ChatSerializers.kt index 56a0c78fb1..e02220a3ad 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ChatSerializers.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ChatSerializers.kt @@ -6,6 +6,7 @@ import dev.inmo.tgbotapi.types.chat.abstracts.UnknownChatType import dev.inmo.tgbotapi.types.chat.abstracts.extended.ExtendedChat import dev.inmo.tgbotapi.types.chat.abstracts.extended.UnknownExtendedChat import dev.inmo.tgbotapi.types.chat.extended.* +import dev.inmo.tgbotapi.utils.RiskFeature import dev.inmo.tgbotapi.utils.nonstrictJsonFormat import kotlinx.serialization.* import kotlinx.serialization.builtins.serializer @@ -39,7 +40,6 @@ val String.asChatType ChatType.ChannelChatType.stringified -> ChatType.ChannelChatType else -> ChatType.UnknownChatType(this) } -@Serializer(ChatType::class) object ChatTypeSerializer : KSerializer { override val descriptor: SerialDescriptor = String.serializer().descriptor override fun deserialize(decoder: Decoder): ChatType { @@ -51,7 +51,8 @@ object ChatTypeSerializer : KSerializer { } } -internal object PreviewChatSerializer : KSerializer { +@RiskFeature +object PreviewChatSerializer : KSerializer { @InternalSerializationApi override val descriptor: SerialDescriptor = buildSerialDescriptor("PreviewChatSerializer", PolymorphicKind.OPEN) @@ -83,7 +84,8 @@ internal object PreviewChatSerializer : KSerializer { } } -internal object ExtendedChatSerializer : KSerializer { +@RiskFeature +object ExtendedChatSerializer : KSerializer { @InternalSerializationApi override val descriptor: SerialDescriptor = buildSerialDescriptor("PreviewChatSerializer", PolymorphicKind.OPEN) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/dice/DiceAnimationType.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/dice/DiceAnimationType.kt index 2d59847d95..8feb10b0f0 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/dice/DiceAnimationType.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/dice/DiceAnimationType.kt @@ -1,6 +1,7 @@ package dev.inmo.tgbotapi.types.dice import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.utils.RiskFeature import kotlinx.serialization.* import kotlinx.serialization.descriptors.* import kotlinx.serialization.encoding.Decoder @@ -55,8 +56,8 @@ data class CustomDiceAnimationType( get() = error("Custom dice animation type have unknown value limits") } -@Serializer(DiceAnimationType::class) -internal object DiceAnimationTypeSerializer : KSerializer { +@RiskFeature +object DiceAnimationTypeSerializer : KSerializer { override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("DiceAnimationType", PrimitiveKind.STRING) override fun deserialize(decoder: Decoder): DiceAnimationType { return when (val type = decoder.decodeString()) { diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/PhotoSize.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/PhotoSize.kt index 07a76c1d4c..78910be5b7 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/PhotoSize.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/PhotoSize.kt @@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.requests.abstracts.FileId import dev.inmo.tgbotapi.types.FileUniqueId import dev.inmo.tgbotapi.types.fileUniqueIdField import dev.inmo.tgbotapi.types.files.abstracts.* +import dev.inmo.tgbotapi.utils.RiskFeature import kotlinx.serialization.* import kotlinx.serialization.builtins.ListSerializer @@ -13,7 +14,8 @@ fun Photo.biggest(): PhotoSize? = maxByOrNull { it.resolution } -internal object PhotoSerializer : KSerializer by ListSerializer( +@RiskFeature +object PhotoSerializer : KSerializer by ListSerializer( PhotoSize.serializer() ) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/VideoFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/VideoFile.kt index 23534ec718..bce88fc7b9 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/VideoFile.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/VideoFile.kt @@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.types.files import dev.inmo.tgbotapi.requests.abstracts.FileId import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.InputMedia.InputMediaVideo +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.files.abstracts.* import dev.inmo.tgbotapi.utils.MimeType diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/games/Game.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/games/Game.kt index c5f0092c64..6cf7fc17b7 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/games/Game.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/games/Game.kt @@ -1,6 +1,7 @@ package dev.inmo.tgbotapi.types.games -import dev.inmo.tgbotapi.CommonAbstracts.* +import dev.inmo.tgbotapi.CommonAbstracts.TextedInput +import dev.inmo.tgbotapi.CommonAbstracts.Titled import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.files.AnimationFile import dev.inmo.tgbotapi.types.files.Photo diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/location/Location.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/location/Location.kt index 7707da1616..b0fcab5fd2 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/location/Location.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/location/Location.kt @@ -39,7 +39,6 @@ data class LiveLocation( override val proximityAlertRadius: Meters? = null ) : Location, Livable, ProximityAlertable, Headed -@Serializer(Location::class) object LocationSerializer : KSerializer { private val internalSerializer = JsonObject.serializer() override val descriptor: SerialDescriptor = internalSerializer.descriptor diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/abstracts/Message.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/abstracts/Message.kt index 3bf616a482..b2c85f828b 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/abstracts/Message.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/abstracts/Message.kt @@ -31,8 +31,6 @@ internal class TelegramBotAPIMessageDeserializationStrategyClass : Deserializ return RawMessage.serializer().deserialize(decoder).asMessage as T } } -internal object TelegramBotAPIMessageDeserializationStrategy - : DeserializationStrategy by TelegramBotAPIMessageDeserializationStrategyClass() internal class TelegramBotAPIMessageDeserializeOnlySerializerClass : KSerializer { private val deserializer = TelegramBotAPIMessageDeserializationStrategyClass() diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/TextContent.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/TextContent.kt index 86bf6e23a6..ad5a3d089c 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/TextContent.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/TextContent.kt @@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.CommonAbstracts.TextedInput import dev.inmo.tgbotapi.requests.abstracts.Request import dev.inmo.tgbotapi.requests.send.SendTextMessage import dev.inmo.tgbotapi.types.ChatIdentifier +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.MessageIdentifier import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/abstracts/MediaGroupContent.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/abstracts/MediaGroupContent.kt index 6d97a72dda..be20aa5ca8 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/abstracts/MediaGroupContent.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/abstracts/MediaGroupContent.kt @@ -1,6 +1,5 @@ package dev.inmo.tgbotapi.types.message.content.abstracts -import dev.inmo.tgbotapi.CommonAbstracts.CaptionedInput import dev.inmo.tgbotapi.CommonAbstracts.TextedInput import dev.inmo.tgbotapi.types.InputMedia.* diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/media/AnimationContent.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/media/AnimationContent.kt index 1d2c5f1e87..96c11864e2 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/media/AnimationContent.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/media/AnimationContent.kt @@ -1,6 +1,6 @@ package dev.inmo.tgbotapi.types.message.content.media -import dev.inmo.tgbotapi.CommonAbstracts.* +import dev.inmo.tgbotapi.CommonAbstracts.TextedInput import dev.inmo.tgbotapi.requests.abstracts.Request import dev.inmo.tgbotapi.requests.send.media.SendAnimation import dev.inmo.tgbotapi.types.ChatIdentifier diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/media/AudioContent.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/media/AudioContent.kt index 394fddcd16..c7d94ddce2 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/media/AudioContent.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/media/AudioContent.kt @@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.requests.send.media.SendAudio import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.InputMedia.InputMediaAudio import dev.inmo.tgbotapi.types.InputMedia.toInputMediaAudio +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.MessageIdentifier import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.files.AudioFile diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/media/VoiceContent.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/media/VoiceContent.kt index c656c2583f..5cae1a9cb5 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/media/VoiceContent.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/media/VoiceContent.kt @@ -1,6 +1,6 @@ package dev.inmo.tgbotapi.types.message.content.media -import dev.inmo.tgbotapi.CommonAbstracts.* +import dev.inmo.tgbotapi.CommonAbstracts.TextedInput import dev.inmo.tgbotapi.requests.abstracts.Request import dev.inmo.tgbotapi.requests.send.media.SendVoice import dev.inmo.tgbotapi.types.ChatIdentifier diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/EncryptedElementSerializer.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/EncryptedElementSerializer.kt index 52cb81f1af..1c83f349c9 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/EncryptedElementSerializer.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/EncryptedElementSerializer.kt @@ -35,7 +35,6 @@ val encryptedElementsClassesByTypes = mapOf( val EncryptedPassportElement.type: String get() = encryptedElementsClassesByTypes.keys.firstOrNull { encryptedElementsClassesByTypes.getValue(it).klass.isInstance(this) } ?: "unknown" -@Serializer(EncryptedPassportElement::class) object EncryptedElementSerializer : KSerializer { private val jsonSerializer = JsonObject.serializer() override val descriptor: SerialDescriptor = jsonSerializer.descriptor diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/payments/ShippingOption.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/payments/ShippingOption.kt index bc62f67c2f..5bb102aeca 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/payments/ShippingOption.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/payments/ShippingOption.kt @@ -2,6 +2,7 @@ package dev.inmo.tgbotapi.types.payments import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.payments.abstracts.Priced +import dev.inmo.tgbotapi.utils.RiskFeature import kotlinx.serialization.* import kotlinx.serialization.builtins.ListSerializer @@ -16,6 +17,7 @@ data class ShippingOption( override val prices: List ) : Priced -internal object LabeledPricesSerializer : KSerializer> by ListSerializer( +@RiskFeature +object LabeledPricesSerializer : KSerializer> by ListSerializer( LabeledPrice.serializer() ) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/polls/Poll.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/polls/Poll.kt index 80b283109e..48535529b6 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/polls/Poll.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/polls/Poll.kt @@ -2,10 +2,11 @@ package dev.inmo.tgbotapi.types.polls import com.soywiz.klock.DateTime import com.soywiz.klock.TimeSpan -import dev.inmo.tgbotapi.CommonAbstracts.* +import dev.inmo.tgbotapi.CommonAbstracts.TextedInput import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.MessageEntity.* import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource +import dev.inmo.tgbotapi.utils.RiskFeature import dev.inmo.tgbotapi.utils.nonstrictJsonFormat import kotlinx.serialization.* import kotlinx.serialization.descriptors.SerialDescriptor @@ -142,8 +143,8 @@ data class QuizPoll( override val scheduledCloseInfo: ScheduledCloseInfo? = null ) : Poll, TextedInput -@Serializer(Poll::class) -internal object PollSerializer : KSerializer { +@RiskFeature +object PollSerializer : KSerializer { override val descriptor: SerialDescriptor get() = RawPoll.serializer().descriptor diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/polls/PollOption.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/polls/PollOption.kt index 2333b63613..0e7ab5d758 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/polls/PollOption.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/polls/PollOption.kt @@ -2,6 +2,7 @@ package dev.inmo.tgbotapi.types.polls import dev.inmo.tgbotapi.types.textField import dev.inmo.tgbotapi.types.votesCountField +import dev.inmo.tgbotapi.utils.RiskFeature import kotlinx.serialization.* import kotlinx.serialization.descriptors.SerialDescriptor import kotlinx.serialization.encoding.Decoder @@ -21,7 +22,8 @@ data class SimplePollOption ( override val votes: Int ) : PollOption() -internal object PollOptionSerializer : KSerializer { +@RiskFeature +object PollOptionSerializer : KSerializer { override val descriptor: SerialDescriptor = SimplePollOption.serializer().descriptor override fun deserialize(decoder: Decoder): PollOption = SimplePollOption.serializer().deserialize( diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/update/InlineQueryUpdate.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/update/InlineQueryUpdate.kt index 10b4e61230..7d46a186f7 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/update/InlineQueryUpdate.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/update/InlineQueryUpdate.kt @@ -1,6 +1,6 @@ package dev.inmo.tgbotapi.types.update -import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InlineQuery +import dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery import dev.inmo.tgbotapi.types.UpdateIdentifier import dev.inmo.tgbotapi.types.update.abstracts.Update diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/update/abstracts/Update.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/update/abstracts/Update.kt index 0ea6f4c49f..a06e2be315 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/update/abstracts/Update.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/update/abstracts/Update.kt @@ -2,6 +2,7 @@ package dev.inmo.tgbotapi.types.update.abstracts import dev.inmo.tgbotapi.types.UpdateIdentifier import dev.inmo.tgbotapi.types.update.RawUpdate +import dev.inmo.tgbotapi.utils.RiskFeature import dev.inmo.tgbotapi.utils.nonstrictJsonFormat import kotlinx.serialization.* import kotlinx.serialization.descriptors.SerialDescriptor @@ -20,7 +21,8 @@ data class UnknownUpdate( val rawJson: JsonElement ) : Update -internal object UpdateSerializerWithoutSerialization : KSerializer { +@RiskFeature +object UpdateSerializerWithoutSerialization : KSerializer { override val descriptor: SerialDescriptor = JsonElement.serializer().descriptor override fun deserialize(decoder: Decoder): Update = UpdateDeserializationStrategy.deserialize(decoder) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/MimeType.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/MimeType.kt index 04ec695668..6864b0fa05 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/MimeType.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/MimeType.kt @@ -19,8 +19,8 @@ fun buildMimeType(raw: String): MimeType = mimesCache.getOrPut(raw) { createMimeType(raw) } -@Serializer(MimeType::class) -internal object MimeTypeSerializer : KSerializer { +@RiskFeature +object MimeTypeSerializer : KSerializer { override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("mimeType", PrimitiveKind.STRING) override fun deserialize(decoder: Decoder): MimeType { diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/internal/MultilevelTextSourceFormatting.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/internal/MultilevelTextSourceFormatting.kt index a74b53a5e9..6160f91965 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/internal/MultilevelTextSourceFormatting.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/internal/MultilevelTextSourceFormatting.kt @@ -1,16 +1,16 @@ package dev.inmo.tgbotapi.utils.internal -import dev.inmo.tgbotapi.CommonAbstracts.MultilevelTextSource +import dev.inmo.tgbotapi.types.MessageEntity.textsources.* import dev.inmo.tgbotapi.types.UserId import dev.inmo.tgbotapi.types.link import dev.inmo.tgbotapi.utils.extensions.escapeMarkdownV2Link import dev.inmo.tgbotapi.utils.extensions.toHtml -private fun List.joinSubSourcesMarkdownV2() = joinToString("") { +private fun TextSourcesList.joinSubSourcesMarkdownV2() = joinToString("") { it.markdownV2 } -private fun List.joinSubSourcesHtml() = joinToString("") { +private fun TextSourcesList.joinSubSourcesHtml() = joinToString("") { it.html } diff --git a/tgbotapi.core/src/commonTest/kotlin/dev/inmo/tgbotapi/types/BotActionTests.kt b/tgbotapi.core/src/commonTest/kotlin/dev/inmo/tgbotapi/types/BotActionTests.kt index 2b308fbf7d..e10fef23e7 100644 --- a/tgbotapi.core/src/commonTest/kotlin/dev/inmo/tgbotapi/types/BotActionTests.kt +++ b/tgbotapi.core/src/commonTest/kotlin/dev/inmo/tgbotapi/types/BotActionTests.kt @@ -9,6 +9,7 @@ import kotlin.test.assertEquals class BotActionTests { @Serializable data class Example( + @Serializable(BotActionSerializer::class) val botAction: BotAction ) diff --git a/tgbotapi.core/src/commonTest/kotlin/dev/inmo/tgbotapi/types/MessageEntity/EntitiesTestText.kt b/tgbotapi.core/src/commonTest/kotlin/dev/inmo/tgbotapi/types/MessageEntity/EntitiesTestText.kt index 7092b31e0f..e0e1e32550 100644 --- a/tgbotapi.core/src/commonTest/kotlin/dev/inmo/tgbotapi/types/MessageEntity/EntitiesTestText.kt +++ b/tgbotapi.core/src/commonTest/kotlin/dev/inmo/tgbotapi/types/MessageEntity/EntitiesTestText.kt @@ -39,7 +39,7 @@ internal val testTextEntities = listOf( ) ) -fun List.testTextSources() { +fun TextSourcesList.testTextSources() { assertTrue (first() is RegularTextSource) assertTrue (get(1) is BoldTextSource) assertTrue (get(2) is RegularTextSource) diff --git a/tgbotapi.core/src/commonTest/kotlin/dev/inmo/tgbotapi/types/MessageEntity/StringFormattingTests.kt b/tgbotapi.core/src/commonTest/kotlin/dev/inmo/tgbotapi/types/MessageEntity/StringFormattingTests.kt index d817adc266..98f36e7b28 100644 --- a/tgbotapi.core/src/commonTest/kotlin/dev/inmo/tgbotapi/types/MessageEntity/StringFormattingTests.kt +++ b/tgbotapi.core/src/commonTest/kotlin/dev/inmo/tgbotapi/types/MessageEntity/StringFormattingTests.kt @@ -39,7 +39,7 @@ class StringFormattingTests { @Test fun testThatCreatingOfStringWithSimpleDSLWorksCorrectly() { - val sources: List = regular("It ") + + val sources: TextSourcesList = regular("It ") + bold(italic("is") + " " + strikethrough(underline("simple"))) + diff --git a/tgbotapi.core/src/commonTest/kotlin/dev/inmo/tgbotapi/types/TextSourcesTests.kt b/tgbotapi.core/src/commonTest/kotlin/dev/inmo/tgbotapi/types/TextSourcesTests.kt index b3f0158702..d544f21c70 100644 --- a/tgbotapi.core/src/commonTest/kotlin/dev/inmo/tgbotapi/types/TextSourcesTests.kt +++ b/tgbotapi.core/src/commonTest/kotlin/dev/inmo/tgbotapi/types/TextSourcesTests.kt @@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.types import dev.inmo.tgbotapi.CommonAbstracts.makeString import dev.inmo.tgbotapi.TestsJsonFormat import dev.inmo.tgbotapi.extensions.utils.formatting.* +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource import kotlinx.serialization.builtins.ListSerializer import kotlin.test.Test import kotlin.test.assertEquals diff --git a/tgbotapi.extensions.api/build.gradle b/tgbotapi.extensions.api/build.gradle index 1d557205fe..f47a5e111c 100644 --- a/tgbotapi.extensions.api/build.gradle +++ b/tgbotapi.extensions.api/build.gradle @@ -29,10 +29,8 @@ repositories { } kotlin { - jvm { - compilations.main.kotlinOptions.useIR = true - } - js(BOTH) { + jvm() + js(IR) { browser() nodejs() } diff --git a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/answers/AnswerInlineQuery.kt b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/answers/AnswerInlineQuery.kt index bee5f5c67b..e549143781 100644 --- a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/answers/AnswerInlineQuery.kt +++ b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/answers/AnswerInlineQuery.kt @@ -3,7 +3,6 @@ package dev.inmo.tgbotapi.extensions.api.answers import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.requests.answers.AnswerInlineQuery import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult -import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InlineQuery import dev.inmo.tgbotapi.types.InlineQueryIdentifier suspend fun TelegramBot.answerInlineQuery( @@ -19,7 +18,7 @@ suspend fun TelegramBot.answerInlineQuery( ) suspend fun TelegramBot.answerInlineQuery( - inlineQuery: InlineQuery, + inlineQuery: dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery, results: List = emptyList(), cachedTime: Int? = null, isPersonal: Boolean? = null, diff --git a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/caption/EditChatMessageCaption.kt b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/caption/EditChatMessageCaption.kt index 81d730056a..4ed6b395f0 100644 --- a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/caption/EditChatMessageCaption.kt +++ b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/caption/EditChatMessageCaption.kt @@ -1,10 +1,11 @@ package dev.inmo.tgbotapi.extensions.api.edit.caption -import dev.inmo.tgbotapi.CommonAbstracts.* +import dev.inmo.tgbotapi.CommonAbstracts.TextedWithTextSources import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.requests.edit.caption.EditChatMessageCaption import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.MessageIdentifier import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup @@ -42,7 +43,7 @@ suspend fun TelegramBot.editMessageCaption( suspend fun TelegramBot.editMessageCaption( chatId: ChatIdentifier, messageId: MessageIdentifier, - entities: List, + entities: TextSourcesList, replyMarkup: InlineKeyboardMarkup? = null ) = execute( EditChatMessageCaption(chatId, messageId, entities, replyMarkup) @@ -51,7 +52,7 @@ suspend fun TelegramBot.editMessageCaption( suspend fun TelegramBot.editMessageCaption( chat: Chat, messageId: MessageIdentifier, - entities: List, + entities: List, replyMarkup: InlineKeyboardMarkup? = null ) = editMessageCaption(chat.id, messageId, entities, replyMarkup) diff --git a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/caption/EditInlineMessageCaption.kt b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/caption/EditInlineMessageCaption.kt index d30a399696..1ee2224a42 100644 --- a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/caption/EditInlineMessageCaption.kt +++ b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/caption/EditInlineMessageCaption.kt @@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.extensions.api.edit.caption import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.requests.edit.caption.EditInlineMessageCaption import dev.inmo.tgbotapi.types.InlineMessageIdentifier +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup @@ -15,6 +16,6 @@ suspend fun TelegramBot.editMessageCaption( suspend fun TelegramBot.editMessageCaption( inlineMessageId: InlineMessageIdentifier, - entities: List, + entities: TextSourcesList, replyMarkup: InlineKeyboardMarkup? = null ) = execute(EditInlineMessageCaption(inlineMessageId, entities, replyMarkup)) diff --git a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/text/EditChatMessageText.kt b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/text/EditChatMessageText.kt index 0fe253ff0b..fa94728a9e 100644 --- a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/text/EditChatMessageText.kt +++ b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/text/EditChatMessageText.kt @@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.extensions.api.edit.text import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.requests.edit.text.EditChatMessageText import dev.inmo.tgbotapi.types.ChatIdentifier +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.MessageIdentifier import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup @@ -41,7 +42,7 @@ suspend fun TelegramBot.editMessageText( suspend fun TelegramBot.editMessageText( chatId: ChatIdentifier, messageId: MessageIdentifier, - entities: List, + entities: TextSourcesList, disableWebPagePreview: Boolean? = null, replyMarkup: InlineKeyboardMarkup? = null ) = execute( @@ -51,14 +52,14 @@ suspend fun TelegramBot.editMessageText( suspend fun TelegramBot.editMessageText( chat: Chat, messageId: MessageIdentifier, - entities: List, + entities: TextSourcesList, disableWebPagePreview: Boolean? = null, replyMarkup: InlineKeyboardMarkup? = null ) = editMessageText(chat.id, messageId, entities, disableWebPagePreview, replyMarkup) suspend fun TelegramBot.editMessageText( message: ContentMessage, - entities: List, + entities: TextSourcesList, disableWebPagePreview: Boolean? = null, replyMarkup: InlineKeyboardMarkup? = null ) = editMessageText(message.chat.id, message.messageId, entities, disableWebPagePreview, replyMarkup) diff --git a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/text/EditInlineMessageText.kt b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/text/EditInlineMessageText.kt index 3d734cf303..1293e4a3fa 100644 --- a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/text/EditInlineMessageText.kt +++ b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/text/EditInlineMessageText.kt @@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.extensions.api.edit.text import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.requests.edit.text.EditInlineMessageText import dev.inmo.tgbotapi.types.InlineMessageIdentifier +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup @@ -16,7 +17,7 @@ suspend fun TelegramBot.editMessageText( suspend fun TelegramBot.editMessageText( inlineMessageId: InlineMessageIdentifier, - entities: List, + entities: TextSourcesList, disableWebPagePreview: Boolean? = null, replyMarkup: InlineKeyboardMarkup? = null ) = execute(EditInlineMessageText(inlineMessageId, entities, disableWebPagePreview, replyMarkup)) diff --git a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/CopyMessage.kt b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/CopyMessage.kt index 82e04f308e..c7f2281461 100644 --- a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/CopyMessage.kt +++ b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/CopyMessage.kt @@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.extensions.api.send import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.requests.send.CopyMessage import dev.inmo.tgbotapi.types.ChatIdentifier +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.MessageIdentifier import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup @@ -86,7 +87,7 @@ suspend inline fun TelegramBot.copyMessage( fromChatId: ChatIdentifier, toChatId: ChatIdentifier, messageId: MessageIdentifier, - entities: List, + entities: TextSourcesList, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, allowSendingWithoutReply: Boolean? = null, @@ -99,7 +100,7 @@ suspend inline fun TelegramBot.copyMessage( fromChat: Chat, toChatId: ChatIdentifier, messageId: MessageIdentifier, - entities: List, + entities: TextSourcesList, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, allowSendingWithoutReply: Boolean? = null, @@ -110,7 +111,7 @@ suspend inline fun TelegramBot.copyMessage( fromChatId: ChatIdentifier, toChat: Chat, messageId: MessageIdentifier, - entities: List, + entities: TextSourcesList, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, allowSendingWithoutReply: Boolean? = null, @@ -121,7 +122,7 @@ suspend inline fun TelegramBot.copyMessage( fromChat: Chat, toChat: Chat, messageId: MessageIdentifier, - entities: List, + entities: TextSourcesList, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, allowSendingWithoutReply: Boolean? = null, @@ -131,7 +132,7 @@ suspend inline fun TelegramBot.copyMessage( suspend inline fun TelegramBot.copyMessage( toChatId: ChatIdentifier, message: Message, - entities: List, + entities: TextSourcesList, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, allowSendingWithoutReply: Boolean? = null, @@ -141,7 +142,7 @@ suspend inline fun TelegramBot.copyMessage( suspend inline fun TelegramBot.copyMessage( toChat: Chat, message: Message, - entities: List, + entities: TextSourcesList, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, allowSendingWithoutReply: Boolean? = null, diff --git a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendMessage.kt b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendMessage.kt index 6c30653a50..30447010b2 100644 --- a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendMessage.kt +++ b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendMessage.kt @@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.extensions.api.send import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.requests.send.SendTextMessage import dev.inmo.tgbotapi.types.ChatIdentifier +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.MessageIdentifier import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup @@ -60,7 +61,7 @@ suspend fun TelegramBot.sendTextMessage( suspend fun TelegramBot.sendMessage( chatId: ChatIdentifier, - entities: List, + entities: TextSourcesList, disableWebPagePreview: Boolean? = null, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, @@ -72,7 +73,7 @@ suspend fun TelegramBot.sendMessage( suspend fun TelegramBot.sendTextMessage( chatId: ChatIdentifier, - entities: List, + entities: TextSourcesList, disableWebPagePreview: Boolean? = null, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, @@ -84,7 +85,7 @@ suspend fun TelegramBot.sendTextMessage( suspend fun TelegramBot.sendMessage( chat: Chat, - entities: List, + entities: TextSourcesList, disableWebPagePreview: Boolean? = null, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, @@ -95,7 +96,7 @@ suspend fun TelegramBot.sendMessage( suspend fun TelegramBot.sendTextMessage( chat: Chat, - entities: List, + entities: TextSourcesList, disableWebPagePreview: Boolean? = null, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, @@ -123,7 +124,7 @@ suspend inline fun TelegramBot.reply( ) suspend inline fun TelegramBot.reply( to: Message, - entities: List, + entities: TextSourcesList, disableWebPagePreview: Boolean? = null, disableNotification: Boolean = false, allowSendingWithoutReply: Boolean? = null, diff --git a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendAnimation.kt b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendAnimation.kt index 058b2a57b1..df6646a8b0 100644 --- a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendAnimation.kt +++ b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendAnimation.kt @@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.requests.abstracts.InputFile import dev.inmo.tgbotapi.requests.send.media.SendAnimation import dev.inmo.tgbotapi.types.ChatIdentifier +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.MessageIdentifier import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup @@ -144,7 +145,7 @@ suspend fun TelegramBot.sendAnimation( chatId: ChatIdentifier, animation: InputFile, thumb: InputFile? = null, - entities: List, + entities: TextSourcesList, duration: Long? = null, width: Int? = null, height: Int? = null, @@ -171,7 +172,7 @@ suspend fun TelegramBot.sendAnimation( suspend fun TelegramBot.sendAnimation( chatId: ChatIdentifier, animation: AnimationFile, - entities: List, + entities: TextSourcesList, duration: Long? = null, width: Int? = null, height: Int? = null, @@ -187,7 +188,7 @@ suspend fun TelegramBot.sendAnimation( chat: Chat, animation: InputFile, thumb: InputFile? = null, - entities: List, + entities: TextSourcesList, duration: Long? = null, width: Int? = null, height: Int? = null, @@ -200,7 +201,7 @@ suspend fun TelegramBot.sendAnimation( suspend fun TelegramBot.sendAnimation( chat: Chat, animation: AnimationFile, - entities: List, + entities: TextSourcesList, duration: Long? = null, width: Int? = null, height: Int? = null, @@ -214,7 +215,7 @@ suspend inline fun TelegramBot.replyWithAnimation( to: Message, animation: InputFile, thumb: InputFile? = null, - entities: List, + entities: TextSourcesList, duration: Long? = null, width: Int? = null, height: Int? = null, @@ -238,7 +239,7 @@ suspend inline fun TelegramBot.replyWithAnimation( suspend inline fun TelegramBot.replyWithAnimation( to: Message, animation: AnimationFile, - entities: List, + entities: TextSourcesList, duration: Long? = null, width: Int? = null, height: Int? = null, @@ -250,7 +251,7 @@ suspend inline fun TelegramBot.replyWithAnimation( suspend inline fun TelegramBot.reply( to: Message, animation: AnimationFile, - entities: List, + entities: TextSourcesList, duration: Long? = null, width: Int? = null, height: Int? = null, diff --git a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendAudio.kt b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendAudio.kt index 019e8ec048..f19f3ea605 100644 --- a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendAudio.kt +++ b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendAudio.kt @@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.requests.abstracts.InputFile import dev.inmo.tgbotapi.requests.send.media.SendAudio import dev.inmo.tgbotapi.types.ChatIdentifier +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.MessageIdentifier import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup @@ -121,7 +122,7 @@ suspend inline fun TelegramBot.sendAudio( chatId: ChatIdentifier, audio: InputFile, thumb: InputFile? = null, - entities: List, + entities: TextSourcesList, duration: Long? = null, performer: String? = null, title: String? = null, @@ -149,7 +150,7 @@ suspend inline fun TelegramBot.sendAudio( chat: Chat, audio: InputFile, thumb: InputFile? = null, - entities: List, + entities: TextSourcesList, duration: Long? = null, performer: String? = null, title: String? = null, @@ -162,7 +163,7 @@ suspend inline fun TelegramBot.sendAudio( suspend inline fun TelegramBot.sendAudio( chatId: ChatIdentifier, audio: AudioFile, - entities: List, + entities: TextSourcesList, title: String? = audio.title, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, @@ -173,7 +174,7 @@ suspend inline fun TelegramBot.sendAudio( suspend inline fun TelegramBot.sendAudio( chat: Chat, audio: AudioFile, - entities: List, + entities: TextSourcesList, title: String? = audio.title, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, @@ -185,7 +186,7 @@ suspend inline fun TelegramBot.replyWithAudio( to: Message, audio: InputFile, thumb: InputFile? = null, - entities: List, + entities: TextSourcesList, duration: Long? = null, performer: String? = null, title: String? = null, @@ -197,7 +198,7 @@ suspend inline fun TelegramBot.replyWithAudio( suspend inline fun TelegramBot.replyWithAudio( to: Message, audio: AudioFile, - entities: List, + entities: TextSourcesList, title: String? = null, disableNotification: Boolean = false, allowSendingWithoutReply: Boolean? = null, @@ -207,7 +208,7 @@ suspend inline fun TelegramBot.replyWithAudio( suspend inline fun TelegramBot.reply( to: Message, audio: AudioFile, - entities: List, + entities: TextSourcesList, title: String? = null, disableNotification: Boolean = false, allowSendingWithoutReply: Boolean? = null, diff --git a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendDocument.kt b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendDocument.kt index 88be4feb78..a06dbc9ab9 100644 --- a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendDocument.kt +++ b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendDocument.kt @@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.requests.abstracts.InputFile import dev.inmo.tgbotapi.requests.send.media.SendDocument import dev.inmo.tgbotapi.types.ChatIdentifier +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.MessageIdentifier import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup @@ -115,7 +116,7 @@ suspend inline fun TelegramBot.sendDocument( chatId: ChatIdentifier, document: InputFile, thumb: InputFile? = null, - entities: List, + entities: TextSourcesList, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, allowSendingWithoutReply: Boolean? = null, @@ -139,7 +140,7 @@ suspend inline fun TelegramBot.sendDocument( chat: Chat, document: InputFile, thumb: InputFile? = null, - entities: List, + entities: TextSourcesList, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, allowSendingWithoutReply: Boolean? = null, @@ -150,7 +151,7 @@ suspend inline fun TelegramBot.sendDocument( suspend inline fun TelegramBot.sendDocument( chatId: ChatIdentifier, document: DocumentFile, - entities: List, + entities: TextSourcesList, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, allowSendingWithoutReply: Boolean? = null, @@ -163,7 +164,7 @@ suspend inline fun TelegramBot.sendDocument( suspend inline fun TelegramBot.sendDocument( chat: Chat, document: DocumentFile, - entities: List, + entities: TextSourcesList, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, allowSendingWithoutReply: Boolean? = null, @@ -175,7 +176,7 @@ suspend inline fun TelegramBot.replyWithDocument( to: Message, document: InputFile, thumb: InputFile? = null, - entities: List, + entities: TextSourcesList, disableNotification: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null, @@ -185,7 +186,7 @@ suspend inline fun TelegramBot.replyWithDocument( suspend inline fun TelegramBot.replyWithDocument( to: Message, document: DocumentFile, - entities: List, + entities: TextSourcesList, disableNotification: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null, @@ -195,7 +196,7 @@ suspend inline fun TelegramBot.replyWithDocument( suspend inline fun TelegramBot.reply( to: Message, document: DocumentFile, - entities: List, + entities: TextSourcesList, disableNotification: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null, diff --git a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendPhoto.kt b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendPhoto.kt index 565098825e..872ef23507 100644 --- a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendPhoto.kt +++ b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendPhoto.kt @@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.requests.abstracts.InputFile import dev.inmo.tgbotapi.requests.send.media.SendPhoto import dev.inmo.tgbotapi.types.ChatIdentifier +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.MessageIdentifier import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup @@ -101,7 +102,7 @@ suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.sendPhoto( chatId: ChatIdentifier, fileId: InputFile, - entities: List, + entities: TextSourcesList, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, allowSendingWithoutReply: Boolean? = null, @@ -121,7 +122,7 @@ suspend inline fun TelegramBot.sendPhoto( suspend inline fun TelegramBot.sendPhoto( chat: Chat, fileId: InputFile, - entities: List, + entities: TextSourcesList, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, allowSendingWithoutReply: Boolean? = null, @@ -131,7 +132,7 @@ suspend inline fun TelegramBot.sendPhoto( suspend inline fun TelegramBot.sendPhoto( chatId: ChatIdentifier, photo: Photo, - entities: List, + entities: TextSourcesList, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, allowSendingWithoutReply: Boolean? = null, @@ -141,7 +142,7 @@ suspend inline fun TelegramBot.sendPhoto( suspend inline fun TelegramBot.sendPhoto( chat: Chat, photo: Photo, - entities: List, + entities: TextSourcesList, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, allowSendingWithoutReply: Boolean? = null, @@ -151,7 +152,7 @@ suspend inline fun TelegramBot.sendPhoto( suspend inline fun TelegramBot.replyWithPhoto( to: Message, fileId: InputFile, - entities: List, + entities: TextSourcesList, disableNotification: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null @@ -160,7 +161,7 @@ suspend inline fun TelegramBot.replyWithPhoto( suspend inline fun TelegramBot.replyWithPhoto( to: Message, photo: Photo, - entities: List, + entities: TextSourcesList, disableNotification: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null @@ -169,7 +170,7 @@ suspend inline fun TelegramBot.replyWithPhoto( suspend inline fun TelegramBot.reply( to: Message, photo: Photo, - entities: List, + entities: TextSourcesList, disableNotification: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null diff --git a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendVideo.kt b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendVideo.kt index a11bb412a8..5bcc1085c9 100644 --- a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendVideo.kt +++ b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendVideo.kt @@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.requests.abstracts.InputFile import dev.inmo.tgbotapi.requests.send.media.SendVideo import dev.inmo.tgbotapi.types.ChatIdentifier +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.MessageIdentifier import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup @@ -119,7 +120,7 @@ suspend inline fun TelegramBot.sendVideo( chatId: ChatIdentifier, video: InputFile, thumb: InputFile? = null, - entities: List, + entities: TextSourcesList, duration: Long? = null, width: Int? = null, height: Int? = null, @@ -147,7 +148,7 @@ suspend inline fun TelegramBot.sendVideo( suspend inline fun TelegramBot.sendVideo( chatId: ChatIdentifier, video: VideoFile, - entities: List, + entities: TextSourcesList, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, allowSendingWithoutReply: Boolean? = null, @@ -158,7 +159,7 @@ suspend inline fun TelegramBot.sendVideo( chat: Chat, video: InputFile, thumb: InputFile? = null, - entities: List, + entities: TextSourcesList, duration: Long? = null, width: Int? = null, height: Int? = null, @@ -172,7 +173,7 @@ suspend inline fun TelegramBot.sendVideo( suspend inline fun TelegramBot.sendVideo( chat: Chat, video: VideoFile, - entities: List, + entities: TextSourcesList, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, allowSendingWithoutReply: Boolean? = null, @@ -183,7 +184,7 @@ suspend inline fun TelegramBot.replyWithVideo( to: Message, video: InputFile, thumb: InputFile? = null, - entities: List, + entities: TextSourcesList, duration: Long? = null, width: Int? = null, height: Int? = null, @@ -195,7 +196,7 @@ suspend inline fun TelegramBot.replyWithVideo( suspend inline fun TelegramBot.replyWithVideo( to: Message, video: VideoFile, - entities: List, + entities: TextSourcesList, disableNotification: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null @@ -204,7 +205,7 @@ suspend inline fun TelegramBot.replyWithVideo( suspend inline fun TelegramBot.reply( to: Message, video: VideoFile, - entities: List, + entities: TextSourcesList, disableNotification: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null diff --git a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendVoice.kt b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendVoice.kt index 4f8566aa4f..6024220d4b 100644 --- a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendVoice.kt +++ b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendVoice.kt @@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.requests.abstracts.InputFile import dev.inmo.tgbotapi.requests.send.media.SendVoice import dev.inmo.tgbotapi.types.ChatIdentifier +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.MessageIdentifier import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup @@ -106,7 +107,7 @@ suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.sendVoice( chatId: ChatIdentifier, voice: InputFile, - entities: List, + entities: TextSourcesList, duration: Long? = null, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, @@ -128,7 +129,7 @@ suspend inline fun TelegramBot.sendVoice( suspend inline fun TelegramBot.sendVoice( chat: Chat, voice: InputFile, - entities: List, + entities: TextSourcesList, duration: Long? = null, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, @@ -139,7 +140,7 @@ suspend inline fun TelegramBot.sendVoice( suspend inline fun TelegramBot.sendVoice( chatId: ChatIdentifier, voice: VoiceFile, - entities: List, + entities: TextSourcesList, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, allowSendingWithoutReply: Boolean? = null, @@ -151,7 +152,7 @@ suspend inline fun TelegramBot.sendVoice( suspend inline fun TelegramBot.sendVoice( chat: Chat, voice: VoiceFile, - entities: List, + entities: TextSourcesList, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, allowSendingWithoutReply: Boolean? = null, @@ -161,7 +162,7 @@ suspend inline fun TelegramBot.sendVoice( suspend inline fun TelegramBot.replyWithVoice( to: Message, voice: InputFile, - entities: List, + entities: TextSourcesList, duration: Long? = null, disableNotification: Boolean = false, allowSendingWithoutReply: Boolean? = null, @@ -171,7 +172,7 @@ suspend inline fun TelegramBot.replyWithVoice( suspend inline fun TelegramBot.replyWithVoice( to: Message, voice: VoiceFile, - entities: List, + entities: TextSourcesList, disableNotification: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null @@ -180,7 +181,7 @@ suspend inline fun TelegramBot.replyWithVoice( suspend inline fun TelegramBot.reply( to: Message, voice: VoiceFile, - entities: List, + entities: TextSourcesList, disableNotification: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null diff --git a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/polls/SendPoll.kt b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/polls/SendPoll.kt index a69923e6ad..2662d17013 100644 --- a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/polls/SendPoll.kt +++ b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/polls/SendPoll.kt @@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.requests.send.polls.SendQuizPoll import dev.inmo.tgbotapi.requests.send.polls.SendRegularPoll import dev.inmo.tgbotapi.types.ChatIdentifier +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.MessageIdentifier import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup @@ -161,7 +162,7 @@ suspend inline fun TelegramBot.sendQuizPoll( correctOptionId: Int, isAnonymous: Boolean = true, isClosed: Boolean = false, - entities: List, + entities: TextSourcesList, closeInfo: ScheduledCloseInfo? = null, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, @@ -180,7 +181,7 @@ suspend inline fun TelegramBot.sendQuizPoll( correctOptionId: Int, isAnonymous: Boolean = true, isClosed: Boolean = false, - entities: List, + entities: TextSourcesList, closeInfo: ScheduledCloseInfo? = null, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, @@ -198,7 +199,7 @@ suspend inline fun TelegramBot.sendQuizPoll( options: List = quizPoll.options.map { it.text }, correctOptionId: Int = quizPoll.correctOptionId ?: error("Correct option ID must be provided by income QuizPoll or by developer"), isAnonymous: Boolean = quizPoll.isAnonymous, - entities: List, + entities: TextSourcesList, closeInfo: ScheduledCloseInfo? = null, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, @@ -216,7 +217,7 @@ suspend inline fun TelegramBot.sendQuizPoll( options: List = quizPoll.options.map { it.text }, correctOptionId: Int = quizPoll.correctOptionId ?: error("Correct option ID must be provided by income QuizPoll or by developer"), isAnonymous: Boolean = quizPoll.isAnonymous, - entities: List, + entities: TextSourcesList, closeInfo: ScheduledCloseInfo? = null, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, @@ -291,7 +292,7 @@ suspend inline fun TelegramBot.replyWithQuizPoll( correctOptionId: Int, isAnonymous: Boolean = true, isClosed: Boolean = false, - entities: List, + entities: TextSourcesList, closeInfo: ScheduledCloseInfo? = null, disableNotification: Boolean = false, allowSendingWithoutReply: Boolean? = null, @@ -306,7 +307,7 @@ suspend inline fun TelegramBot.replyWithQuizPoll( options: List = quizPoll.options.map { it.text }, correctOptionId: Int = quizPoll.correctOptionId ?: error("Correct option ID must be provided by income QuizPoll or by developer"), isAnonymous: Boolean = quizPoll.isAnonymous, - entities: List, + entities: TextSourcesList, closeInfo: ScheduledCloseInfo? = null, disableNotification: Boolean = false, allowSendingWithoutReply: Boolean? = null, diff --git a/tgbotapi.extensions.behaviour_builder/build.gradle b/tgbotapi.extensions.behaviour_builder/build.gradle index ffa6a93381..c733bd1258 100644 --- a/tgbotapi.extensions.behaviour_builder/build.gradle +++ b/tgbotapi.extensions.behaviour_builder/build.gradle @@ -29,10 +29,8 @@ repositories { } kotlin { - jvm { - compilations.main.kotlinOptions.useIR = true - } - js(BOTH) { + jvm() + js(IR) { browser() nodejs() } diff --git a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitInlineQuery.kt b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitInlineQuery.kt index c3de533c8e..c5afff5667 100644 --- a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitInlineQuery.kt +++ b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitInlineQuery.kt @@ -3,7 +3,6 @@ package dev.inmo.tgbotapi.extensions.behaviour_builder.expectations import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext import dev.inmo.tgbotapi.extensions.utils.asInlineQueryUpdate import dev.inmo.tgbotapi.requests.abstracts.Request -import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InlineQuery import dev.inmo.tgbotapi.types.InlineQueries.query.BaseInlineQuery import dev.inmo.tgbotapi.types.InlineQueries.query.LocationInlineQuery import kotlinx.coroutines.flow.toList @@ -14,7 +13,7 @@ private suspend fun BehaviourContext.waitInlineQueries( count: Int = 1, initRequest: Request<*>? = null, errorFactory: NullableRequestBuilder<*> = { null }, - mapper: suspend InlineQuery.() -> O? + mapper: suspend dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery.() -> O? ): List = expectFlow( initRequest, count, @@ -24,7 +23,7 @@ private suspend fun BehaviourContext.waitInlineQueries( }.toList().toList() -private suspend inline fun BehaviourContext.waitInlines( +private suspend inline fun BehaviourContext.waitInlines( count: Int = 1, initRequest: Request<*>? = null, noinline errorFactory: NullableRequestBuilder<*> = { null }, @@ -49,7 +48,7 @@ suspend fun BehaviourContext.waitAnyInlineQuery( initRequest: Request<*>? = null, errorFactory: NullableRequestBuilder<*> = { null }, count: Int = 1, - filter: InlineQueryMapper? = null + filter: InlineQueryMapper? = null ) = waitInlines(count, initRequest, errorFactory, filter) suspend fun BehaviourContext.waitBaseInlineQuery( diff --git a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/InlineQueryTriggers.kt b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/InlineQueryTriggers.kt index bc55ed4afd..621d1fd8bb 100644 --- a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/InlineQueryTriggers.kt +++ b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/InlineQueryTriggers.kt @@ -5,11 +5,10 @@ import dev.inmo.tgbotapi.extensions.behaviour_builder.* import dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.expectFlow import dev.inmo.tgbotapi.extensions.utils.asInlineQueryUpdate import dev.inmo.tgbotapi.extensions.utils.extensions.sourceChat -import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InlineQuery import dev.inmo.tgbotapi.types.InlineQueries.query.BaseInlineQuery import dev.inmo.tgbotapi.types.InlineQueries.query.LocationInlineQuery -internal suspend inline fun BehaviourContext.onInlineQuery( +internal suspend inline fun BehaviourContext.onInlineQuery( includeFilterByChatInBehaviourSubContext: Boolean = true, noinline additionalFilter: (suspend (T) -> Boolean)? = null, noinline scenarioReceiver: BehaviourContextAndTypeReceiver @@ -37,8 +36,8 @@ internal suspend inline fun BehaviourContext.onInlineQ suspend fun BehaviourContext.onAnyInlineQuery( includeFilterByChatInBehaviourSubContext: Boolean = true, - additionalFilter: (suspend (InlineQuery) -> Boolean)? = null, - scenarioReceiver: BehaviourContextAndTypeReceiver + additionalFilter: (suspend (dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery) -> Boolean)? = null, + scenarioReceiver: BehaviourContextAndTypeReceiver ) = onInlineQuery(includeFilterByChatInBehaviourSubContext, additionalFilter, scenarioReceiver) diff --git a/tgbotapi.extensions.utils/build.gradle b/tgbotapi.extensions.utils/build.gradle index dca79235e1..810af2519b 100644 --- a/tgbotapi.extensions.utils/build.gradle +++ b/tgbotapi.extensions.utils/build.gradle @@ -29,10 +29,8 @@ repositories { } kotlin { - jvm { - compilations.main.kotlinOptions.useIR = true - } - js(BOTH) { + jvm() + js(IR) { browser() nodejs() } diff --git a/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/ClassCasts.kt b/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/ClassCasts.kt index 73a2ee2f23..ac235c56df 100644 --- a/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/ClassCasts.kt +++ b/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/ClassCasts.kt @@ -1,7 +1,8 @@ @file:Suppress("NOTHING_TO_INLINE", "unused", "UNCHECKED_CAST") package dev.inmo.tgbotapi.extensions.utils -import dev.inmo.tgbotapi.CommonAbstracts.* + +import dev.inmo.tgbotapi.CommonAbstracts.CommonSendInvoiceData import dev.inmo.tgbotapi.requests.send.payments.SendInvoice import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.CallbackQuery.* @@ -18,14 +19,11 @@ import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.video.* import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.voice.* import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.* -import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InlineQuery -import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InputMessageContent +import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent import dev.inmo.tgbotapi.types.InlineQueries.query.BaseInlineQuery import dev.inmo.tgbotapi.types.InlineQueries.query.LocationInlineQuery import dev.inmo.tgbotapi.types.InputMedia.* import dev.inmo.tgbotapi.types.MessageEntity.textsources.* -import dev.inmo.tgbotapi.types.MessageEntity.textsources.MultilevelTextSource -import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource import dev.inmo.tgbotapi.types.actions.* import dev.inmo.tgbotapi.types.buttons.* import dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.* @@ -57,1257 +55,2104 @@ import dev.inmo.tgbotapi.utils.PreviewFeature @PreviewFeature inline fun Chat.asBot(): Bot? = this as? Bot + @PreviewFeature inline fun Chat.requireBot(): Bot = this as Bot + @PreviewFeature inline fun Chat.asCommonBot(): CommonBot? = this as? CommonBot + @PreviewFeature inline fun Chat.requireCommonBot(): CommonBot = this as CommonBot + @PreviewFeature inline fun Chat.asCommonUser(): CommonUser? = this as? CommonUser + @PreviewFeature inline fun Chat.requireCommonUser(): CommonUser = this as CommonUser + @PreviewFeature inline fun Chat.asExtendedBot(): ExtendedBot? = this as? ExtendedBot + @PreviewFeature inline fun Chat.requireExtendedBot(): ExtendedBot = this as ExtendedBot + @PreviewFeature inline fun Chat.asUser(): User? = this as? User + @PreviewFeature inline fun Chat.requireUser(): User = this as User + @PreviewFeature inline fun Chat.asChannelChat(): ChannelChat? = this as? ChannelChat + @PreviewFeature inline fun Chat.requireChannelChat(): ChannelChat = this as ChannelChat + @PreviewFeature inline fun Chat.asGroupChat(): GroupChat? = this as? GroupChat + @PreviewFeature inline fun Chat.requireGroupChat(): GroupChat = this as GroupChat + @PreviewFeature inline fun Chat.asPrivateChat(): PrivateChat? = this as? PrivateChat + @PreviewFeature inline fun Chat.requirePrivateChat(): PrivateChat = this as PrivateChat + @PreviewFeature inline fun Chat.asPublicChat(): PublicChat? = this as? PublicChat + @PreviewFeature inline fun Chat.requirePublicChat(): PublicChat = this as PublicChat + @PreviewFeature inline fun Chat.asSuperPublicChat(): SuperPublicChat? = this as? SuperPublicChat + @PreviewFeature inline fun Chat.requireSuperPublicChat(): SuperPublicChat = this as SuperPublicChat + @PreviewFeature inline fun Chat.asSupergroupChat(): SupergroupChat? = this as? SupergroupChat + @PreviewFeature inline fun Chat.requireSupergroupChat(): SupergroupChat = this as SupergroupChat + @PreviewFeature inline fun Chat.asUnknownChatType(): UnknownChatType? = this as? UnknownChatType + @PreviewFeature inline fun Chat.requireUnknownChatType(): UnknownChatType = this as UnknownChatType + @PreviewFeature inline fun Chat.asUsernameChat(): UsernameChat? = this as? UsernameChat + @PreviewFeature inline fun Chat.requireUsernameChat(): UsernameChat = this as UsernameChat + @PreviewFeature inline fun Chat.asExtendedChannelChat(): ExtendedChannelChat? = this as? ExtendedChannelChat + @PreviewFeature inline fun Chat.requireExtendedChannelChat(): ExtendedChannelChat = this as ExtendedChannelChat + @PreviewFeature inline fun Chat.asExtendedChat(): ExtendedChat? = this as? ExtendedChat + @PreviewFeature inline fun Chat.requireExtendedChat(): ExtendedChat = this as ExtendedChat + @PreviewFeature inline fun Chat.asExtendedGroupChat(): ExtendedGroupChat? = this as? ExtendedGroupChat + @PreviewFeature inline fun Chat.requireExtendedGroupChat(): ExtendedGroupChat = this as ExtendedGroupChat + @PreviewFeature inline fun Chat.asExtendedPrivateChat(): ExtendedPrivateChat? = this as? ExtendedPrivateChat + @PreviewFeature inline fun Chat.requireExtendedPrivateChat(): ExtendedPrivateChat = this as ExtendedPrivateChat + @PreviewFeature inline fun Chat.asExtendedPublicChat(): ExtendedPublicChat? = this as? ExtendedPublicChat + @PreviewFeature inline fun Chat.requireExtendedPublicChat(): ExtendedPublicChat = this as ExtendedPublicChat + @PreviewFeature inline fun Chat.asExtendedSupergroupChat(): ExtendedSupergroupChat? = this as? ExtendedSupergroupChat + @PreviewFeature inline fun Chat.requireExtendedSupergroupChat(): ExtendedSupergroupChat = this as ExtendedSupergroupChat + @PreviewFeature inline fun CallbackQuery.asDataCallbackQuery(): DataCallbackQuery? = this as? DataCallbackQuery + @PreviewFeature inline fun CallbackQuery.requireDataCallbackQuery(): DataCallbackQuery = this as DataCallbackQuery + @PreviewFeature -inline fun CallbackQuery.asGameShortNameCallbackQuery(): GameShortNameCallbackQuery? = this as? GameShortNameCallbackQuery +inline fun CallbackQuery.asGameShortNameCallbackQuery(): GameShortNameCallbackQuery? = + this as? GameShortNameCallbackQuery + @PreviewFeature -inline fun CallbackQuery.requireGameShortNameCallbackQuery(): GameShortNameCallbackQuery = this as GameShortNameCallbackQuery +inline fun CallbackQuery.requireGameShortNameCallbackQuery(): GameShortNameCallbackQuery = + this as GameShortNameCallbackQuery + @PreviewFeature -inline fun CallbackQuery.asInlineMessageIdCallbackQuery(): InlineMessageIdCallbackQuery? = this as? InlineMessageIdCallbackQuery +inline fun CallbackQuery.asInlineMessageIdCallbackQuery(): InlineMessageIdCallbackQuery? = + this as? InlineMessageIdCallbackQuery + @PreviewFeature -inline fun CallbackQuery.requireInlineMessageIdCallbackQuery(): InlineMessageIdCallbackQuery = this as InlineMessageIdCallbackQuery +inline fun CallbackQuery.requireInlineMessageIdCallbackQuery(): InlineMessageIdCallbackQuery = + this as InlineMessageIdCallbackQuery + @PreviewFeature -inline fun CallbackQuery.asInlineMessageIdDataCallbackQuery(): InlineMessageIdDataCallbackQuery? = this as? InlineMessageIdDataCallbackQuery +inline fun CallbackQuery.asInlineMessageIdDataCallbackQuery(): InlineMessageIdDataCallbackQuery? = + this as? InlineMessageIdDataCallbackQuery + @PreviewFeature -inline fun CallbackQuery.requireInlineMessageIdDataCallbackQuery(): InlineMessageIdDataCallbackQuery = this as InlineMessageIdDataCallbackQuery +inline fun CallbackQuery.requireInlineMessageIdDataCallbackQuery(): InlineMessageIdDataCallbackQuery = + this as InlineMessageIdDataCallbackQuery + @PreviewFeature -inline fun CallbackQuery.asInlineMessageIdGameShortNameCallbackQuery(): InlineMessageIdGameShortNameCallbackQuery? = this as? InlineMessageIdGameShortNameCallbackQuery +inline fun CallbackQuery.asInlineMessageIdGameShortNameCallbackQuery(): InlineMessageIdGameShortNameCallbackQuery? = + this as? InlineMessageIdGameShortNameCallbackQuery + @PreviewFeature -inline fun CallbackQuery.requireInlineMessageIdGameShortNameCallbackQuery(): InlineMessageIdGameShortNameCallbackQuery = this as InlineMessageIdGameShortNameCallbackQuery +inline fun CallbackQuery.requireInlineMessageIdGameShortNameCallbackQuery(): InlineMessageIdGameShortNameCallbackQuery = + this as InlineMessageIdGameShortNameCallbackQuery + @PreviewFeature inline fun CallbackQuery.asMessageCallbackQuery(): MessageCallbackQuery? = this as? MessageCallbackQuery + @PreviewFeature inline fun CallbackQuery.requireMessageCallbackQuery(): MessageCallbackQuery = this as MessageCallbackQuery + @PreviewFeature inline fun CallbackQuery.asMessageDataCallbackQuery(): MessageDataCallbackQuery? = this as? MessageDataCallbackQuery + @PreviewFeature inline fun CallbackQuery.requireMessageDataCallbackQuery(): MessageDataCallbackQuery = this as MessageDataCallbackQuery + @PreviewFeature -inline fun CallbackQuery.asMessageGameShortNameCallbackQuery(): MessageGameShortNameCallbackQuery? = this as? MessageGameShortNameCallbackQuery +inline fun CallbackQuery.asMessageGameShortNameCallbackQuery(): MessageGameShortNameCallbackQuery? = + this as? MessageGameShortNameCallbackQuery + @PreviewFeature -inline fun CallbackQuery.requireMessageGameShortNameCallbackQuery(): MessageGameShortNameCallbackQuery = this as MessageGameShortNameCallbackQuery +inline fun CallbackQuery.requireMessageGameShortNameCallbackQuery(): MessageGameShortNameCallbackQuery = + this as MessageGameShortNameCallbackQuery + @PreviewFeature inline fun CallbackQuery.asUnknownCallbackQueryType(): UnknownCallbackQueryType? = this as? UnknownCallbackQueryType + @PreviewFeature inline fun CallbackQuery.requireUnknownCallbackQueryType(): UnknownCallbackQueryType = this as UnknownCallbackQueryType + @PreviewFeature -inline fun PassportElementError.asPassportElementErrorDataField(): PassportElementErrorDataField? = this as? PassportElementErrorDataField +inline fun PassportElementError.asPassportElementErrorDataField(): PassportElementErrorDataField? = + this as? PassportElementErrorDataField + @PreviewFeature -inline fun PassportElementError.requirePassportElementErrorDataField(): PassportElementErrorDataField = this as PassportElementErrorDataField +inline fun PassportElementError.requirePassportElementErrorDataField(): PassportElementErrorDataField = + this as PassportElementErrorDataField + @PreviewFeature -inline fun PassportElementError.asPassportElementErrorFile(): PassportElementErrorFile? = this as? PassportElementErrorFile +inline fun PassportElementError.asPassportElementErrorFile(): PassportElementErrorFile? = + this as? PassportElementErrorFile + @PreviewFeature -inline fun PassportElementError.requirePassportElementErrorFile(): PassportElementErrorFile = this as PassportElementErrorFile +inline fun PassportElementError.requirePassportElementErrorFile(): PassportElementErrorFile = + this as PassportElementErrorFile + @PreviewFeature -inline fun PassportElementError.asPassportElementErrorFiles(): PassportElementErrorFiles? = this as? PassportElementErrorFiles +inline fun PassportElementError.asPassportElementErrorFiles(): PassportElementErrorFiles? = + this as? PassportElementErrorFiles + @PreviewFeature -inline fun PassportElementError.requirePassportElementErrorFiles(): PassportElementErrorFiles = this as PassportElementErrorFiles +inline fun PassportElementError.requirePassportElementErrorFiles(): PassportElementErrorFiles = + this as PassportElementErrorFiles + @PreviewFeature -inline fun PassportElementError.asPassportElementErrorFrontSide(): PassportElementErrorFrontSide? = this as? PassportElementErrorFrontSide +inline fun PassportElementError.asPassportElementErrorFrontSide(): PassportElementErrorFrontSide? = + this as? PassportElementErrorFrontSide + @PreviewFeature -inline fun PassportElementError.requirePassportElementErrorFrontSide(): PassportElementErrorFrontSide = this as PassportElementErrorFrontSide +inline fun PassportElementError.requirePassportElementErrorFrontSide(): PassportElementErrorFrontSide = + this as PassportElementErrorFrontSide + @PreviewFeature -inline fun PassportElementError.asPassportElementErrorReverseSide(): PassportElementErrorReverseSide? = this as? PassportElementErrorReverseSide +inline fun PassportElementError.asPassportElementErrorReverseSide(): PassportElementErrorReverseSide? = + this as? PassportElementErrorReverseSide + @PreviewFeature -inline fun PassportElementError.requirePassportElementErrorReverseSide(): PassportElementErrorReverseSide = this as PassportElementErrorReverseSide +inline fun PassportElementError.requirePassportElementErrorReverseSide(): PassportElementErrorReverseSide = + this as PassportElementErrorReverseSide + @PreviewFeature -inline fun PassportElementError.asPassportElementErrorSelfie(): PassportElementErrorSelfie? = this as? PassportElementErrorSelfie +inline fun PassportElementError.asPassportElementErrorSelfie(): PassportElementErrorSelfie? = + this as? PassportElementErrorSelfie + @PreviewFeature -inline fun PassportElementError.requirePassportElementErrorSelfie(): PassportElementErrorSelfie = this as PassportElementErrorSelfie +inline fun PassportElementError.requirePassportElementErrorSelfie(): PassportElementErrorSelfie = + this as PassportElementErrorSelfie + @PreviewFeature -inline fun PassportElementError.asPassportElementErrorTranslationFile(): PassportElementErrorTranslationFile? = this as? PassportElementErrorTranslationFile +inline fun PassportElementError.asPassportElementErrorTranslationFile(): PassportElementErrorTranslationFile? = + this as? PassportElementErrorTranslationFile + @PreviewFeature -inline fun PassportElementError.requirePassportElementErrorTranslationFile(): PassportElementErrorTranslationFile = this as PassportElementErrorTranslationFile +inline fun PassportElementError.requirePassportElementErrorTranslationFile(): PassportElementErrorTranslationFile = + this as PassportElementErrorTranslationFile + @PreviewFeature -inline fun PassportElementError.asPassportElementErrorTranslationFiles(): PassportElementErrorTranslationFiles? = this as? PassportElementErrorTranslationFiles +inline fun PassportElementError.asPassportElementErrorTranslationFiles(): PassportElementErrorTranslationFiles? = + this as? PassportElementErrorTranslationFiles + @PreviewFeature -inline fun PassportElementError.requirePassportElementErrorTranslationFiles(): PassportElementErrorTranslationFiles = this as PassportElementErrorTranslationFiles +inline fun PassportElementError.requirePassportElementErrorTranslationFiles(): PassportElementErrorTranslationFiles = + this as PassportElementErrorTranslationFiles + @PreviewFeature -inline fun PassportElementError.asPassportElementErrorUnspecified(): PassportElementErrorUnspecified? = this as? PassportElementErrorUnspecified +inline fun PassportElementError.asPassportElementErrorUnspecified(): PassportElementErrorUnspecified? = + this as? PassportElementErrorUnspecified + @PreviewFeature -inline fun PassportElementError.requirePassportElementErrorUnspecified(): PassportElementErrorUnspecified = this as PassportElementErrorUnspecified +inline fun PassportElementError.requirePassportElementErrorUnspecified(): PassportElementErrorUnspecified = + this as PassportElementErrorUnspecified + @PreviewFeature -inline fun PassportElementError.asPassportElementFileError(): PassportElementFileError? = this as? PassportElementFileError +inline fun PassportElementError.asPassportElementFileError(): PassportElementFileError? = + this as? PassportElementFileError + @PreviewFeature -inline fun PassportElementError.requirePassportElementFileError(): PassportElementFileError = this as PassportElementFileError +inline fun PassportElementError.requirePassportElementFileError(): PassportElementFileError = + this as PassportElementFileError + @PreviewFeature -inline fun PassportElementError.asPassportElementFilesError(): PassportElementFilesError? = this as? PassportElementFilesError +inline fun PassportElementError.asPassportElementFilesError(): PassportElementFilesError? = + this as? PassportElementFilesError + @PreviewFeature -inline fun PassportElementError.requirePassportElementFilesError(): PassportElementFilesError = this as PassportElementFilesError +inline fun PassportElementError.requirePassportElementFilesError(): PassportElementFilesError = + this as PassportElementFilesError + @PreviewFeature -inline fun PassportElementError.asPassportMultipleElementsError(): PassportMultipleElementsError? = this as? PassportMultipleElementsError +inline fun PassportElementError.asPassportMultipleElementsError(): PassportMultipleElementsError? = + this as? PassportMultipleElementsError + @PreviewFeature -inline fun PassportElementError.requirePassportMultipleElementsError(): PassportMultipleElementsError = this as PassportMultipleElementsError +inline fun PassportElementError.requirePassportMultipleElementsError(): PassportMultipleElementsError = + this as PassportMultipleElementsError + @PreviewFeature -inline fun PassportElementError.asPassportSingleElementError(): PassportSingleElementError? = this as? PassportSingleElementError +inline fun PassportElementError.asPassportSingleElementError(): PassportSingleElementError? = + this as? PassportSingleElementError + @PreviewFeature -inline fun PassportElementError.requirePassportSingleElementError(): PassportSingleElementError = this as PassportSingleElementError +inline fun PassportElementError.requirePassportSingleElementError(): PassportSingleElementError = + this as PassportSingleElementError + @PreviewFeature -inline fun PassportElementError.asUnknownPassportElementError(): UnknownPassportElementError? = this as? UnknownPassportElementError +inline fun PassportElementError.asUnknownPassportElementError(): UnknownPassportElementError? = + this as? UnknownPassportElementError + @PreviewFeature -inline fun PassportElementError.requireUnknownPassportElementError(): UnknownPassportElementError = this as UnknownPassportElementError +inline fun PassportElementError.requireUnknownPassportElementError(): UnknownPassportElementError = + this as UnknownPassportElementError + @PreviewFeature inline fun EncryptedPassportElement.asBankStatement(): BankStatement? = this as? BankStatement + @PreviewFeature inline fun EncryptedPassportElement.requireBankStatement(): BankStatement = this as BankStatement + @PreviewFeature inline fun EncryptedPassportElement.asCommonPassport(): CommonPassport? = this as? CommonPassport + @PreviewFeature inline fun EncryptedPassportElement.requireCommonPassport(): CommonPassport = this as CommonPassport + @PreviewFeature inline fun EncryptedPassportElement.asDriverLicense(): DriverLicense? = this as? DriverLicense + @PreviewFeature inline fun EncryptedPassportElement.requireDriverLicense(): DriverLicense = this as DriverLicense + @PreviewFeature inline fun EncryptedPassportElement.asEmail(): Email? = this as? Email + @PreviewFeature inline fun EncryptedPassportElement.requireEmail(): Email = this as Email + @PreviewFeature inline fun EncryptedPassportElement.asEncryptedAddress(): EncryptedAddress? = this as? EncryptedAddress + @PreviewFeature inline fun EncryptedPassportElement.requireEncryptedAddress(): EncryptedAddress = this as EncryptedAddress + @PreviewFeature -inline fun EncryptedPassportElement.asEncryptedPersonalDetails(): EncryptedPersonalDetails? = this as? EncryptedPersonalDetails +inline fun EncryptedPassportElement.asEncryptedPersonalDetails(): EncryptedPersonalDetails? = + this as? EncryptedPersonalDetails + @PreviewFeature -inline fun EncryptedPassportElement.requireEncryptedPersonalDetails(): EncryptedPersonalDetails = this as EncryptedPersonalDetails +inline fun EncryptedPassportElement.requireEncryptedPersonalDetails(): EncryptedPersonalDetails = + this as EncryptedPersonalDetails + @PreviewFeature inline fun EncryptedPassportElement.asIdentityCard(): IdentityCard? = this as? IdentityCard + @PreviewFeature inline fun EncryptedPassportElement.requireIdentityCard(): IdentityCard = this as IdentityCard + @PreviewFeature inline fun EncryptedPassportElement.asInternalPassport(): InternalPassport? = this as? InternalPassport + @PreviewFeature inline fun EncryptedPassportElement.requireInternalPassport(): InternalPassport = this as InternalPassport + @PreviewFeature inline fun EncryptedPassportElement.asPassport(): Passport? = this as? Passport + @PreviewFeature inline fun EncryptedPassportElement.requirePassport(): Passport = this as Passport + @PreviewFeature inline fun EncryptedPassportElement.asPassportRegistration(): PassportRegistration? = this as? PassportRegistration + @PreviewFeature inline fun EncryptedPassportElement.requirePassportRegistration(): PassportRegistration = this as PassportRegistration + @PreviewFeature inline fun EncryptedPassportElement.asPhoneNumber(): PhoneNumber? = this as? PhoneNumber + @PreviewFeature inline fun EncryptedPassportElement.requirePhoneNumber(): PhoneNumber = this as PhoneNumber + @PreviewFeature inline fun EncryptedPassportElement.asRentalAgreement(): RentalAgreement? = this as? RentalAgreement + @PreviewFeature inline fun EncryptedPassportElement.requireRentalAgreement(): RentalAgreement = this as RentalAgreement + @PreviewFeature inline fun EncryptedPassportElement.asTemporaryRegistration(): TemporaryRegistration? = this as? TemporaryRegistration + @PreviewFeature -inline fun EncryptedPassportElement.requireTemporaryRegistration(): TemporaryRegistration = this as TemporaryRegistration +inline fun EncryptedPassportElement.requireTemporaryRegistration(): TemporaryRegistration = + this as TemporaryRegistration + @PreviewFeature -inline fun EncryptedPassportElement.asEncryptedPassportElementWithTranslatableFilesCollection(): EncryptedPassportElementWithTranslatableFilesCollection? = this as? EncryptedPassportElementWithTranslatableFilesCollection +inline fun EncryptedPassportElement.asEncryptedPassportElementWithTranslatableFilesCollection(): EncryptedPassportElementWithTranslatableFilesCollection? = + this as? EncryptedPassportElementWithTranslatableFilesCollection + @PreviewFeature -inline fun EncryptedPassportElement.requireEncryptedPassportElementWithTranslatableFilesCollection(): EncryptedPassportElementWithTranslatableFilesCollection = this as EncryptedPassportElementWithTranslatableFilesCollection +inline fun EncryptedPassportElement.requireEncryptedPassportElementWithTranslatableFilesCollection(): EncryptedPassportElementWithTranslatableFilesCollection = + this as EncryptedPassportElementWithTranslatableFilesCollection + @PreviewFeature -inline fun EncryptedPassportElement.asEncryptedPassportElementWithTranslatableIDDocument(): EncryptedPassportElementWithTranslatableIDDocument? = this as? EncryptedPassportElementWithTranslatableIDDocument +inline fun EncryptedPassportElement.asEncryptedPassportElementWithTranslatableIDDocument(): EncryptedPassportElementWithTranslatableIDDocument? = + this as? EncryptedPassportElementWithTranslatableIDDocument + @PreviewFeature -inline fun EncryptedPassportElement.requireEncryptedPassportElementWithTranslatableIDDocument(): EncryptedPassportElementWithTranslatableIDDocument = this as EncryptedPassportElementWithTranslatableIDDocument +inline fun EncryptedPassportElement.requireEncryptedPassportElementWithTranslatableIDDocument(): EncryptedPassportElementWithTranslatableIDDocument = + this as EncryptedPassportElementWithTranslatableIDDocument + @PreviewFeature inline fun EncryptedPassportElement.asUtilityBill(): UtilityBill? = this as? UtilityBill + @PreviewFeature inline fun EncryptedPassportElement.requireUtilityBill(): UtilityBill = this as UtilityBill + @PreviewFeature -inline fun EncryptedPassportElement.asEncryptedPassportElementWithFilesCollection(): EncryptedPassportElementWithFilesCollection? = this as? EncryptedPassportElementWithFilesCollection +inline fun EncryptedPassportElement.asEncryptedPassportElementWithFilesCollection(): EncryptedPassportElementWithFilesCollection? = + this as? EncryptedPassportElementWithFilesCollection + @PreviewFeature -inline fun EncryptedPassportElement.requireEncryptedPassportElementWithFilesCollection(): EncryptedPassportElementWithFilesCollection = this as EncryptedPassportElementWithFilesCollection +inline fun EncryptedPassportElement.requireEncryptedPassportElementWithFilesCollection(): EncryptedPassportElementWithFilesCollection = + this as EncryptedPassportElementWithFilesCollection + @PreviewFeature -inline fun EncryptedPassportElement.asEncryptedPassportElementTranslatable(): EncryptedPassportElementTranslatable? = this as? EncryptedPassportElementTranslatable +inline fun EncryptedPassportElement.asEncryptedPassportElementTranslatable(): EncryptedPassportElementTranslatable? = + this as? EncryptedPassportElementTranslatable + @PreviewFeature -inline fun EncryptedPassportElement.requireEncryptedPassportElementTranslatable(): EncryptedPassportElementTranslatable = this as EncryptedPassportElementTranslatable +inline fun EncryptedPassportElement.requireEncryptedPassportElementTranslatable(): EncryptedPassportElementTranslatable = + this as EncryptedPassportElementTranslatable + @PreviewFeature -inline fun EncryptedPassportElement.asUnknownEncryptedPassportElement(): UnknownEncryptedPassportElement? = this as? UnknownEncryptedPassportElement +inline fun EncryptedPassportElement.asUnknownEncryptedPassportElement(): UnknownEncryptedPassportElement? = + this as? UnknownEncryptedPassportElement + @PreviewFeature -inline fun EncryptedPassportElement.requireUnknownEncryptedPassportElement(): UnknownEncryptedPassportElement = this as UnknownEncryptedPassportElement +inline fun EncryptedPassportElement.requireUnknownEncryptedPassportElement(): UnknownEncryptedPassportElement = + this as UnknownEncryptedPassportElement + @PreviewFeature -inline fun EncryptedPassportElement.asEncryptedPassportElementWithData(): EncryptedPassportElementWithData? = this as? EncryptedPassportElementWithData +inline fun EncryptedPassportElement.asEncryptedPassportElementWithData(): EncryptedPassportElementWithData? = + this as? EncryptedPassportElementWithData + @PreviewFeature -inline fun EncryptedPassportElement.requireEncryptedPassportElementWithData(): EncryptedPassportElementWithData = this as EncryptedPassportElementWithData +inline fun EncryptedPassportElement.requireEncryptedPassportElementWithData(): EncryptedPassportElementWithData = + this as EncryptedPassportElementWithData + @PreviewFeature -inline fun EncryptedPassportElement.asEncryptedPassportElementWithEmail(): EncryptedPassportElementWithEmail? = this as? EncryptedPassportElementWithEmail +inline fun EncryptedPassportElement.asEncryptedPassportElementWithEmail(): EncryptedPassportElementWithEmail? = + this as? EncryptedPassportElementWithEmail + @PreviewFeature -inline fun EncryptedPassportElement.requireEncryptedPassportElementWithEmail(): EncryptedPassportElementWithEmail = this as EncryptedPassportElementWithEmail +inline fun EncryptedPassportElement.requireEncryptedPassportElementWithEmail(): EncryptedPassportElementWithEmail = + this as EncryptedPassportElementWithEmail + @PreviewFeature -inline fun EncryptedPassportElement.asEncryptedPassportElementWithFrontSide(): EncryptedPassportElementWithFrontSide? = this as? EncryptedPassportElementWithFrontSide +inline fun EncryptedPassportElement.asEncryptedPassportElementWithFrontSide(): EncryptedPassportElementWithFrontSide? = + this as? EncryptedPassportElementWithFrontSide + @PreviewFeature -inline fun EncryptedPassportElement.requireEncryptedPassportElementWithFrontSide(): EncryptedPassportElementWithFrontSide = this as EncryptedPassportElementWithFrontSide +inline fun EncryptedPassportElement.requireEncryptedPassportElementWithFrontSide(): EncryptedPassportElementWithFrontSide = + this as EncryptedPassportElementWithFrontSide + @PreviewFeature -inline fun EncryptedPassportElement.asEncryptedPassportElementWithPhoneNumber(): EncryptedPassportElementWithPhoneNumber? = this as? EncryptedPassportElementWithPhoneNumber +inline fun EncryptedPassportElement.asEncryptedPassportElementWithPhoneNumber(): EncryptedPassportElementWithPhoneNumber? = + this as? EncryptedPassportElementWithPhoneNumber + @PreviewFeature -inline fun EncryptedPassportElement.requireEncryptedPassportElementWithPhoneNumber(): EncryptedPassportElementWithPhoneNumber = this as EncryptedPassportElementWithPhoneNumber +inline fun EncryptedPassportElement.requireEncryptedPassportElementWithPhoneNumber(): EncryptedPassportElementWithPhoneNumber = + this as EncryptedPassportElementWithPhoneNumber + @PreviewFeature -inline fun EncryptedPassportElement.asEncryptedPassportElementWithReverseSide(): EncryptedPassportElementWithReverseSide? = this as? EncryptedPassportElementWithReverseSide +inline fun EncryptedPassportElement.asEncryptedPassportElementWithReverseSide(): EncryptedPassportElementWithReverseSide? = + this as? EncryptedPassportElementWithReverseSide + @PreviewFeature -inline fun EncryptedPassportElement.requireEncryptedPassportElementWithReverseSide(): EncryptedPassportElementWithReverseSide = this as EncryptedPassportElementWithReverseSide +inline fun EncryptedPassportElement.requireEncryptedPassportElementWithReverseSide(): EncryptedPassportElementWithReverseSide = + this as EncryptedPassportElementWithReverseSide + @PreviewFeature -inline fun EncryptedPassportElement.asEncryptedPassportElementWithSelfie(): EncryptedPassportElementWithSelfie? = this as? EncryptedPassportElementWithSelfie +inline fun EncryptedPassportElement.asEncryptedPassportElementWithSelfie(): EncryptedPassportElementWithSelfie? = + this as? EncryptedPassportElementWithSelfie + @PreviewFeature -inline fun EncryptedPassportElement.requireEncryptedPassportElementWithSelfie(): EncryptedPassportElementWithSelfie = this as EncryptedPassportElementWithSelfie +inline fun EncryptedPassportElement.requireEncryptedPassportElementWithSelfie(): EncryptedPassportElementWithSelfie = + this as EncryptedPassportElementWithSelfie + @PreviewFeature inline fun SecureValue.asAddressSecureValue(): AddressSecureValue? = this as? AddressSecureValue + @PreviewFeature inline fun SecureValue.requireAddressSecureValue(): AddressSecureValue = this as AddressSecureValue + @PreviewFeature inline fun SecureValue.asBankStatementSecureValue(): BankStatementSecureValue? = this as? BankStatementSecureValue + @PreviewFeature inline fun SecureValue.requireBankStatementSecureValue(): BankStatementSecureValue = this as BankStatementSecureValue + @PreviewFeature inline fun SecureValue.asCommonPassportSecureValue(): CommonPassportSecureValue? = this as? CommonPassportSecureValue + @PreviewFeature inline fun SecureValue.requireCommonPassportSecureValue(): CommonPassportSecureValue = this as CommonPassportSecureValue + @PreviewFeature inline fun SecureValue.asDriverLicenseSecureValue(): DriverLicenseSecureValue? = this as? DriverLicenseSecureValue + @PreviewFeature inline fun SecureValue.requireDriverLicenseSecureValue(): DriverLicenseSecureValue = this as DriverLicenseSecureValue + @PreviewFeature inline fun SecureValue.asIdentityCardSecureValue(): IdentityCardSecureValue? = this as? IdentityCardSecureValue + @PreviewFeature inline fun SecureValue.requireIdentityCardSecureValue(): IdentityCardSecureValue = this as IdentityCardSecureValue + @PreviewFeature -inline fun SecureValue.asIdentityWithReverseSideSecureValue(): IdentityWithReverseSideSecureValue? = this as? IdentityWithReverseSideSecureValue +inline fun SecureValue.asIdentityWithReverseSideSecureValue(): IdentityWithReverseSideSecureValue? = + this as? IdentityWithReverseSideSecureValue + @PreviewFeature -inline fun SecureValue.requireIdentityWithReverseSideSecureValue(): IdentityWithReverseSideSecureValue = this as IdentityWithReverseSideSecureValue +inline fun SecureValue.requireIdentityWithReverseSideSecureValue(): IdentityWithReverseSideSecureValue = + this as IdentityWithReverseSideSecureValue + @PreviewFeature -inline fun SecureValue.asInternalPassportSecureValue(): InternalPassportSecureValue? = this as? InternalPassportSecureValue +inline fun SecureValue.asInternalPassportSecureValue(): InternalPassportSecureValue? = + this as? InternalPassportSecureValue + @PreviewFeature -inline fun SecureValue.requireInternalPassportSecureValue(): InternalPassportSecureValue = this as InternalPassportSecureValue +inline fun SecureValue.requireInternalPassportSecureValue(): InternalPassportSecureValue = + this as InternalPassportSecureValue + @PreviewFeature inline fun SecureValue.asOtherDocumentsSecureValue(): OtherDocumentsSecureValue? = this as? OtherDocumentsSecureValue + @PreviewFeature inline fun SecureValue.requireOtherDocumentsSecureValue(): OtherDocumentsSecureValue = this as OtherDocumentsSecureValue + @PreviewFeature -inline fun SecureValue.asPassportRegistrationSecureValue(): PassportRegistrationSecureValue? = this as? PassportRegistrationSecureValue +inline fun SecureValue.asPassportRegistrationSecureValue(): PassportRegistrationSecureValue? = + this as? PassportRegistrationSecureValue + @PreviewFeature -inline fun SecureValue.requirePassportRegistrationSecureValue(): PassportRegistrationSecureValue = this as PassportRegistrationSecureValue +inline fun SecureValue.requirePassportRegistrationSecureValue(): PassportRegistrationSecureValue = + this as PassportRegistrationSecureValue + @PreviewFeature inline fun SecureValue.asPassportSecureValue(): PassportSecureValue? = this as? PassportSecureValue + @PreviewFeature inline fun SecureValue.requirePassportSecureValue(): PassportSecureValue = this as PassportSecureValue + @PreviewFeature inline fun SecureValue.asPersonalDetailsSecureValue(): PersonalDetailsSecureValue? = this as? PersonalDetailsSecureValue + @PreviewFeature -inline fun SecureValue.requirePersonalDetailsSecureValue(): PersonalDetailsSecureValue = this as PersonalDetailsSecureValue +inline fun SecureValue.requirePersonalDetailsSecureValue(): PersonalDetailsSecureValue = + this as PersonalDetailsSecureValue + @PreviewFeature inline fun SecureValue.asRentalAgreementSecureValue(): RentalAgreementSecureValue? = this as? RentalAgreementSecureValue + @PreviewFeature -inline fun SecureValue.requireRentalAgreementSecureValue(): RentalAgreementSecureValue = this as RentalAgreementSecureValue +inline fun SecureValue.requireRentalAgreementSecureValue(): RentalAgreementSecureValue = + this as RentalAgreementSecureValue + @PreviewFeature -inline fun SecureValue.asTemporalRegistrationSecureValue(): TemporalRegistrationSecureValue? = this as? TemporalRegistrationSecureValue +inline fun SecureValue.asTemporalRegistrationSecureValue(): TemporalRegistrationSecureValue? = + this as? TemporalRegistrationSecureValue + @PreviewFeature -inline fun SecureValue.requireTemporalRegistrationSecureValue(): TemporalRegistrationSecureValue = this as TemporalRegistrationSecureValue +inline fun SecureValue.requireTemporalRegistrationSecureValue(): TemporalRegistrationSecureValue = + this as TemporalRegistrationSecureValue + @PreviewFeature inline fun SecureValue.asUtilityBillSecureValue(): UtilityBillSecureValue? = this as? UtilityBillSecureValue + @PreviewFeature inline fun SecureValue.requireUtilityBillSecureValue(): UtilityBillSecureValue = this as UtilityBillSecureValue + @PreviewFeature inline fun SecureValue.asSecureValueIdentity(): SecureValueIdentity? = this as? SecureValueIdentity + @PreviewFeature inline fun SecureValue.requireSecureValueIdentity(): SecureValueIdentity = this as SecureValueIdentity + @PreviewFeature inline fun SecureValue.asSecureValueWithData(): SecureValueWithData? = this as? SecureValueWithData + @PreviewFeature inline fun SecureValue.requireSecureValueWithData(): SecureValueWithData = this as SecureValueWithData + @PreviewFeature inline fun SecureValue.asSecureValueWithFiles(): SecureValueWithFiles? = this as? SecureValueWithFiles + @PreviewFeature inline fun SecureValue.requireSecureValueWithFiles(): SecureValueWithFiles = this as SecureValueWithFiles + @PreviewFeature inline fun SecureValue.asSecureValueWithReverseSide(): SecureValueWithReverseSide? = this as? SecureValueWithReverseSide + @PreviewFeature -inline fun SecureValue.requireSecureValueWithReverseSide(): SecureValueWithReverseSide = this as SecureValueWithReverseSide +inline fun SecureValue.requireSecureValueWithReverseSide(): SecureValueWithReverseSide = + this as SecureValueWithReverseSide + @PreviewFeature -inline fun SecureValue.asSecureValueWithTranslations(): SecureValueWithTranslations? = this as? SecureValueWithTranslations +inline fun SecureValue.asSecureValueWithTranslations(): SecureValueWithTranslations? = + this as? SecureValueWithTranslations + @PreviewFeature -inline fun SecureValue.requireSecureValueWithTranslations(): SecureValueWithTranslations = this as SecureValueWithTranslations +inline fun SecureValue.requireSecureValueWithTranslations(): SecureValueWithTranslations = + this as SecureValueWithTranslations + @PreviewFeature -inline fun Message.asAnonymousGroupContentMessageImpl(): AnonymousGroupContentMessageImpl? = this as? AnonymousGroupContentMessageImpl +inline fun Message.asAnonymousGroupContentMessageImpl(): AnonymousGroupContentMessageImpl? = + this as? AnonymousGroupContentMessageImpl + @PreviewFeature -inline fun Message.requireAnonymousGroupContentMessageImpl(): AnonymousGroupContentMessageImpl = this as AnonymousGroupContentMessageImpl +inline fun Message.requireAnonymousGroupContentMessageImpl(): AnonymousGroupContentMessageImpl = + this as AnonymousGroupContentMessageImpl + @PreviewFeature -inline fun Message.asChannelContentMessageImpl(): ChannelContentMessageImpl? = this as? ChannelContentMessageImpl +inline fun Message.asChannelContentMessageImpl(): ChannelContentMessageImpl? = + this as? ChannelContentMessageImpl + @PreviewFeature -inline fun Message.requireChannelContentMessageImpl(): ChannelContentMessageImpl = this as ChannelContentMessageImpl +inline fun Message.requireChannelContentMessageImpl(): ChannelContentMessageImpl = + this as ChannelContentMessageImpl + @PreviewFeature -inline fun Message.asFromChannelGroupContentMessageImpl(): FromChannelGroupContentMessageImpl? = this as? FromChannelGroupContentMessageImpl +inline fun Message.asFromChannelGroupContentMessageImpl(): FromChannelGroupContentMessageImpl? = + this as? FromChannelGroupContentMessageImpl + @PreviewFeature -inline fun Message.requireFromChannelGroupContentMessageImpl(): FromChannelGroupContentMessageImpl = this as FromChannelGroupContentMessageImpl +inline fun Message.requireFromChannelGroupContentMessageImpl(): FromChannelGroupContentMessageImpl = + this as FromChannelGroupContentMessageImpl + @PreviewFeature inline fun Message.asPassportMessage(): PassportMessage? = this as? PassportMessage + @PreviewFeature inline fun Message.requirePassportMessage(): PassportMessage = this as PassportMessage + @PreviewFeature -inline fun Message.asPrivateContentMessageImpl(): PrivateContentMessageImpl? = this as? PrivateContentMessageImpl +inline fun Message.asPrivateContentMessageImpl(): PrivateContentMessageImpl? = + this as? PrivateContentMessageImpl + @PreviewFeature -inline fun Message.requirePrivateContentMessageImpl(): PrivateContentMessageImpl = this as PrivateContentMessageImpl +inline fun Message.requirePrivateContentMessageImpl(): PrivateContentMessageImpl = + this as PrivateContentMessageImpl + @PreviewFeature -inline fun Message.asChannelEventMessage(): ChannelEventMessage? = this as? ChannelEventMessage +inline fun Message.asChannelEventMessage(): ChannelEventMessage? = + this as? ChannelEventMessage + @PreviewFeature -inline fun Message.requireChannelEventMessage(): ChannelEventMessage = this as ChannelEventMessage +inline fun Message.requireChannelEventMessage(): ChannelEventMessage = + this as ChannelEventMessage + @PreviewFeature -inline fun Message.asChannelMediaGroupMessage(): ChannelMediaGroupMessage? = this as? ChannelMediaGroupMessage +inline fun Message.asChannelMediaGroupMessage(): ChannelMediaGroupMessage? = + this as? ChannelMediaGroupMessage + @PreviewFeature -inline fun Message.requireChannelMediaGroupMessage(): ChannelMediaGroupMessage = this as ChannelMediaGroupMessage +inline fun Message.requireChannelMediaGroupMessage(): ChannelMediaGroupMessage = + this as ChannelMediaGroupMessage + @PreviewFeature -inline fun Message.asCommonGroupEventMessage(): CommonGroupEventMessage? = this as? CommonGroupEventMessage +inline fun Message.asCommonGroupEventMessage(): CommonGroupEventMessage? = + this as? CommonGroupEventMessage + @PreviewFeature -inline fun Message.requireCommonGroupEventMessage(): CommonGroupEventMessage = this as CommonGroupEventMessage +inline fun Message.requireCommonGroupEventMessage(): CommonGroupEventMessage = + this as CommonGroupEventMessage + @PreviewFeature -inline fun Message.asCommonMediaGroupMessage(): CommonMediaGroupMessage? = this as? CommonMediaGroupMessage +inline fun Message.asCommonMediaGroupMessage(): CommonMediaGroupMessage? = + this as? CommonMediaGroupMessage + @PreviewFeature -inline fun Message.requireCommonMediaGroupMessage(): CommonMediaGroupMessage = this as CommonMediaGroupMessage +inline fun Message.requireCommonMediaGroupMessage(): CommonMediaGroupMessage = + this as CommonMediaGroupMessage + @PreviewFeature -inline fun Message.asCommonSupergroupEventMessage(): CommonSupergroupEventMessage? = this as? CommonSupergroupEventMessage +inline fun Message.asCommonSupergroupEventMessage(): CommonSupergroupEventMessage? = + this as? CommonSupergroupEventMessage + @PreviewFeature -inline fun Message.requireCommonSupergroupEventMessage(): CommonSupergroupEventMessage = this as CommonSupergroupEventMessage +inline fun Message.requireCommonSupergroupEventMessage(): CommonSupergroupEventMessage = + this as CommonSupergroupEventMessage + @PreviewFeature -inline fun Message.asAnonymousGroupContentMessage(): AnonymousGroupContentMessage? = this as? AnonymousGroupContentMessage +inline fun Message.asAnonymousGroupContentMessage(): AnonymousGroupContentMessage? = + this as? AnonymousGroupContentMessage + @PreviewFeature -inline fun Message.requireAnonymousGroupContentMessage(): AnonymousGroupContentMessage = this as AnonymousGroupContentMessage +inline fun Message.requireAnonymousGroupContentMessage(): AnonymousGroupContentMessage = + this as AnonymousGroupContentMessage + @PreviewFeature -inline fun Message.asChannelContentMessage(): ChannelContentMessageImpl? = this as? ChannelContentMessageImpl +inline fun Message.asChannelContentMessage(): ChannelContentMessageImpl? = + this as? ChannelContentMessageImpl + @PreviewFeature -inline fun Message.requireChannelContentMessage(): ChannelContentMessageImpl = this as ChannelContentMessageImpl +inline fun Message.requireChannelContentMessage(): ChannelContentMessageImpl = + this as ChannelContentMessageImpl + @PreviewFeature inline fun Message.asChatEventMessage(): ChatEventMessage? = this as? ChatEventMessage + @PreviewFeature inline fun Message.requireChatEventMessage(): ChatEventMessage = this as ChatEventMessage + @PreviewFeature -inline fun Message.asCommonGroupContentMessage(): CommonGroupContentMessage? = this as? CommonGroupContentMessage +inline fun Message.asCommonGroupContentMessage(): CommonGroupContentMessage? = + this as? CommonGroupContentMessage + @PreviewFeature -inline fun Message.requireCommonGroupContentMessage(): CommonGroupContentMessage = this as CommonGroupContentMessage +inline fun Message.requireCommonGroupContentMessage(): CommonGroupContentMessage = + this as CommonGroupContentMessage + @PreviewFeature inline fun Message.asCommonMessage(): CommonMessage? = this as? CommonMessage + @PreviewFeature inline fun Message.requireCommonMessage(): CommonMessage = this as CommonMessage + @PreviewFeature inline fun Message.asContentMessage(): ContentMessage? = this as? ContentMessage + @PreviewFeature inline fun Message.requireContentMessage(): ContentMessage = this as ContentMessage + @PreviewFeature -inline fun Message.asFromChannelGroupContentMessage(): FromChannelGroupContentMessage? = this as? FromChannelGroupContentMessage +inline fun Message.asFromChannelGroupContentMessage(): FromChannelGroupContentMessage? = + this as? FromChannelGroupContentMessage + @PreviewFeature -inline fun Message.requireFromChannelGroupContentMessage(): FromChannelGroupContentMessage = this as FromChannelGroupContentMessage +inline fun Message.requireFromChannelGroupContentMessage(): FromChannelGroupContentMessage = + this as FromChannelGroupContentMessage + @PreviewFeature inline fun Message.asGroupEventMessage(): GroupEventMessage? = this as? GroupEventMessage + @PreviewFeature inline fun Message.requireGroupEventMessage(): GroupEventMessage = this as GroupEventMessage + @PreviewFeature -inline fun Message.asGroupContentMessage(): GroupContentMessage? = this as? GroupContentMessage +inline fun Message.asGroupContentMessage(): GroupContentMessage? = + this as? GroupContentMessage + @PreviewFeature -inline fun Message.requireGroupContentMessage(): GroupContentMessage = this as GroupContentMessage +inline fun Message.requireGroupContentMessage(): GroupContentMessage = + this as GroupContentMessage + @PreviewFeature -inline fun Message.asMediaGroupMessage(): MediaGroupMessage? = this as? MediaGroupMessage +inline fun Message.asMediaGroupMessage(): MediaGroupMessage? = + this as? MediaGroupMessage + @PreviewFeature -inline fun Message.requireMediaGroupMessage(): MediaGroupMessage = this as MediaGroupMessage +inline fun Message.requireMediaGroupMessage(): MediaGroupMessage = + this as MediaGroupMessage + @PreviewFeature inline fun Message.asPossiblyEditedMessage(): PossiblyEditedMessage? = this as? PossiblyEditedMessage + @PreviewFeature inline fun Message.requirePossiblyEditedMessage(): PossiblyEditedMessage = this as PossiblyEditedMessage + @PreviewFeature inline fun Message.asPossiblyForwardedMessage(): PossiblyForwardedMessage? = this as? PossiblyForwardedMessage + @PreviewFeature inline fun Message.requirePossiblyForwardedMessage(): PossiblyForwardedMessage = this as PossiblyForwardedMessage + @PreviewFeature inline fun Message.asPossiblyPaymentMessage(): PossiblyPaymentMessage? = this as? PossiblyPaymentMessage + @PreviewFeature inline fun Message.requirePossiblyPaymentMessage(): PossiblyPaymentMessage = this as PossiblyPaymentMessage + @PreviewFeature -inline fun Message.asPrivateContentMessage(): PrivateContentMessage? = this as? PrivateContentMessage +inline fun Message.asPrivateContentMessage(): PrivateContentMessage? = + this as? PrivateContentMessage + @PreviewFeature -inline fun Message.requirePrivateContentMessage(): PrivateContentMessage = this as PrivateContentMessage +inline fun Message.requirePrivateContentMessage(): PrivateContentMessage = + this as PrivateContentMessage + @PreviewFeature -inline fun Message.asPublicContentMessage(): PublicContentMessage? = this as? PublicContentMessage +inline fun Message.asPublicContentMessage(): PublicContentMessage? = + this as? PublicContentMessage + @PreviewFeature -inline fun Message.requirePublicContentMessage(): PublicContentMessage = this as PublicContentMessage +inline fun Message.requirePublicContentMessage(): PublicContentMessage = + this as PublicContentMessage + @PreviewFeature inline fun Message.asSignedMessage(): SignedMessage? = this as? SignedMessage + @PreviewFeature inline fun Message.requireSignedMessage(): SignedMessage = this as SignedMessage + @PreviewFeature -inline fun Message.asSupergroupEventMessage(): SupergroupEventMessage? = this as? SupergroupEventMessage +inline fun Message.asSupergroupEventMessage(): SupergroupEventMessage? = + this as? SupergroupEventMessage + @PreviewFeature -inline fun Message.requireSupergroupEventMessage(): SupergroupEventMessage = this as SupergroupEventMessage +inline fun Message.requireSupergroupEventMessage(): SupergroupEventMessage = + this as SupergroupEventMessage + @PreviewFeature inline fun Message.asUnknownMessageType(): UnknownMessageType? = this as? UnknownMessageType + @PreviewFeature inline fun Message.requireUnknownMessageType(): UnknownMessageType = this as UnknownMessageType + @PreviewFeature -inline fun Message.asPossiblySentViaBotCommonMessage(): PossiblySentViaBotCommonMessage? = this as? PossiblySentViaBotCommonMessage +inline fun Message.asPossiblySentViaBotCommonMessage(): PossiblySentViaBotCommonMessage? = + this as? PossiblySentViaBotCommonMessage + @PreviewFeature -inline fun Message.requirePossiblySentViaBotCommonMessage(): PossiblySentViaBotCommonMessage = this as PossiblySentViaBotCommonMessage +inline fun Message.requirePossiblySentViaBotCommonMessage(): PossiblySentViaBotCommonMessage = + this as PossiblySentViaBotCommonMessage + @PreviewFeature inline fun Message.asFromUserMessage(): FromUserMessage? = this as? FromUserMessage + @PreviewFeature inline fun Message.requireFromUserMessage(): FromUserMessage = this as FromUserMessage + @PreviewFeature inline fun BotAction.asFindLocationAction(): FindLocationAction? = this as? FindLocationAction + @PreviewFeature inline fun BotAction.requireFindLocationAction(): FindLocationAction = this as FindLocationAction + @PreviewFeature inline fun BotAction.asRecordVoiceAction(): RecordVoiceAction? = this as? RecordVoiceAction + @PreviewFeature inline fun BotAction.requireRecordVoiceAction(): RecordVoiceAction = this as RecordVoiceAction + @PreviewFeature inline fun BotAction.asRecordVideoAction(): RecordVideoAction? = this as? RecordVideoAction + @PreviewFeature inline fun BotAction.requireRecordVideoAction(): RecordVideoAction = this as RecordVideoAction + @PreviewFeature inline fun BotAction.asRecordVideoNoteAction(): RecordVideoNoteAction? = this as? RecordVideoNoteAction + @PreviewFeature inline fun BotAction.requireRecordVideoNoteAction(): RecordVideoNoteAction = this as RecordVideoNoteAction + @PreviewFeature inline fun BotAction.asTypingAction(): TypingAction? = this as? TypingAction + @PreviewFeature inline fun BotAction.requireTypingAction(): TypingAction = this as TypingAction + @PreviewFeature inline fun BotAction.asUploadVoiceAction(): UploadVoiceAction? = this as? UploadVoiceAction + @PreviewFeature inline fun BotAction.requireUploadVoiceAction(): UploadVoiceAction = this as UploadVoiceAction + @PreviewFeature inline fun BotAction.asUploadDocumentAction(): UploadDocumentAction? = this as? UploadDocumentAction + @PreviewFeature inline fun BotAction.requireUploadDocumentAction(): UploadDocumentAction = this as UploadDocumentAction + @PreviewFeature inline fun BotAction.asUploadPhotoAction(): UploadPhotoAction? = this as? UploadPhotoAction + @PreviewFeature inline fun BotAction.requireUploadPhotoAction(): UploadPhotoAction = this as UploadPhotoAction + @PreviewFeature inline fun BotAction.asUploadVideoAction(): UploadVideoAction? = this as? UploadVideoAction + @PreviewFeature inline fun BotAction.requireUploadVideoAction(): UploadVideoAction = this as UploadVideoAction + @PreviewFeature inline fun BotAction.asUploadVideoNoteAction(): UploadVideoNoteAction? = this as? UploadVideoNoteAction + @PreviewFeature inline fun BotAction.requireUploadVideoNoteAction(): UploadVideoNoteAction = this as UploadVideoNoteAction + @PreviewFeature -inline fun InlineQuery.asBaseInlineQuery(): BaseInlineQuery? = this as? BaseInlineQuery +inline fun dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery.asBaseInlineQuery(): BaseInlineQuery? = + this as? BaseInlineQuery + @PreviewFeature -inline fun InlineQuery.requireBaseInlineQuery(): BaseInlineQuery = this as BaseInlineQuery +inline fun dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery.requireBaseInlineQuery(): BaseInlineQuery = + this as BaseInlineQuery + @PreviewFeature -inline fun InlineQuery.asLocationInlineQuery(): LocationInlineQuery? = this as? LocationInlineQuery +inline fun dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery.asLocationInlineQuery(): LocationInlineQuery? = + this as? LocationInlineQuery + @PreviewFeature -inline fun InlineQuery.requireLocationInlineQuery(): LocationInlineQuery = this as LocationInlineQuery +inline fun dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery.requireLocationInlineQuery(): LocationInlineQuery = + this as LocationInlineQuery + @PreviewFeature -inline fun InputMessageContent.asInputContactMessageContent(): InputContactMessageContent? = this as? InputContactMessageContent +inline fun InputMessageContent.asInputContactMessageContent(): InputContactMessageContent? = + this as? InputContactMessageContent + @PreviewFeature -inline fun InputMessageContent.requireInputContactMessageContent(): InputContactMessageContent = this as InputContactMessageContent +inline fun InputMessageContent.requireInputContactMessageContent(): InputContactMessageContent = + this as InputContactMessageContent + @PreviewFeature -inline fun InputMessageContent.asInputLocationMessageContent(): InputLocationMessageContent? = this as? InputLocationMessageContent +inline fun InputMessageContent.asInputLocationMessageContent(): InputLocationMessageContent? = + this as? InputLocationMessageContent + @PreviewFeature -inline fun InputMessageContent.requireInputLocationMessageContent(): InputLocationMessageContent = this as InputLocationMessageContent +inline fun InputMessageContent.requireInputLocationMessageContent(): InputLocationMessageContent = + this as InputLocationMessageContent + @PreviewFeature inline fun InputMessageContent.asInputTextMessageContent(): InputTextMessageContent? = this as? InputTextMessageContent + @PreviewFeature -inline fun InputMessageContent.requireInputTextMessageContent(): InputTextMessageContent = this as InputTextMessageContent +inline fun InputMessageContent.requireInputTextMessageContent(): InputTextMessageContent = + this as InputTextMessageContent + @PreviewFeature -inline fun InputMessageContent.asInputVenueMessageContent(): InputVenueMessageContent? = this as? InputVenueMessageContent +inline fun InputMessageContent.asInputVenueMessageContent(): InputVenueMessageContent? = + this as? InputVenueMessageContent + @PreviewFeature -inline fun InputMessageContent.requireInputVenueMessageContent(): InputVenueMessageContent = this as InputVenueMessageContent +inline fun InputMessageContent.requireInputVenueMessageContent(): InputVenueMessageContent = + this as InputVenueMessageContent + @PreviewFeature -inline fun InputMessageContent.asInputInvoiceMessageContent(): InputInvoiceMessageContent? = this as? InputInvoiceMessageContent +inline fun InputMessageContent.asInputInvoiceMessageContent(): InputInvoiceMessageContent? = + this as? InputInvoiceMessageContent + @PreviewFeature -inline fun InputMessageContent.requireInputInvoiceMessageContent(): InputInvoiceMessageContent = this as InputInvoiceMessageContent +inline fun InputMessageContent.requireInputInvoiceMessageContent(): InputInvoiceMessageContent = + this as InputInvoiceMessageContent + @PreviewFeature inline fun InlineQueryResult.asInlineQueryResultArticle(): InlineQueryResultArticle? = this as? InlineQueryResultArticle + @PreviewFeature -inline fun InlineQueryResult.requireInlineQueryResultArticle(): InlineQueryResultArticle = this as InlineQueryResultArticle +inline fun InlineQueryResult.requireInlineQueryResultArticle(): InlineQueryResultArticle = + this as InlineQueryResultArticle + @PreviewFeature inline fun InlineQueryResult.asInlineQueryResultContact(): InlineQueryResultContact? = this as? InlineQueryResultContact + @PreviewFeature -inline fun InlineQueryResult.requireInlineQueryResultContact(): InlineQueryResultContact = this as InlineQueryResultContact +inline fun InlineQueryResult.requireInlineQueryResultContact(): InlineQueryResultContact = + this as InlineQueryResultContact + @PreviewFeature inline fun InlineQueryResult.asInlineQueryResultGame(): InlineQueryResultGame? = this as? InlineQueryResultGame + @PreviewFeature inline fun InlineQueryResult.requireInlineQueryResultGame(): InlineQueryResultGame = this as InlineQueryResultGame + @PreviewFeature -inline fun InlineQueryResult.asInlineQueryResultLocation(): InlineQueryResultLocation? = this as? InlineQueryResultLocation +inline fun InlineQueryResult.asInlineQueryResultLocation(): InlineQueryResultLocation? = + this as? InlineQueryResultLocation + @PreviewFeature -inline fun InlineQueryResult.requireInlineQueryResultLocation(): InlineQueryResultLocation = this as InlineQueryResultLocation +inline fun InlineQueryResult.requireInlineQueryResultLocation(): InlineQueryResultLocation = + this as InlineQueryResultLocation + @PreviewFeature -inline fun InlineQueryResult.asInlineQueryResultStickerCached(): InlineQueryResultStickerCached? = this as? InlineQueryResultStickerCached +inline fun InlineQueryResult.asInlineQueryResultStickerCached(): InlineQueryResultStickerCached? = + this as? InlineQueryResultStickerCached + @PreviewFeature -inline fun InlineQueryResult.requireInlineQueryResultStickerCached(): InlineQueryResultStickerCached = this as InlineQueryResultStickerCached +inline fun InlineQueryResult.requireInlineQueryResultStickerCached(): InlineQueryResultStickerCached = + this as InlineQueryResultStickerCached + @PreviewFeature inline fun InlineQueryResult.asInlineQueryResultVenue(): InlineQueryResultVenue? = this as? InlineQueryResultVenue + @PreviewFeature inline fun InlineQueryResult.requireInlineQueryResultVenue(): InlineQueryResultVenue = this as InlineQueryResultVenue + @PreviewFeature -inline fun InlineQueryResult.asDescribedInlineQueryResult(): DescribedInlineQueryResult? = this as? DescribedInlineQueryResult +inline fun InlineQueryResult.asDescribedInlineQueryResult(): DescribedInlineQueryResult? = + this as? DescribedInlineQueryResult + @PreviewFeature -inline fun InlineQueryResult.requireDescribedInlineQueryResult(): DescribedInlineQueryResult = this as DescribedInlineQueryResult +inline fun InlineQueryResult.requireDescribedInlineQueryResult(): DescribedInlineQueryResult = + this as DescribedInlineQueryResult + @PreviewFeature inline fun InlineQueryResult.asFileInlineQueryResult(): FileInlineQueryResult? = this as? FileInlineQueryResult + @PreviewFeature inline fun InlineQueryResult.requireFileInlineQueryResult(): FileInlineQueryResult = this as FileInlineQueryResult + @PreviewFeature -inline fun InlineQueryResult.asOptionallyTitledInlineQueryResult(): OptionallyTitledInlineQueryResult? = this as? OptionallyTitledInlineQueryResult +inline fun InlineQueryResult.asOptionallyTitledInlineQueryResult(): OptionallyTitledInlineQueryResult? = + this as? OptionallyTitledInlineQueryResult + @PreviewFeature -inline fun InlineQueryResult.requireOptionallyTitledInlineQueryResult(): OptionallyTitledInlineQueryResult = this as OptionallyTitledInlineQueryResult +inline fun InlineQueryResult.requireOptionallyTitledInlineQueryResult(): OptionallyTitledInlineQueryResult = + this as OptionallyTitledInlineQueryResult + @PreviewFeature inline fun InlineQueryResult.asSizedInlineQueryResult(): SizedInlineQueryResult? = this as? SizedInlineQueryResult + @PreviewFeature inline fun InlineQueryResult.requireSizedInlineQueryResult(): SizedInlineQueryResult = this as SizedInlineQueryResult + @PreviewFeature -inline fun InlineQueryResult.asThumbSizedInlineQueryResult(): ThumbSizedInlineQueryResult? = this as? ThumbSizedInlineQueryResult +inline fun InlineQueryResult.asThumbSizedInlineQueryResult(): ThumbSizedInlineQueryResult? = + this as? ThumbSizedInlineQueryResult + @PreviewFeature -inline fun InlineQueryResult.requireThumbSizedInlineQueryResult(): ThumbSizedInlineQueryResult = this as ThumbSizedInlineQueryResult +inline fun InlineQueryResult.requireThumbSizedInlineQueryResult(): ThumbSizedInlineQueryResult = + this as ThumbSizedInlineQueryResult + @PreviewFeature inline fun InlineQueryResult.asThumbedInlineQueryResult(): ThumbedInlineQueryResult? = this as? ThumbedInlineQueryResult + @PreviewFeature -inline fun InlineQueryResult.requireThumbedInlineQueryResult(): ThumbedInlineQueryResult = this as ThumbedInlineQueryResult +inline fun InlineQueryResult.requireThumbedInlineQueryResult(): ThumbedInlineQueryResult = + this as ThumbedInlineQueryResult + @PreviewFeature -inline fun InlineQueryResult.asThumbedWithMimeTypeInlineQueryResult(): ThumbedWithMimeTypeInlineQueryResult? = this as? ThumbedWithMimeTypeInlineQueryResult +inline fun InlineQueryResult.asThumbedWithMimeTypeInlineQueryResult(): ThumbedWithMimeTypeInlineQueryResult? = + this as? ThumbedWithMimeTypeInlineQueryResult + @PreviewFeature -inline fun InlineQueryResult.requireThumbedWithMimeTypeInlineQueryResult(): ThumbedWithMimeTypeInlineQueryResult = this as ThumbedWithMimeTypeInlineQueryResult +inline fun InlineQueryResult.requireThumbedWithMimeTypeInlineQueryResult(): ThumbedWithMimeTypeInlineQueryResult = + this as ThumbedWithMimeTypeInlineQueryResult + @PreviewFeature inline fun InlineQueryResult.asTitledInlineQueryResult(): TitledInlineQueryResult? = this as? TitledInlineQueryResult + @PreviewFeature inline fun InlineQueryResult.requireTitledInlineQueryResult(): TitledInlineQueryResult = this as TitledInlineQueryResult + @PreviewFeature inline fun InlineQueryResult.asUrlInlineQueryResult(): UrlInlineQueryResult? = this as? UrlInlineQueryResult + @PreviewFeature inline fun InlineQueryResult.requireUrlInlineQueryResult(): UrlInlineQueryResult = this as UrlInlineQueryResult + @PreviewFeature -inline fun InlineQueryResult.asWithInputMessageContentInlineQueryResult(): WithInputMessageContentInlineQueryResult? = this as? WithInputMessageContentInlineQueryResult +inline fun InlineQueryResult.asWithInputMessageContentInlineQueryResult(): WithInputMessageContentInlineQueryResult? = + this as? WithInputMessageContentInlineQueryResult + @PreviewFeature -inline fun InlineQueryResult.requireWithInputMessageContentInlineQueryResult(): WithInputMessageContentInlineQueryResult = this as WithInputMessageContentInlineQueryResult +inline fun InlineQueryResult.requireWithInputMessageContentInlineQueryResult(): WithInputMessageContentInlineQueryResult = + this as WithInputMessageContentInlineQueryResult + @PreviewFeature inline fun InlineQueryResult.asInlineQueryResultAudio(): InlineQueryResultAudio? = this as? InlineQueryResultAudio + @PreviewFeature inline fun InlineQueryResult.requireInlineQueryResultAudio(): InlineQueryResultAudio = this as InlineQueryResultAudio + @PreviewFeature -inline fun InlineQueryResult.asInlineQueryResultAudioCached(): InlineQueryResultAudioCached? = this as? InlineQueryResultAudioCached +inline fun InlineQueryResult.asInlineQueryResultAudioCached(): InlineQueryResultAudioCached? = + this as? InlineQueryResultAudioCached + @PreviewFeature -inline fun InlineQueryResult.requireInlineQueryResultAudioCached(): InlineQueryResultAudioCached = this as InlineQueryResultAudioCached +inline fun InlineQueryResult.requireInlineQueryResultAudioCached(): InlineQueryResultAudioCached = + this as InlineQueryResultAudioCached + @PreviewFeature -inline fun InlineQueryResult.asInlineQueryResultAudioCommon(): InlineQueryResultAudioCommon? = this as? InlineQueryResultAudioCommon +inline fun InlineQueryResult.asInlineQueryResultAudioCommon(): InlineQueryResultAudioCommon? = + this as? InlineQueryResultAudioCommon + @PreviewFeature -inline fun InlineQueryResult.requireInlineQueryResultAudioCommon(): InlineQueryResultAudioCommon = this as InlineQueryResultAudioCommon +inline fun InlineQueryResult.requireInlineQueryResultAudioCommon(): InlineQueryResultAudioCommon = + this as InlineQueryResultAudioCommon + @PreviewFeature -inline fun InlineQueryResult.asInlineQueryResultDocument(): InlineQueryResultDocument? = this as? InlineQueryResultDocument +inline fun InlineQueryResult.asInlineQueryResultDocument(): InlineQueryResultDocument? = + this as? InlineQueryResultDocument + @PreviewFeature -inline fun InlineQueryResult.requireInlineQueryResultDocument(): InlineQueryResultDocument = this as InlineQueryResultDocument +inline fun InlineQueryResult.requireInlineQueryResultDocument(): InlineQueryResultDocument = + this as InlineQueryResultDocument + @PreviewFeature -inline fun InlineQueryResult.asInlineQueryResultDocumentCached(): InlineQueryResultDocumentCached? = this as? InlineQueryResultDocumentCached +inline fun InlineQueryResult.asInlineQueryResultDocumentCached(): InlineQueryResultDocumentCached? = + this as? InlineQueryResultDocumentCached + @PreviewFeature -inline fun InlineQueryResult.requireInlineQueryResultDocumentCached(): InlineQueryResultDocumentCached = this as InlineQueryResultDocumentCached +inline fun InlineQueryResult.requireInlineQueryResultDocumentCached(): InlineQueryResultDocumentCached = + this as InlineQueryResultDocumentCached + @PreviewFeature -inline fun InlineQueryResult.asInlineQueryResultDocumentCommon(): InlineQueryResultDocumentCommon? = this as? InlineQueryResultDocumentCommon +inline fun InlineQueryResult.asInlineQueryResultDocumentCommon(): InlineQueryResultDocumentCommon? = + this as? InlineQueryResultDocumentCommon + @PreviewFeature -inline fun InlineQueryResult.requireInlineQueryResultDocumentCommon(): InlineQueryResultDocumentCommon = this as InlineQueryResultDocumentCommon +inline fun InlineQueryResult.requireInlineQueryResultDocumentCommon(): InlineQueryResultDocumentCommon = + this as InlineQueryResultDocumentCommon + @PreviewFeature inline fun InlineQueryResult.asInlineQueryResultGif(): InlineQueryResultGif? = this as? InlineQueryResultGif + @PreviewFeature inline fun InlineQueryResult.requireInlineQueryResultGif(): InlineQueryResultGif = this as InlineQueryResultGif + @PreviewFeature -inline fun InlineQueryResult.asInlineQueryResultGifCached(): InlineQueryResultGifCached? = this as? InlineQueryResultGifCached +inline fun InlineQueryResult.asInlineQueryResultGifCached(): InlineQueryResultGifCached? = + this as? InlineQueryResultGifCached + @PreviewFeature -inline fun InlineQueryResult.requireInlineQueryResultGifCached(): InlineQueryResultGifCached = this as InlineQueryResultGifCached +inline fun InlineQueryResult.requireInlineQueryResultGifCached(): InlineQueryResultGifCached = + this as InlineQueryResultGifCached + @PreviewFeature -inline fun InlineQueryResult.asInlineQueryResultGifCommon(): InlineQueryResultGifCommon? = this as? InlineQueryResultGifCommon +inline fun InlineQueryResult.asInlineQueryResultGifCommon(): InlineQueryResultGifCommon? = + this as? InlineQueryResultGifCommon + @PreviewFeature -inline fun InlineQueryResult.requireInlineQueryResultGifCommon(): InlineQueryResultGifCommon = this as InlineQueryResultGifCommon +inline fun InlineQueryResult.requireInlineQueryResultGifCommon(): InlineQueryResultGifCommon = + this as InlineQueryResultGifCommon + @PreviewFeature -inline fun InlineQueryResult.asInlineQueryResultMpeg4Gif(): InlineQueryResultMpeg4Gif? = this as? InlineQueryResultMpeg4Gif +inline fun InlineQueryResult.asInlineQueryResultMpeg4Gif(): InlineQueryResultMpeg4Gif? = + this as? InlineQueryResultMpeg4Gif + @PreviewFeature -inline fun InlineQueryResult.requireInlineQueryResultMpeg4Gif(): InlineQueryResultMpeg4Gif = this as InlineQueryResultMpeg4Gif +inline fun InlineQueryResult.requireInlineQueryResultMpeg4Gif(): InlineQueryResultMpeg4Gif = + this as InlineQueryResultMpeg4Gif + @PreviewFeature -inline fun InlineQueryResult.asInlineQueryResultMpeg4GifCached(): InlineQueryResultMpeg4GifCached? = this as? InlineQueryResultMpeg4GifCached +inline fun InlineQueryResult.asInlineQueryResultMpeg4GifCached(): InlineQueryResultMpeg4GifCached? = + this as? InlineQueryResultMpeg4GifCached + @PreviewFeature -inline fun InlineQueryResult.requireInlineQueryResultMpeg4GifCached(): InlineQueryResultMpeg4GifCached = this as InlineQueryResultMpeg4GifCached +inline fun InlineQueryResult.requireInlineQueryResultMpeg4GifCached(): InlineQueryResultMpeg4GifCached = + this as InlineQueryResultMpeg4GifCached + @PreviewFeature -inline fun InlineQueryResult.asInlineQueryResultMpeg4GifCommon(): InlineQueryResultMpeg4GifCommon? = this as? InlineQueryResultMpeg4GifCommon +inline fun InlineQueryResult.asInlineQueryResultMpeg4GifCommon(): InlineQueryResultMpeg4GifCommon? = + this as? InlineQueryResultMpeg4GifCommon + @PreviewFeature -inline fun InlineQueryResult.requireInlineQueryResultMpeg4GifCommon(): InlineQueryResultMpeg4GifCommon = this as InlineQueryResultMpeg4GifCommon +inline fun InlineQueryResult.requireInlineQueryResultMpeg4GifCommon(): InlineQueryResultMpeg4GifCommon = + this as InlineQueryResultMpeg4GifCommon + @PreviewFeature inline fun InlineQueryResult.asInlineQueryResultPhoto(): InlineQueryResultPhoto? = this as? InlineQueryResultPhoto + @PreviewFeature inline fun InlineQueryResult.requireInlineQueryResultPhoto(): InlineQueryResultPhoto = this as InlineQueryResultPhoto + @PreviewFeature -inline fun InlineQueryResult.asInlineQueryResultPhotoCached(): InlineQueryResultPhotoCached? = this as? InlineQueryResultPhotoCached +inline fun InlineQueryResult.asInlineQueryResultPhotoCached(): InlineQueryResultPhotoCached? = + this as? InlineQueryResultPhotoCached + @PreviewFeature -inline fun InlineQueryResult.requireInlineQueryResultPhotoCached(): InlineQueryResultPhotoCached = this as InlineQueryResultPhotoCached +inline fun InlineQueryResult.requireInlineQueryResultPhotoCached(): InlineQueryResultPhotoCached = + this as InlineQueryResultPhotoCached + @PreviewFeature -inline fun InlineQueryResult.asInlineQueryResultPhotoCommon(): InlineQueryResultPhotoCommon? = this as? InlineQueryResultPhotoCommon +inline fun InlineQueryResult.asInlineQueryResultPhotoCommon(): InlineQueryResultPhotoCommon? = + this as? InlineQueryResultPhotoCommon + @PreviewFeature -inline fun InlineQueryResult.requireInlineQueryResultPhotoCommon(): InlineQueryResultPhotoCommon = this as InlineQueryResultPhotoCommon +inline fun InlineQueryResult.requireInlineQueryResultPhotoCommon(): InlineQueryResultPhotoCommon = + this as InlineQueryResultPhotoCommon + @PreviewFeature inline fun InlineQueryResult.asInlineQueryResultVideo(): InlineQueryResultVideo? = this as? InlineQueryResultVideo + @PreviewFeature inline fun InlineQueryResult.requireInlineQueryResultVideo(): InlineQueryResultVideo = this as InlineQueryResultVideo + @PreviewFeature -inline fun InlineQueryResult.asInlineQueryResultVideoCached(): InlineQueryResultVideoCached? = this as? InlineQueryResultVideoCached +inline fun InlineQueryResult.asInlineQueryResultVideoCached(): InlineQueryResultVideoCached? = + this as? InlineQueryResultVideoCached + @PreviewFeature -inline fun InlineQueryResult.requireInlineQueryResultVideoCached(): InlineQueryResultVideoCached = this as InlineQueryResultVideoCached +inline fun InlineQueryResult.requireInlineQueryResultVideoCached(): InlineQueryResultVideoCached = + this as InlineQueryResultVideoCached + @PreviewFeature -inline fun InlineQueryResult.asInlineQueryResultVideoCommon(): InlineQueryResultVideoCommon? = this as? InlineQueryResultVideoCommon +inline fun InlineQueryResult.asInlineQueryResultVideoCommon(): InlineQueryResultVideoCommon? = + this as? InlineQueryResultVideoCommon + @PreviewFeature -inline fun InlineQueryResult.requireInlineQueryResultVideoCommon(): InlineQueryResultVideoCommon = this as InlineQueryResultVideoCommon +inline fun InlineQueryResult.requireInlineQueryResultVideoCommon(): InlineQueryResultVideoCommon = + this as InlineQueryResultVideoCommon + @PreviewFeature inline fun InlineQueryResult.asInlineQueryResultVoice(): InlineQueryResultVoice? = this as? InlineQueryResultVoice + @PreviewFeature inline fun InlineQueryResult.requireInlineQueryResultVoice(): InlineQueryResultVoice = this as InlineQueryResultVoice + @PreviewFeature -inline fun InlineQueryResult.asInlineQueryResultVoiceCached(): InlineQueryResultVoiceCached? = this as? InlineQueryResultVoiceCached +inline fun InlineQueryResult.asInlineQueryResultVoiceCached(): InlineQueryResultVoiceCached? = + this as? InlineQueryResultVoiceCached + @PreviewFeature -inline fun InlineQueryResult.requireInlineQueryResultVoiceCached(): InlineQueryResultVoiceCached = this as InlineQueryResultVoiceCached +inline fun InlineQueryResult.requireInlineQueryResultVoiceCached(): InlineQueryResultVoiceCached = + this as InlineQueryResultVoiceCached + @PreviewFeature -inline fun InlineQueryResult.asInlineQueryResultVoiceCommon(): InlineQueryResultVoiceCommon? = this as? InlineQueryResultVoiceCommon +inline fun InlineQueryResult.asInlineQueryResultVoiceCommon(): InlineQueryResultVoiceCommon? = + this as? InlineQueryResultVoiceCommon + @PreviewFeature -inline fun InlineQueryResult.requireInlineQueryResultVoiceCommon(): InlineQueryResultVoiceCommon = this as InlineQueryResultVoiceCommon +inline fun InlineQueryResult.requireInlineQueryResultVoiceCommon(): InlineQueryResultVoiceCommon = + this as InlineQueryResultVoiceCommon + @PreviewFeature inline fun ChatMember.asCreatorChatMember(): CreatorChatMember? = this as? CreatorChatMember + @PreviewFeature inline fun ChatMember.requireCreatorChatMember(): CreatorChatMember = this as CreatorChatMember + @PreviewFeature inline fun ChatMember.asKickedChatMember(): KickedChatMember? = this as? KickedChatMember + @PreviewFeature inline fun ChatMember.requireKickedChatMember(): KickedChatMember = this as KickedChatMember + @PreviewFeature inline fun ChatMember.asLeftChatMember(): LeftChatMember? = this as? LeftChatMember + @PreviewFeature inline fun ChatMember.requireLeftChatMember(): LeftChatMember = this as LeftChatMember + @PreviewFeature inline fun ChatMember.asMemberChatMember(): MemberChatMember? = this as? MemberChatMember + @PreviewFeature inline fun ChatMember.requireMemberChatMember(): MemberChatMember = this as MemberChatMember + @PreviewFeature inline fun ChatMember.asRestrictedChatMember(): RestrictedChatMember? = this as? RestrictedChatMember + @PreviewFeature inline fun ChatMember.requireRestrictedChatMember(): RestrictedChatMember = this as RestrictedChatMember + @PreviewFeature inline fun ChatMember.asAdministratorChatMember(): AdministratorChatMember? = this as? AdministratorChatMember + @PreviewFeature inline fun ChatMember.requireAdministratorChatMember(): AdministratorChatMember = this as AdministratorChatMember + @PreviewFeature inline fun ChatMember.asBannedChatMember(): BannedChatMember? = this as? BannedChatMember + @PreviewFeature inline fun ChatMember.requireBannedChatMember(): BannedChatMember = this as BannedChatMember + @PreviewFeature inline fun ChatMember.asSpecialRightsChatMember(): SpecialRightsChatMember? = this as? SpecialRightsChatMember + @PreviewFeature inline fun ChatMember.requireSpecialRightsChatMember(): SpecialRightsChatMember = this as SpecialRightsChatMember + @PreviewFeature -inline fun InputMedia.asAudioMediaGroupMemberInputMedia(): AudioMediaGroupMemberInputMedia? = this as? AudioMediaGroupMemberInputMedia +inline fun InputMedia.asAudioMediaGroupMemberInputMedia(): AudioMediaGroupMemberInputMedia? = + this as? AudioMediaGroupMemberInputMedia + @PreviewFeature -inline fun InputMedia.requireAudioMediaGroupMemberInputMedia(): AudioMediaGroupMemberInputMedia = this as AudioMediaGroupMemberInputMedia +inline fun InputMedia.requireAudioMediaGroupMemberInputMedia(): AudioMediaGroupMemberInputMedia = + this as AudioMediaGroupMemberInputMedia + @PreviewFeature -inline fun InputMedia.asDocumentMediaGroupMemberInputMedia(): DocumentMediaGroupMemberInputMedia? = this as? DocumentMediaGroupMemberInputMedia +inline fun InputMedia.asDocumentMediaGroupMemberInputMedia(): DocumentMediaGroupMemberInputMedia? = + this as? DocumentMediaGroupMemberInputMedia + @PreviewFeature -inline fun InputMedia.requireDocumentMediaGroupMemberInputMedia(): DocumentMediaGroupMemberInputMedia = this as DocumentMediaGroupMemberInputMedia +inline fun InputMedia.requireDocumentMediaGroupMemberInputMedia(): DocumentMediaGroupMemberInputMedia = + this as DocumentMediaGroupMemberInputMedia + @PreviewFeature inline fun InputMedia.asDuratedInputMedia(): DuratedInputMedia? = this as? DuratedInputMedia + @PreviewFeature inline fun InputMedia.requireDuratedInputMedia(): DuratedInputMedia = this as DuratedInputMedia + @PreviewFeature inline fun InputMedia.asInputMediaAnimation(): InputMediaAnimation? = this as? InputMediaAnimation + @PreviewFeature inline fun InputMedia.requireInputMediaAnimation(): InputMediaAnimation = this as InputMediaAnimation + @PreviewFeature inline fun InputMedia.asInputMediaAudio(): InputMediaAudio? = this as? InputMediaAudio + @PreviewFeature inline fun InputMedia.requireInputMediaAudio(): InputMediaAudio = this as InputMediaAudio + @PreviewFeature inline fun InputMedia.asInputMediaDocument(): InputMediaDocument? = this as? InputMediaDocument + @PreviewFeature inline fun InputMedia.requireInputMediaDocument(): InputMediaDocument = this as InputMediaDocument + @PreviewFeature inline fun InputMedia.asInputMediaPhoto(): InputMediaPhoto? = this as? InputMediaPhoto + @PreviewFeature inline fun InputMedia.requireInputMediaPhoto(): InputMediaPhoto = this as InputMediaPhoto + @PreviewFeature inline fun InputMedia.asInputMediaVideo(): InputMediaVideo? = this as? InputMediaVideo + @PreviewFeature inline fun InputMedia.requireInputMediaVideo(): InputMediaVideo = this as InputMediaVideo + @PreviewFeature inline fun InputMedia.asMediaGroupMemberInputMedia(): MediaGroupMemberInputMedia? = this as? MediaGroupMemberInputMedia + @PreviewFeature -inline fun InputMedia.requireMediaGroupMemberInputMedia(): MediaGroupMemberInputMedia = this as MediaGroupMemberInputMedia +inline fun InputMedia.requireMediaGroupMemberInputMedia(): MediaGroupMemberInputMedia = + this as MediaGroupMemberInputMedia + @PreviewFeature inline fun InputMedia.asSizedInputMedia(): SizedInputMedia? = this as? SizedInputMedia + @PreviewFeature inline fun InputMedia.requireSizedInputMedia(): SizedInputMedia = this as SizedInputMedia + @PreviewFeature inline fun InputMedia.asThumbedInputMedia(): ThumbedInputMedia? = this as? ThumbedInputMedia + @PreviewFeature inline fun InputMedia.requireThumbedInputMedia(): ThumbedInputMedia = this as ThumbedInputMedia + @PreviewFeature inline fun InputMedia.asTitledInputMedia(): TitledInputMedia? = this as? TitledInputMedia + @PreviewFeature inline fun InputMedia.requireTitledInputMedia(): TitledInputMedia = this as TitledInputMedia + @PreviewFeature -inline fun InputMedia.asVisualMediaGroupMemberInputMedia(): VisualMediaGroupMemberInputMedia? = this as? VisualMediaGroupMemberInputMedia +inline fun InputMedia.asVisualMediaGroupMemberInputMedia(): VisualMediaGroupMemberInputMedia? = + this as? VisualMediaGroupMemberInputMedia + @PreviewFeature -inline fun InputMedia.requireVisualMediaGroupMemberInputMedia(): VisualMediaGroupMemberInputMedia = this as VisualMediaGroupMemberInputMedia +inline fun InputMedia.requireVisualMediaGroupMemberInputMedia(): VisualMediaGroupMemberInputMedia = + this as VisualMediaGroupMemberInputMedia + @PreviewFeature inline fun Update.asCallbackQueryUpdate(): CallbackQueryUpdate? = this as? CallbackQueryUpdate + @PreviewFeature inline fun Update.requireCallbackQueryUpdate(): CallbackQueryUpdate = this as CallbackQueryUpdate + @PreviewFeature inline fun Update.asChannelPostUpdate(): ChannelPostUpdate? = this as? ChannelPostUpdate + @PreviewFeature inline fun Update.requireChannelPostUpdate(): ChannelPostUpdate = this as ChannelPostUpdate + @PreviewFeature inline fun Update.asChosenInlineResultUpdate(): ChosenInlineResultUpdate? = this as? ChosenInlineResultUpdate + @PreviewFeature inline fun Update.requireChosenInlineResultUpdate(): ChosenInlineResultUpdate = this as ChosenInlineResultUpdate + @PreviewFeature inline fun Update.asEditChannelPostUpdate(): EditChannelPostUpdate? = this as? EditChannelPostUpdate + @PreviewFeature inline fun Update.requireEditChannelPostUpdate(): EditChannelPostUpdate = this as EditChannelPostUpdate + @PreviewFeature inline fun Update.asEditMessageUpdate(): EditMessageUpdate? = this as? EditMessageUpdate + @PreviewFeature inline fun Update.requireEditMessageUpdate(): EditMessageUpdate = this as EditMessageUpdate + @PreviewFeature inline fun Update.asInlineQueryUpdate(): InlineQueryUpdate? = this as? InlineQueryUpdate + @PreviewFeature inline fun Update.requireInlineQueryUpdate(): InlineQueryUpdate = this as InlineQueryUpdate + @PreviewFeature inline fun Update.asChannelPostMediaGroupUpdate(): ChannelPostMediaGroupUpdate? = this as? ChannelPostMediaGroupUpdate + @PreviewFeature -inline fun Update.requireChannelPostMediaGroupUpdate(): ChannelPostMediaGroupUpdate = this as ChannelPostMediaGroupUpdate +inline fun Update.requireChannelPostMediaGroupUpdate(): ChannelPostMediaGroupUpdate = + this as ChannelPostMediaGroupUpdate + @PreviewFeature -inline fun Update.asEditChannelPostMediaGroupUpdate(): EditChannelPostMediaGroupUpdate? = this as? EditChannelPostMediaGroupUpdate +inline fun Update.asEditChannelPostMediaGroupUpdate(): EditChannelPostMediaGroupUpdate? = + this as? EditChannelPostMediaGroupUpdate + @PreviewFeature -inline fun Update.requireEditChannelPostMediaGroupUpdate(): EditChannelPostMediaGroupUpdate = this as EditChannelPostMediaGroupUpdate +inline fun Update.requireEditChannelPostMediaGroupUpdate(): EditChannelPostMediaGroupUpdate = + this as EditChannelPostMediaGroupUpdate + @PreviewFeature inline fun Update.asEditMediaGroupUpdate(): EditMediaGroupUpdate? = this as? EditMediaGroupUpdate + @PreviewFeature inline fun Update.requireEditMediaGroupUpdate(): EditMediaGroupUpdate = this as EditMediaGroupUpdate + @PreviewFeature inline fun Update.asEditMessageMediaGroupUpdate(): EditMessageMediaGroupUpdate? = this as? EditMessageMediaGroupUpdate + @PreviewFeature -inline fun Update.requireEditMessageMediaGroupUpdate(): EditMessageMediaGroupUpdate = this as EditMessageMediaGroupUpdate +inline fun Update.requireEditMessageMediaGroupUpdate(): EditMessageMediaGroupUpdate = + this as EditMessageMediaGroupUpdate + @PreviewFeature inline fun Update.asMediaGroupUpdate(): MediaGroupUpdate? = this as? MediaGroupUpdate + @PreviewFeature inline fun Update.requireMediaGroupUpdate(): MediaGroupUpdate = this as MediaGroupUpdate + @PreviewFeature inline fun Update.asMessageMediaGroupUpdate(): MessageMediaGroupUpdate? = this as? MessageMediaGroupUpdate + @PreviewFeature inline fun Update.requireMessageMediaGroupUpdate(): MessageMediaGroupUpdate = this as MessageMediaGroupUpdate + @PreviewFeature inline fun Update.asSentMediaGroupUpdate(): SentMediaGroupUpdate? = this as? SentMediaGroupUpdate + @PreviewFeature inline fun Update.requireSentMediaGroupUpdate(): SentMediaGroupUpdate = this as SentMediaGroupUpdate + @PreviewFeature inline fun Update.asMessageUpdate(): MessageUpdate? = this as? MessageUpdate + @PreviewFeature inline fun Update.requireMessageUpdate(): MessageUpdate = this as MessageUpdate + @PreviewFeature inline fun Update.asPollAnswerUpdate(): PollAnswerUpdate? = this as? PollAnswerUpdate + @PreviewFeature inline fun Update.requirePollAnswerUpdate(): PollAnswerUpdate = this as PollAnswerUpdate + @PreviewFeature inline fun Update.asPollUpdate(): PollUpdate? = this as? PollUpdate + @PreviewFeature inline fun Update.requirePollUpdate(): PollUpdate = this as PollUpdate + @PreviewFeature inline fun Update.asPreCheckoutQueryUpdate(): PreCheckoutQueryUpdate? = this as? PreCheckoutQueryUpdate + @PreviewFeature inline fun Update.requirePreCheckoutQueryUpdate(): PreCheckoutQueryUpdate = this as PreCheckoutQueryUpdate + @PreviewFeature inline fun Update.asShippingQueryUpdate(): ShippingQueryUpdate? = this as? ShippingQueryUpdate + @PreviewFeature inline fun Update.requireShippingQueryUpdate(): ShippingQueryUpdate = this as ShippingQueryUpdate + @PreviewFeature inline fun Update.asBaseEditMessageUpdate(): BaseEditMessageUpdate? = this as? BaseEditMessageUpdate + @PreviewFeature inline fun Update.requireBaseEditMessageUpdate(): BaseEditMessageUpdate = this as BaseEditMessageUpdate + @PreviewFeature inline fun Update.asBaseMessageUpdate(): BaseMessageUpdate? = this as? BaseMessageUpdate + @PreviewFeature inline fun Update.requireBaseMessageUpdate(): BaseMessageUpdate = this as BaseMessageUpdate + @PreviewFeature inline fun Update.asBaseSentMessageUpdate(): BaseSentMessageUpdate? = this as? BaseSentMessageUpdate + @PreviewFeature inline fun Update.requireBaseSentMessageUpdate(): BaseSentMessageUpdate = this as BaseSentMessageUpdate + @PreviewFeature inline fun Update.asUnknownUpdate(): UnknownUpdate? = this as? UnknownUpdate + @PreviewFeature inline fun Update.requireUnknownUpdate(): UnknownUpdate = this as UnknownUpdate + @PreviewFeature -inline fun Update.asCommonChatMemberUpdatedUpdate(): CommonChatMemberUpdatedUpdate? = this as? CommonChatMemberUpdatedUpdate +inline fun Update.asCommonChatMemberUpdatedUpdate(): CommonChatMemberUpdatedUpdate? = + this as? CommonChatMemberUpdatedUpdate + @PreviewFeature -inline fun Update.requireCommonChatMemberUpdatedUpdate(): CommonChatMemberUpdatedUpdate = this as CommonChatMemberUpdatedUpdate +inline fun Update.requireCommonChatMemberUpdatedUpdate(): CommonChatMemberUpdatedUpdate = + this as CommonChatMemberUpdatedUpdate + @PreviewFeature inline fun Update.asMyChatMemberUpdatedUpdate(): MyChatMemberUpdatedUpdate? = this as? MyChatMemberUpdatedUpdate + @PreviewFeature inline fun Update.requireMyChatMemberUpdatedUpdate(): MyChatMemberUpdatedUpdate = this as MyChatMemberUpdatedUpdate + @PreviewFeature inline fun Update.asChatMemberUpdatedUpdate(): ChatMemberUpdatedUpdate? = this as? ChatMemberUpdatedUpdate + @PreviewFeature inline fun Update.requireChatMemberUpdatedUpdate(): ChatMemberUpdatedUpdate = this as ChatMemberUpdatedUpdate + @PreviewFeature inline fun TelegramMediaFile.asAnimationFile(): AnimationFile? = this as? AnimationFile + @PreviewFeature inline fun TelegramMediaFile.requireAnimationFile(): AnimationFile = this as AnimationFile + @PreviewFeature inline fun TelegramMediaFile.asAudioFile(): AudioFile? = this as? AudioFile + @PreviewFeature inline fun TelegramMediaFile.requireAudioFile(): AudioFile = this as AudioFile + @PreviewFeature inline fun TelegramMediaFile.asDocumentFile(): DocumentFile? = this as? DocumentFile + @PreviewFeature inline fun TelegramMediaFile.requireDocumentFile(): DocumentFile = this as DocumentFile + @PreviewFeature inline fun TelegramMediaFile.asFile(): File? = this as? File + @PreviewFeature inline fun TelegramMediaFile.requireFile(): File = this as File + @PreviewFeature inline fun TelegramMediaFile.asPathedFile(): PathedFile? = this as? PathedFile + @PreviewFeature inline fun TelegramMediaFile.requirePathedFile(): PathedFile = this as PathedFile + @PreviewFeature inline fun TelegramMediaFile.asPhotoSize(): PhotoSize? = this as? PhotoSize + @PreviewFeature inline fun TelegramMediaFile.requirePhotoSize(): PhotoSize = this as PhotoSize + @PreviewFeature inline fun TelegramMediaFile.asSticker(): Sticker? = this as? Sticker + @PreviewFeature inline fun TelegramMediaFile.requireSticker(): Sticker = this as Sticker + @PreviewFeature inline fun TelegramMediaFile.asVideoFile(): VideoFile? = this as? VideoFile + @PreviewFeature inline fun TelegramMediaFile.requireVideoFile(): VideoFile = this as VideoFile + @PreviewFeature inline fun TelegramMediaFile.asVideoNoteFile(): VideoNoteFile? = this as? VideoNoteFile + @PreviewFeature inline fun TelegramMediaFile.requireVideoNoteFile(): VideoNoteFile = this as VideoNoteFile + @PreviewFeature inline fun TelegramMediaFile.asVoiceFile(): VoiceFile? = this as? VoiceFile + @PreviewFeature inline fun TelegramMediaFile.requireVoiceFile(): VoiceFile = this as VoiceFile + @PreviewFeature inline fun TelegramMediaFile.asMimedMediaFile(): MimedMediaFile? = this as? MimedMediaFile + @PreviewFeature inline fun TelegramMediaFile.requireMimedMediaFile(): MimedMediaFile = this as MimedMediaFile + @PreviewFeature inline fun TelegramMediaFile.asPlayableMediaFile(): PlayableMediaFile? = this as? PlayableMediaFile + @PreviewFeature inline fun TelegramMediaFile.requirePlayableMediaFile(): PlayableMediaFile = this as PlayableMediaFile + @PreviewFeature inline fun TelegramMediaFile.asSizedMediaFile(): SizedMediaFile? = this as? SizedMediaFile + @PreviewFeature inline fun TelegramMediaFile.requireSizedMediaFile(): SizedMediaFile = this as SizedMediaFile + @PreviewFeature inline fun TelegramMediaFile.asThumbedMediaFile(): ThumbedMediaFile? = this as? ThumbedMediaFile + @PreviewFeature inline fun TelegramMediaFile.requireThumbedMediaFile(): ThumbedMediaFile = this as ThumbedMediaFile + @PreviewFeature inline fun KeyboardMarkup.asForceReply(): ReplyForce? = this as? ReplyForce + @PreviewFeature inline fun KeyboardMarkup.requireForceReply(): ReplyForce = this as ReplyForce + @PreviewFeature inline fun KeyboardMarkup.asInlineKeyboardMarkup(): InlineKeyboardMarkup? = this as? InlineKeyboardMarkup + @PreviewFeature inline fun KeyboardMarkup.requireInlineKeyboardMarkup(): InlineKeyboardMarkup = this as InlineKeyboardMarkup + @PreviewFeature inline fun KeyboardMarkup.asReplyKeyboardMarkup(): ReplyKeyboardMarkup? = this as? ReplyKeyboardMarkup + @PreviewFeature inline fun KeyboardMarkup.requireReplyKeyboardMarkup(): ReplyKeyboardMarkup = this as ReplyKeyboardMarkup + @PreviewFeature inline fun KeyboardMarkup.asReplyKeyboardRemove(): ReplyKeyboardRemove? = this as? ReplyKeyboardRemove + @PreviewFeature inline fun KeyboardMarkup.requireReplyKeyboardRemove(): ReplyKeyboardRemove = this as ReplyKeyboardRemove + @PreviewFeature -inline fun InlineKeyboardButton.asCallbackDataInlineKeyboardButton(): CallbackDataInlineKeyboardButton? = this as? CallbackDataInlineKeyboardButton +inline fun InlineKeyboardButton.asCallbackDataInlineKeyboardButton(): CallbackDataInlineKeyboardButton? = + this as? CallbackDataInlineKeyboardButton + @PreviewFeature -inline fun InlineKeyboardButton.requireCallbackDataInlineKeyboardButton(): CallbackDataInlineKeyboardButton = this as CallbackDataInlineKeyboardButton +inline fun InlineKeyboardButton.requireCallbackDataInlineKeyboardButton(): CallbackDataInlineKeyboardButton = + this as CallbackDataInlineKeyboardButton + @PreviewFeature -inline fun InlineKeyboardButton.asCallbackGameInlineKeyboardButton(): CallbackGameInlineKeyboardButton? = this as? CallbackGameInlineKeyboardButton +inline fun InlineKeyboardButton.asCallbackGameInlineKeyboardButton(): CallbackGameInlineKeyboardButton? = + this as? CallbackGameInlineKeyboardButton + @PreviewFeature -inline fun InlineKeyboardButton.requireCallbackGameInlineKeyboardButton(): CallbackGameInlineKeyboardButton = this as CallbackGameInlineKeyboardButton +inline fun InlineKeyboardButton.requireCallbackGameInlineKeyboardButton(): CallbackGameInlineKeyboardButton = + this as CallbackGameInlineKeyboardButton + @PreviewFeature -inline fun InlineKeyboardButton.asLoginURLInlineKeyboardButton(): LoginURLInlineKeyboardButton? = this as? LoginURLInlineKeyboardButton +inline fun InlineKeyboardButton.asLoginURLInlineKeyboardButton(): LoginURLInlineKeyboardButton? = + this as? LoginURLInlineKeyboardButton + @PreviewFeature -inline fun InlineKeyboardButton.requireLoginURLInlineKeyboardButton(): LoginURLInlineKeyboardButton = this as LoginURLInlineKeyboardButton +inline fun InlineKeyboardButton.requireLoginURLInlineKeyboardButton(): LoginURLInlineKeyboardButton = + this as LoginURLInlineKeyboardButton + @PreviewFeature inline fun InlineKeyboardButton.asPayInlineKeyboardButton(): PayInlineKeyboardButton? = this as? PayInlineKeyboardButton + @PreviewFeature -inline fun InlineKeyboardButton.requirePayInlineKeyboardButton(): PayInlineKeyboardButton = this as PayInlineKeyboardButton +inline fun InlineKeyboardButton.requirePayInlineKeyboardButton(): PayInlineKeyboardButton = + this as PayInlineKeyboardButton + @PreviewFeature -inline fun InlineKeyboardButton.asSwitchInlineQueryCurrentChatInlineKeyboardButton(): SwitchInlineQueryCurrentChatInlineKeyboardButton? = this as? SwitchInlineQueryCurrentChatInlineKeyboardButton +inline fun InlineKeyboardButton.asSwitchInlineQueryCurrentChatInlineKeyboardButton(): SwitchInlineQueryCurrentChatInlineKeyboardButton? = + this as? SwitchInlineQueryCurrentChatInlineKeyboardButton + @PreviewFeature -inline fun InlineKeyboardButton.requireSwitchInlineQueryCurrentChatInlineKeyboardButton(): SwitchInlineQueryCurrentChatInlineKeyboardButton = this as SwitchInlineQueryCurrentChatInlineKeyboardButton +inline fun InlineKeyboardButton.requireSwitchInlineQueryCurrentChatInlineKeyboardButton(): SwitchInlineQueryCurrentChatInlineKeyboardButton = + this as SwitchInlineQueryCurrentChatInlineKeyboardButton + @PreviewFeature -inline fun InlineKeyboardButton.asSwitchInlineQueryInlineKeyboardButton(): SwitchInlineQueryInlineKeyboardButton? = this as? SwitchInlineQueryInlineKeyboardButton +inline fun InlineKeyboardButton.asSwitchInlineQueryInlineKeyboardButton(): SwitchInlineQueryInlineKeyboardButton? = + this as? SwitchInlineQueryInlineKeyboardButton + @PreviewFeature -inline fun InlineKeyboardButton.requireSwitchInlineQueryInlineKeyboardButton(): SwitchInlineQueryInlineKeyboardButton = this as SwitchInlineQueryInlineKeyboardButton +inline fun InlineKeyboardButton.requireSwitchInlineQueryInlineKeyboardButton(): SwitchInlineQueryInlineKeyboardButton = + this as SwitchInlineQueryInlineKeyboardButton + @PreviewFeature inline fun InlineKeyboardButton.asURLInlineKeyboardButton(): URLInlineKeyboardButton? = this as? URLInlineKeyboardButton + @PreviewFeature -inline fun InlineKeyboardButton.requireURLInlineKeyboardButton(): URLInlineKeyboardButton = this as URLInlineKeyboardButton +inline fun InlineKeyboardButton.requireURLInlineKeyboardButton(): URLInlineKeyboardButton = + this as URLInlineKeyboardButton + @PreviewFeature -inline fun InlineKeyboardButton.asUnknownInlineKeyboardButton(): UnknownInlineKeyboardButton? = this as? UnknownInlineKeyboardButton +inline fun InlineKeyboardButton.asUnknownInlineKeyboardButton(): UnknownInlineKeyboardButton? = + this as? UnknownInlineKeyboardButton + @PreviewFeature -inline fun InlineKeyboardButton.requireUnknownInlineKeyboardButton(): UnknownInlineKeyboardButton = this as UnknownInlineKeyboardButton +inline fun InlineKeyboardButton.requireUnknownInlineKeyboardButton(): UnknownInlineKeyboardButton = + this as UnknownInlineKeyboardButton + @PreviewFeature inline fun Poll.asMultipleAnswersPoll(): MultipleAnswersPoll? = this as? MultipleAnswersPoll + @PreviewFeature inline fun Poll.requireMultipleAnswersPoll(): MultipleAnswersPoll = this as MultipleAnswersPoll + @PreviewFeature inline fun Poll.asQuizPoll(): QuizPoll? = this as? QuizPoll + @PreviewFeature inline fun Poll.requireQuizPoll(): QuizPoll = this as QuizPoll + @PreviewFeature inline fun Poll.asRegularPoll(): RegularPoll? = this as? RegularPoll + @PreviewFeature inline fun Poll.requireRegularPoll(): RegularPoll = this as RegularPoll + @PreviewFeature inline fun Poll.asUnknownPollType(): UnknownPollType? = this as? UnknownPollType + @PreviewFeature inline fun Poll.requireUnknownPollType(): UnknownPollType = this as UnknownPollType + @PreviewFeature inline fun ResendableContent.asContactContent(): ContactContent? = this as? ContactContent + @PreviewFeature inline fun ResendableContent.requireContactContent(): ContactContent = this as ContactContent + @PreviewFeature inline fun ResendableContent.asDiceContent(): DiceContent? = this as? DiceContent + @PreviewFeature inline fun ResendableContent.requireDiceContent(): DiceContent = this as DiceContent + @PreviewFeature inline fun ResendableContent.asGameContent(): GameContent? = this as? GameContent + @PreviewFeature inline fun ResendableContent.requireGameContent(): GameContent = this as GameContent + @PreviewFeature inline fun ResendableContent.asLocationContent(): LocationContent? = this as? LocationContent + @PreviewFeature inline fun ResendableContent.requireLocationContent(): LocationContent = this as LocationContent + @PreviewFeature inline fun ResendableContent.asPollContent(): PollContent? = this as? PollContent + @PreviewFeature inline fun ResendableContent.requirePollContent(): PollContent = this as PollContent + @PreviewFeature inline fun ResendableContent.asTextContent(): TextContent? = this as? TextContent + @PreviewFeature inline fun ResendableContent.requireTextContent(): TextContent = this as TextContent + @PreviewFeature inline fun ResendableContent.asVenueContent(): VenueContent? = this as? VenueContent + @PreviewFeature inline fun ResendableContent.requireVenueContent(): VenueContent = this as VenueContent + @PreviewFeature inline fun ResendableContent.asAudioMediaGroupContent(): AudioMediaGroupContent? = this as? AudioMediaGroupContent + @PreviewFeature inline fun ResendableContent.requireAudioMediaGroupContent(): AudioMediaGroupContent = this as AudioMediaGroupContent + @PreviewFeature -inline fun ResendableContent.asDocumentMediaGroupContent(): DocumentMediaGroupContent? = this as? DocumentMediaGroupContent +inline fun ResendableContent.asDocumentMediaGroupContent(): DocumentMediaGroupContent? = + this as? DocumentMediaGroupContent + @PreviewFeature -inline fun ResendableContent.requireDocumentMediaGroupContent(): DocumentMediaGroupContent = this as DocumentMediaGroupContent +inline fun ResendableContent.requireDocumentMediaGroupContent(): DocumentMediaGroupContent = + this as DocumentMediaGroupContent + @PreviewFeature -inline fun ResendableContent.asMediaCollectionContent(): MediaCollectionContent? = this as? MediaCollectionContent +inline fun ResendableContent.asMediaCollectionContent(): MediaCollectionContent? = + this as? MediaCollectionContent + @PreviewFeature -inline fun ResendableContent.requireMediaCollectionContent(): MediaCollectionContent = this as MediaCollectionContent +inline fun ResendableContent.requireMediaCollectionContent(): MediaCollectionContent = + this as MediaCollectionContent + @PreviewFeature inline fun ResendableContent.asMediaContent(): MediaContent? = this as? MediaContent + @PreviewFeature inline fun ResendableContent.requireMediaContent(): MediaContent = this as MediaContent + @PreviewFeature inline fun ResendableContent.asMediaGroupContent(): MediaGroupContent? = this as? MediaGroupContent + @PreviewFeature inline fun ResendableContent.requireMediaGroupContent(): MediaGroupContent = this as MediaGroupContent + @PreviewFeature inline fun ResendableContent.asMessageContent(): MessageContent? = this as? MessageContent + @PreviewFeature inline fun ResendableContent.requireMessageContent(): MessageContent = this as MessageContent + @PreviewFeature inline fun ResendableContent.asVisualMediaGroupContent(): VisualMediaGroupContent? = this as? VisualMediaGroupContent + @PreviewFeature inline fun ResendableContent.requireVisualMediaGroupContent(): VisualMediaGroupContent = this as VisualMediaGroupContent + @PreviewFeature inline fun ResendableContent.asAnimationContent(): AnimationContent? = this as? AnimationContent + @PreviewFeature inline fun ResendableContent.requireAnimationContent(): AnimationContent = this as AnimationContent + @PreviewFeature inline fun ResendableContent.asAudioContent(): AudioContent? = this as? AudioContent + @PreviewFeature inline fun ResendableContent.requireAudioContent(): AudioContent = this as AudioContent + @PreviewFeature inline fun ResendableContent.asDocumentContent(): DocumentContent? = this as? DocumentContent + @PreviewFeature inline fun ResendableContent.requireDocumentContent(): DocumentContent = this as DocumentContent + @PreviewFeature inline fun ResendableContent.asPhotoContent(): PhotoContent? = this as? PhotoContent + @PreviewFeature inline fun ResendableContent.requirePhotoContent(): PhotoContent = this as PhotoContent + @PreviewFeature inline fun ResendableContent.asStickerContent(): StickerContent? = this as? StickerContent + @PreviewFeature inline fun ResendableContent.requireStickerContent(): StickerContent = this as StickerContent + @PreviewFeature inline fun ResendableContent.asVideoContent(): VideoContent? = this as? VideoContent + @PreviewFeature inline fun ResendableContent.requireVideoContent(): VideoContent = this as VideoContent + @PreviewFeature inline fun ResendableContent.asVideoNoteContent(): VideoNoteContent? = this as? VideoNoteContent + @PreviewFeature inline fun ResendableContent.requireVideoNoteContent(): VideoNoteContent = this as VideoNoteContent + @PreviewFeature inline fun ResendableContent.asVoiceContent(): VoiceContent? = this as? VoiceContent + @PreviewFeature inline fun ResendableContent.requireVoiceContent(): VoiceContent = this as VoiceContent + @PreviewFeature inline fun ResendableContent.asInvoiceContent(): InvoiceContent? = this as? InvoiceContent + @PreviewFeature inline fun ResendableContent.requireInvoiceContent(): InvoiceContent = this as InvoiceContent + @PreviewFeature inline fun TextSource.asMultilevelTextSource(): MultilevelTextSource? = this as? MultilevelTextSource + @PreviewFeature inline fun TextSource.requireMultilevelTextSource(): MultilevelTextSource = this as MultilevelTextSource + @PreviewFeature inline fun TextSource.asBoldTextSource(): BoldTextSource? = this as? BoldTextSource + @PreviewFeature inline fun TextSource.requireBoldTextSource(): BoldTextSource = this as BoldTextSource + @PreviewFeature inline fun TextSource.asBotCommandTextSource(): BotCommandTextSource? = this as? BotCommandTextSource + @PreviewFeature inline fun TextSource.requireBotCommandTextSource(): BotCommandTextSource = this as BotCommandTextSource + @PreviewFeature inline fun TextSource.asCashTagTextSource(): CashTagTextSource? = this as? CashTagTextSource + @PreviewFeature inline fun TextSource.requireCashTagTextSource(): CashTagTextSource = this as CashTagTextSource + @PreviewFeature inline fun TextSource.asCodeTextSource(): CodeTextSource? = this as? CodeTextSource + @PreviewFeature inline fun TextSource.requireCodeTextSource(): CodeTextSource = this as CodeTextSource + @PreviewFeature inline fun TextSource.asEMailTextSource(): EMailTextSource? = this as? EMailTextSource + @PreviewFeature inline fun TextSource.requireEMailTextSource(): EMailTextSource = this as EMailTextSource + @PreviewFeature inline fun TextSource.asHashTagTextSource(): HashTagTextSource? = this as? HashTagTextSource + @PreviewFeature inline fun TextSource.requireHashTagTextSource(): HashTagTextSource = this as HashTagTextSource + @PreviewFeature inline fun TextSource.asItalicTextSource(): ItalicTextSource? = this as? ItalicTextSource + @PreviewFeature inline fun TextSource.requireItalicTextSource(): ItalicTextSource = this as ItalicTextSource + @PreviewFeature inline fun TextSource.asMentionTextSource(): MentionTextSource? = this as? MentionTextSource + @PreviewFeature inline fun TextSource.requireMentionTextSource(): MentionTextSource = this as MentionTextSource + @PreviewFeature inline fun TextSource.asPhoneNumberTextSource(): PhoneNumberTextSource? = this as? PhoneNumberTextSource + @PreviewFeature inline fun TextSource.requirePhoneNumberTextSource(): PhoneNumberTextSource = this as PhoneNumberTextSource + @PreviewFeature inline fun TextSource.asPreTextSource(): PreTextSource? = this as? PreTextSource + @PreviewFeature inline fun TextSource.requirePreTextSource(): PreTextSource = this as PreTextSource + @PreviewFeature inline fun TextSource.asRegularTextSource(): RegularTextSource? = this as? RegularTextSource + @PreviewFeature inline fun TextSource.requireRegularTextSource(): RegularTextSource = this as RegularTextSource + @PreviewFeature inline fun TextSource.asStrikethroughTextSource(): StrikethroughTextSource? = this as? StrikethroughTextSource + @PreviewFeature inline fun TextSource.requireStrikethroughTextSource(): StrikethroughTextSource = this as StrikethroughTextSource + @PreviewFeature inline fun TextSource.asTextLinkTextSource(): TextLinkTextSource? = this as? TextLinkTextSource + @PreviewFeature inline fun TextSource.requireTextLinkTextSource(): TextLinkTextSource = this as TextLinkTextSource + @PreviewFeature inline fun TextSource.asTextMentionTextSource(): TextMentionTextSource? = this as? TextMentionTextSource + @PreviewFeature inline fun TextSource.requireTextMentionTextSource(): TextMentionTextSource = this as TextMentionTextSource + @PreviewFeature inline fun TextSource.asURLTextSource(): URLTextSource? = this as? URLTextSource + @PreviewFeature inline fun TextSource.requireURLTextSource(): URLTextSource = this as URLTextSource + @PreviewFeature inline fun TextSource.asUnderlineTextSource(): UnderlineTextSource? = this as? UnderlineTextSource + @PreviewFeature inline fun TextSource.requireUnderlineTextSource(): UnderlineTextSource = this as UnderlineTextSource + @PreviewFeature -inline fun DiceAnimationType.asBasketballDiceAnimationType(): BasketballDiceAnimationType? = this as? BasketballDiceAnimationType +inline fun DiceAnimationType.asBasketballDiceAnimationType(): BasketballDiceAnimationType? = + this as? BasketballDiceAnimationType + @PreviewFeature -inline fun DiceAnimationType.requireBasketballDiceAnimationType(): BasketballDiceAnimationType = this as BasketballDiceAnimationType +inline fun DiceAnimationType.requireBasketballDiceAnimationType(): BasketballDiceAnimationType = + this as BasketballDiceAnimationType + @PreviewFeature inline fun DiceAnimationType.asBowlingDiceAnimationType(): BowlingDiceAnimationType? = this as? BowlingDiceAnimationType + @PreviewFeature -inline fun DiceAnimationType.requireBowlingDiceAnimationType(): BowlingDiceAnimationType = this as BowlingDiceAnimationType +inline fun DiceAnimationType.requireBowlingDiceAnimationType(): BowlingDiceAnimationType = + this as BowlingDiceAnimationType + @PreviewFeature inline fun DiceAnimationType.asCubeDiceAnimationType(): CubeDiceAnimationType? = this as? CubeDiceAnimationType + @PreviewFeature inline fun DiceAnimationType.requireCubeDiceAnimationType(): CubeDiceAnimationType = this as CubeDiceAnimationType + @PreviewFeature inline fun DiceAnimationType.asCustomDiceAnimationType(): CustomDiceAnimationType? = this as? CustomDiceAnimationType + @PreviewFeature inline fun DiceAnimationType.requireCustomDiceAnimationType(): CustomDiceAnimationType = this as CustomDiceAnimationType + @PreviewFeature inline fun DiceAnimationType.asDartsDiceAnimationType(): DartsDiceAnimationType? = this as? DartsDiceAnimationType + @PreviewFeature inline fun DiceAnimationType.requireDartsDiceAnimationType(): DartsDiceAnimationType = this as DartsDiceAnimationType + @PreviewFeature -inline fun DiceAnimationType.asFootballDiceAnimationType(): FootballDiceAnimationType? = this as? FootballDiceAnimationType +inline fun DiceAnimationType.asFootballDiceAnimationType(): FootballDiceAnimationType? = + this as? FootballDiceAnimationType + @PreviewFeature -inline fun DiceAnimationType.requireFootballDiceAnimationType(): FootballDiceAnimationType = this as FootballDiceAnimationType +inline fun DiceAnimationType.requireFootballDiceAnimationType(): FootballDiceAnimationType = + this as FootballDiceAnimationType + @PreviewFeature -inline fun DiceAnimationType.asSlotMachineDiceAnimationType(): SlotMachineDiceAnimationType? = this as? SlotMachineDiceAnimationType +inline fun DiceAnimationType.asSlotMachineDiceAnimationType(): SlotMachineDiceAnimationType? = + this as? SlotMachineDiceAnimationType + @PreviewFeature -inline fun DiceAnimationType.requireSlotMachineDiceAnimationType(): SlotMachineDiceAnimationType = this as SlotMachineDiceAnimationType +inline fun DiceAnimationType.requireSlotMachineDiceAnimationType(): SlotMachineDiceAnimationType = + this as SlotMachineDiceAnimationType + @PreviewFeature inline fun ChatEvent.asChannelChatCreated(): ChannelChatCreated? = this as? ChannelChatCreated + @PreviewFeature inline fun ChatEvent.requireChannelChatCreated(): ChannelChatCreated = this as ChannelChatCreated + @PreviewFeature inline fun ChatEvent.asDeleteChatPhoto(): DeleteChatPhoto? = this as? DeleteChatPhoto + @PreviewFeature inline fun ChatEvent.requireDeleteChatPhoto(): DeleteChatPhoto = this as DeleteChatPhoto + @PreviewFeature inline fun ChatEvent.asGroupChatCreated(): GroupChatCreated? = this as? GroupChatCreated + @PreviewFeature inline fun ChatEvent.requireGroupChatCreated(): GroupChatCreated = this as GroupChatCreated + @PreviewFeature inline fun ChatEvent.asLeftChatMember(): LeftChatMember? = this as? LeftChatMember + @PreviewFeature inline fun ChatEvent.requireLeftChatMember(): LeftChatMember = this as LeftChatMember + @PreviewFeature -inline fun ChatEvent.asMessageAutoDeleteTimerChanged(): MessageAutoDeleteTimerChanged? = this as? MessageAutoDeleteTimerChanged +inline fun ChatEvent.asMessageAutoDeleteTimerChanged(): MessageAutoDeleteTimerChanged? = + this as? MessageAutoDeleteTimerChanged + @PreviewFeature -inline fun ChatEvent.requireMessageAutoDeleteTimerChanged(): MessageAutoDeleteTimerChanged = this as MessageAutoDeleteTimerChanged +inline fun ChatEvent.requireMessageAutoDeleteTimerChanged(): MessageAutoDeleteTimerChanged = + this as MessageAutoDeleteTimerChanged + @PreviewFeature inline fun ChatEvent.asNewChatMembers(): NewChatMembers? = this as? NewChatMembers + @PreviewFeature inline fun ChatEvent.requireNewChatMembers(): NewChatMembers = this as NewChatMembers + @PreviewFeature inline fun ChatEvent.asNewChatPhoto(): NewChatPhoto? = this as? NewChatPhoto + @PreviewFeature inline fun ChatEvent.requireNewChatPhoto(): NewChatPhoto = this as NewChatPhoto + @PreviewFeature inline fun ChatEvent.asNewChatTitle(): NewChatTitle? = this as? NewChatTitle + @PreviewFeature inline fun ChatEvent.requireNewChatTitle(): NewChatTitle = this as NewChatTitle + @PreviewFeature inline fun ChatEvent.asPinnedMessage(): PinnedMessage? = this as? PinnedMessage + @PreviewFeature inline fun ChatEvent.requirePinnedMessage(): PinnedMessage = this as PinnedMessage + @PreviewFeature inline fun ChatEvent.asProximityAlertTriggered(): ProximityAlertTriggered? = this as? ProximityAlertTriggered + @PreviewFeature inline fun ChatEvent.requireProximityAlertTriggered(): ProximityAlertTriggered = this as ProximityAlertTriggered + @PreviewFeature inline fun ChatEvent.asSupergroupChatCreated(): SupergroupChatCreated? = this as? SupergroupChatCreated + @PreviewFeature inline fun ChatEvent.requireSupergroupChatCreated(): SupergroupChatCreated = this as SupergroupChatCreated + @PreviewFeature inline fun ChatEvent.asChannelEvent(): ChannelEvent? = this as? ChannelEvent + @PreviewFeature inline fun ChatEvent.requireChannelEvent(): ChannelEvent = this as ChannelEvent + @PreviewFeature inline fun ChatEvent.asCommonEvent(): CommonEvent? = this as? CommonEvent + @PreviewFeature inline fun ChatEvent.requireCommonEvent(): CommonEvent = this as CommonEvent + @PreviewFeature inline fun ChatEvent.asGroupEvent(): GroupEvent? = this as? GroupEvent + @PreviewFeature inline fun ChatEvent.requireGroupEvent(): GroupEvent = this as GroupEvent + @PreviewFeature inline fun ChatEvent.asSupergroupEvent(): SupergroupEvent? = this as? SupergroupEvent + @PreviewFeature inline fun ChatEvent.requireSupergroupEvent(): SupergroupEvent = this as SupergroupEvent + @PreviewFeature inline fun ChatEvent.asVoiceChatEvent(): VoiceChatEvent? = this as? VoiceChatEvent + @PreviewFeature inline fun ChatEvent.requireVoiceChatEvent(): VoiceChatEvent = this as VoiceChatEvent + @PreviewFeature inline fun ChatEvent.asVoiceChatEnded(): VoiceChatEnded? = this as? VoiceChatEnded + @PreviewFeature inline fun ChatEvent.requireVoiceChatEnded(): VoiceChatEnded = this as VoiceChatEnded + @PreviewFeature -inline fun ChatEvent.asVoiceChatParticipantsInvited(): VoiceChatParticipantsInvited? = this as? VoiceChatParticipantsInvited +inline fun ChatEvent.asVoiceChatParticipantsInvited(): VoiceChatParticipantsInvited? = + this as? VoiceChatParticipantsInvited + @PreviewFeature -inline fun ChatEvent.requireVoiceChatParticipantsInvited(): VoiceChatParticipantsInvited = this as VoiceChatParticipantsInvited +inline fun ChatEvent.requireVoiceChatParticipantsInvited(): VoiceChatParticipantsInvited = + this as VoiceChatParticipantsInvited + @PreviewFeature inline fun ChatEvent.asVoiceChatStarted(): VoiceChatStarted? = this as? VoiceChatStarted + @PreviewFeature inline fun ChatEvent.requireVoiceChatStarted(): VoiceChatStarted = this as VoiceChatStarted + @PreviewFeature inline fun CommonSendInvoiceData.asSendInvoice(): SendInvoice? = this as? SendInvoice + @PreviewFeature inline fun CommonSendInvoiceData.requireVoiceChatParticipantsInvited(): SendInvoice = this as SendInvoice + @PreviewFeature -inline fun CommonSendInvoiceData.asInputInvoiceMessageContent(): InputInvoiceMessageContent? = this as? InputInvoiceMessageContent +inline fun CommonSendInvoiceData.asInputInvoiceMessageContent(): InputInvoiceMessageContent? = + this as? InputInvoiceMessageContent + @PreviewFeature -inline fun CommonSendInvoiceData.requireInputInvoiceMessageContent(): InputInvoiceMessageContent = this as InputInvoiceMessageContent +inline fun CommonSendInvoiceData.requireInputInvoiceMessageContent(): InputInvoiceMessageContent = + this as InputInvoiceMessageContent diff --git a/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/TextCaptionBotCommandsParser.kt b/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/TextCaptionBotCommandsParser.kt index d49f366f75..ddcbd77ebd 100644 --- a/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/TextCaptionBotCommandsParser.kt +++ b/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/TextCaptionBotCommandsParser.kt @@ -1,6 +1,6 @@ package dev.inmo.tgbotapi.extensions.utils.extensions -import dev.inmo.tgbotapi.CommonAbstracts.* +import dev.inmo.tgbotapi.CommonAbstracts.TextedWithTextSources import dev.inmo.tgbotapi.types.MessageEntity.textsources.BotCommandTextSource import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage diff --git a/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/formatting/EntitiesBuilder.kt b/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/formatting/EntitiesBuilder.kt index b6f4bcefd9..a758bf4fc8 100644 --- a/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/formatting/EntitiesBuilder.kt +++ b/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/formatting/EntitiesBuilder.kt @@ -2,9 +2,11 @@ package dev.inmo.tgbotapi.extensions.utils.formatting +import dev.inmo.tgbotapi.types.MessageEntity.textsources.MutableTextSourcesList +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.User -fun buildEntities(init: EntitiesBuilder.() -> Unit): List = EntitiesBuilder().apply(init).build() +fun buildEntities(init: EntitiesBuilder.() -> Unit): TextSourcesList = EntitiesBuilder().apply(init).build() /** * This builder can be used to provide building of [TextSource]s [List] @@ -12,25 +14,25 @@ fun buildEntities(init: EntitiesBuilder.() -> Unit): List = mutableListOf() + private val entitiesList: MutableTextSourcesList = mutableListOf() ) { /** * It is not safe field which contains potentially changeable [List] */ - val entities: List + val entities: TextSourcesList get() = entitiesList /** * @return New immutable list which will be deattached from this builder */ - fun build(): List = entities.toList() + fun build(): TextSourcesList = entities.toList() fun add(source: dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource) { entitiesList.add(source) } operator fun dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource.unaryPlus() = add(this) - operator fun List.unaryPlus() = entitiesList.addAll(this) + operator fun TextSourcesList.unaryPlus() = entitiesList.addAll(this) operator fun invoke(vararg source: dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource) = entitiesList.addAll(source) operator fun String.unaryPlus() { @@ -38,7 +40,7 @@ class EntitiesBuilder internal constructor( } } -inline fun EntitiesBuilder.bold(parts: List) = add(dev.inmo.tgbotapi.types.MessageEntity.textsources.bold(parts)) +inline fun EntitiesBuilder.bold(parts: TextSourcesList) = add(dev.inmo.tgbotapi.types.MessageEntity.textsources.bold(parts)) inline fun EntitiesBuilder.bold(vararg parts: dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource) = add(dev.inmo.tgbotapi.types.MessageEntity.textsources.bold(*parts)) @@ -48,7 +50,7 @@ inline fun EntitiesBuilder.bold(text: String) = add(dev.inmo.tgbotapi.types.Mess inline fun EntitiesBuilder.botCommand(command: String) = add(dev.inmo.tgbotapi.types.MessageEntity.textsources.botCommand(command)) -inline fun EntitiesBuilder.cashTag(parts: List) = +inline fun EntitiesBuilder.cashTag(parts: TextSourcesList) = add(dev.inmo.tgbotapi.types.MessageEntity.textsources.cashTag(parts)) inline fun EntitiesBuilder.cashTag(vararg parts: dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource) = @@ -58,7 +60,7 @@ inline fun EntitiesBuilder.cashTag(text: String) = add(dev.inmo.tgbotapi.types.M inline fun EntitiesBuilder.code(code: String) = add(dev.inmo.tgbotapi.types.MessageEntity.textsources.code(code)) -inline fun EntitiesBuilder.email(parts: List) = +inline fun EntitiesBuilder.email(parts: TextSourcesList) = add(dev.inmo.tgbotapi.types.MessageEntity.textsources.email(parts)) inline fun EntitiesBuilder.email(vararg parts: dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource) = @@ -67,7 +69,7 @@ inline fun EntitiesBuilder.email(vararg parts: dev.inmo.tgbotapi.types.MessageEn inline fun EntitiesBuilder.email(emailAddress: String) = add(dev.inmo.tgbotapi.types.MessageEntity.textsources.email(emailAddress)) -inline fun EntitiesBuilder.hashtag(parts: List) = +inline fun EntitiesBuilder.hashtag(parts: TextSourcesList) = add(dev.inmo.tgbotapi.types.MessageEntity.textsources.hashtag(parts)) inline fun EntitiesBuilder.hashtag(vararg parts: dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource) = @@ -75,7 +77,7 @@ inline fun EntitiesBuilder.hashtag(vararg parts: dev.inmo.tgbotapi.types.Message inline fun EntitiesBuilder.hashtag(hashtag: String) = add(dev.inmo.tgbotapi.types.MessageEntity.textsources.hashtag(hashtag)) -inline fun EntitiesBuilder.italic(parts: List) = +inline fun EntitiesBuilder.italic(parts: TextSourcesList) = add(dev.inmo.tgbotapi.types.MessageEntity.textsources.italic(parts)) inline fun EntitiesBuilder.italic(vararg parts: dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource) = @@ -83,7 +85,7 @@ inline fun EntitiesBuilder.italic(vararg parts: dev.inmo.tgbotapi.types.MessageE inline fun EntitiesBuilder.italic(text: String) = add(dev.inmo.tgbotapi.types.MessageEntity.textsources.italic(text)) -inline fun EntitiesBuilder.mention(parts: List) = +inline fun EntitiesBuilder.mention(parts: TextSourcesList) = add(dev.inmo.tgbotapi.types.MessageEntity.textsources.mention(parts)) inline fun EntitiesBuilder.mention(vararg parts: dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource) = @@ -92,7 +94,7 @@ inline fun EntitiesBuilder.mention(vararg parts: dev.inmo.tgbotapi.types.Message inline fun EntitiesBuilder.mention(whoToMention: String) = add(dev.inmo.tgbotapi.types.MessageEntity.textsources.mention(whoToMention)) -inline fun EntitiesBuilder.mention(parts: List, user: User) = +inline fun EntitiesBuilder.mention(parts: TextSourcesList, user: User) = add(dev.inmo.tgbotapi.types.MessageEntity.textsources.mention(parts, user)) inline fun EntitiesBuilder.mention( @@ -104,7 +106,7 @@ inline fun EntitiesBuilder.mention( inline fun EntitiesBuilder.mention(text: String, user: User) = add(dev.inmo.tgbotapi.types.MessageEntity.textsources.mention(text, user)) -inline fun EntitiesBuilder.phone(parts: List) = +inline fun EntitiesBuilder.phone(parts: TextSourcesList) = add(dev.inmo.tgbotapi.types.MessageEntity.textsources.phone(parts)) inline fun EntitiesBuilder.phone(vararg parts: dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource) = @@ -119,7 +121,7 @@ inline fun EntitiesBuilder.pre(code: String, language: String?) = inline fun EntitiesBuilder.regular(text: String) = add(dev.inmo.tgbotapi.types.MessageEntity.textsources.regular(text)) -inline fun EntitiesBuilder.strikethrough(parts: List) = +inline fun EntitiesBuilder.strikethrough(parts: TextSourcesList) = add(dev.inmo.tgbotapi.types.MessageEntity.textsources.strikethrough(parts)) inline fun EntitiesBuilder.strikethrough(vararg parts: dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource) = @@ -134,7 +136,7 @@ inline fun EntitiesBuilder.link(text: String, url: String) = inline fun EntitiesBuilder.link(url: String) = add(dev.inmo.tgbotapi.types.MessageEntity.textsources.link(url)) -inline fun EntitiesBuilder.underline(parts: List) = +inline fun EntitiesBuilder.underline(parts: TextSourcesList) = add(dev.inmo.tgbotapi.types.MessageEntity.textsources.underline(parts)) inline fun EntitiesBuilder.underline(vararg parts: dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource) = diff --git a/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/formatting/ResendingTextFormatting.kt b/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/formatting/ResendingTextFormatting.kt index b36599ec67..ef809d74b3 100644 --- a/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/formatting/ResendingTextFormatting.kt +++ b/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/formatting/ResendingTextFormatting.kt @@ -1,7 +1,7 @@ package dev.inmo.tgbotapi.extensions.utils.formatting -import dev.inmo.tgbotapi.CommonAbstracts.* import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.ParseMode.* import dev.inmo.tgbotapi.types.message.content.TextContent @@ -56,8 +56,6 @@ fun TextSourcesList.toMarkdownCaptions(): List = createMarkdownText( captionLength.last ) -fun CaptionedInput.toMarkdownCaptions(): List = textSources.toMarkdownCaptions() - fun TextSourcesList.toMarkdownTexts(): List = createMarkdownText( this, textLength.last @@ -70,8 +68,6 @@ fun TextSourcesList.toMarkdownExplanations(): List = createMarkdownText( explanationLimit.last ) -fun ExplainedInput.toMarkdownExplanations(): List = textSources.toMarkdownTexts() - fun createMarkdownV2Text( entities: TextSourcesList, @@ -83,8 +79,6 @@ fun TextSourcesList.toMarkdownV2Captions(): List = createMarkdownV2Text( captionLength.last ) -fun CaptionedInput.toMarkdownV2Captions(): List = textSources.toMarkdownV2Captions() - fun TextSourcesList.toMarkdownV2Texts(): List = createMarkdownV2Text( this, textLength.last @@ -97,8 +91,6 @@ fun TextSourcesList.toMarkdownV2Explanations(): List = createMarkdownV2T explanationLimit.last ) -fun ExplainedInput.toMarkdownV2Explanations(): List = textSources.toMarkdownV2Texts() - fun createHtmlText( entities: TextSourcesList, @@ -110,8 +102,6 @@ fun TextSourcesList.toHtmlCaptions(): List = createHtmlText( captionLength.last ) -fun CaptionedInput.toHtmlCaptions(): List = textSources.toHtmlCaptions() - fun TextSourcesList.toHtmlTexts(): List = createHtmlText( this, textLength.last @@ -124,6 +114,4 @@ fun TextSourcesList.toHtmlExplanations(): List = createHtmlText( explanationLimit.last ) -fun ExplainedInput.toHtmlExplanations(): List = textSources.toHtmlTexts() - diff --git a/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/updates/CommandsFilters.kt b/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/updates/CommandsFilters.kt index 1bfe7b70b0..864d0c77ef 100644 --- a/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/updates/CommandsFilters.kt +++ b/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/updates/CommandsFilters.kt @@ -2,8 +2,7 @@ package dev.inmo.tgbotapi.extensions.utils.updates import dev.inmo.tgbotapi.extensions.utils.onlyTextContentMessages import dev.inmo.tgbotapi.extensions.utils.shortcuts.* -import dev.inmo.tgbotapi.types.MessageEntity.textsources.BotCommandTextSource -import dev.inmo.tgbotapi.types.MessageEntity.textsources.RegularTextSource +import dev.inmo.tgbotapi.types.MessageEntity.textsources.* import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.content.TextContent import dev.inmo.tgbotapi.types.update.abstracts.BaseSentMessageUpdate @@ -59,4 +58,4 @@ fun Flow.filterCommandsInsideTextMessages( */ fun Flow.filterCommandsWithArgs( commandRegex: Regex -): Flow, List>> = textMessages().filterCommandsWithArgs(commandRegex) +): Flow, TextSourcesList>> = textMessages().filterCommandsWithArgs(commandRegex) diff --git a/tgbotapi/build.gradle b/tgbotapi/build.gradle index 895e728acf..24fccc4e69 100644 --- a/tgbotapi/build.gradle +++ b/tgbotapi/build.gradle @@ -29,10 +29,8 @@ repositories { } kotlin { - jvm { - compilations.main.kotlinOptions.useIR = true - } - js(BOTH) { + jvm() + js(IR) { browser() nodejs() }