From f153b314646c1544dbcc382f62d78e05a203a0d9 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 16 Jun 2023 13:50:34 +0600 Subject: [PATCH] improve class casts including filtering --- gradle/libs.versions.toml | 4 +- .../dev/inmo/tgbotapi/abstracts/WithUser.kt | 2 +- .../abstracts/InlineQueryResult.kt | 2 +- .../dev/inmo/tgbotapi/types/chat/Abstracts.kt | 2 +- .../dev/inmo/tgbotapi/types/chat/Extended.kt | 6 + .../dev/inmo/tgbotapi/types/chat/Impls.kt | 6 + .../member/AdministratorChatMemberImpl.kt | 2 + .../member/ChatAdministratorRightsImpl.kt | 2 + .../types/chat/member/LeftChatMemberImpl.kt | 2 + .../types/chat/member/MemberChatMemberImpl.kt | 2 + .../types/message/abstracts/Message.kt | 2 +- .../utils/internal/ClassCastsIncluded.kt | 10 +- tgbotapi.ksp/build.gradle | 1 + .../kotlin/TelegramBotAPISymbolProcessor.kt | 45 +- .../extensions/utils/ClassCastsNew.kt | 4000 +++++++++++++---- 15 files changed, 3230 insertions(+), 858 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 45dc446adf..2efcc1b268 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] -kotlin = "1.8.21" +kotlin = "1.8.22" kotlin-serialization = "1.5.1" kotlin-coroutines = "1.6.4" @@ -10,7 +10,7 @@ korlibs = "4.0.3" uuid = "0.7.1" ktor = "2.3.1" -ksp = "1.8.21-1.0.11" +ksp = "1.8.22-1.0.11" kotlin-poet = "1.14.2" microutils = "0.19.2" diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/abstracts/WithUser.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/abstracts/WithUser.kt index 11f369737e..fb107ead22 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/abstracts/WithUser.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/abstracts/WithUser.kt @@ -8,7 +8,7 @@ import dev.inmo.tgbotapi.types.chat.User * * @see FromUser */ -@ClassCastsIncluded +@ClassCastsIncluded(excludeRegex = ".*Impl") interface WithUser { val user: User } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/InlineQueryResult.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/InlineQueryResult.kt index 9b02e6e873..5f04145dc1 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/InlineQueryResult.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/InlineQueryResult.kt @@ -7,7 +7,7 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import kotlinx.serialization.Serializable @Serializable(InlineQueryResultSerializer::class) -@ClassCastsIncluded +@ClassCastsIncluded(excludeRegex = ".*Impl") interface InlineQueryResult { val type: String val id: InlineQueryIdentifier diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/Abstracts.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/Abstracts.kt index 685167e95d..d0d497e768 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/Abstracts.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/Abstracts.kt @@ -49,7 +49,7 @@ sealed interface AbleToAddInAttachmentMenuChat : Chat { } @Serializable(PreviewChatSerializer::class) -@ClassCastsIncluded(excludeRegex = ".*Impl.kt") +@ClassCastsIncluded(excludeRegex = ".*Impl") sealed interface Chat { val id: IdChatIdentifier } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/Extended.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/Extended.kt index 5b9188e7de..94aac7cc96 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/Extended.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/Extended.kt @@ -4,12 +4,14 @@ import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.message.abstracts.Message import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializeOnlySerializer import dev.inmo.tgbotapi.utils.RiskFeature +import dev.inmo.tgbotapi.utils.internal.ClassCastsExcluded import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable import kotlinx.serialization.json.JsonObject @Serializable @RiskFeature("This class is a subject of changes. It is better to use ExtendedChannelChat due") +@ClassCastsExcluded data class ExtendedChannelChatImpl( @SerialName(idField) override val id: ChatId, @@ -36,6 +38,7 @@ data class ExtendedChannelChatImpl( @Serializable @RiskFeature("This class is a subject of changes. It is better to use ExtendedGroupChat due") +@ClassCastsExcluded data class ExtendedGroupChatImpl( @SerialName(idField) override val id: ChatId, @@ -58,6 +61,7 @@ data class ExtendedGroupChatImpl( @Serializable @RiskFeature("This class is a subject of changes. It is better to use ExtendedPrivateChat due") +@ClassCastsExcluded data class ExtendedPrivateChatImpl( @SerialName(idField) override val id: UserId, @@ -85,6 +89,7 @@ typealias ExtendedUser = ExtendedPrivateChatImpl @Serializable @RiskFeature("This class is a subject of changes. It is better to use ExtendedSupergroupChat due") +@ClassCastsExcluded data class ExtendedSupergroupChatImpl( @SerialName(idField) override val id: ChatId, @@ -127,6 +132,7 @@ data class ExtendedSupergroupChatImpl( @Serializable @RiskFeature("This class is a subject of changes. It is better to use ExtendedForumChat due") +@ClassCastsExcluded data class ExtendedForumChatImpl( @SerialName(idField) override val id: IdChatIdentifier, diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/Impls.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/Impls.kt index 0ccc48b172..9389afb513 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/Impls.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/Impls.kt @@ -5,11 +5,13 @@ import dev.inmo.micro_utils.language_codes.IetfLanguageCodeSerializer import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.abstracts.WithOptionalLanguageCode import dev.inmo.tgbotapi.utils.RiskFeature +import dev.inmo.tgbotapi.utils.internal.ClassCastsExcluded import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @Serializable @RiskFeature("This class is a subject of changes. It is better to use GroupChat due") +@ClassCastsExcluded data class GroupChatImpl( @SerialName(idField) override val id: ChatId, @@ -19,6 +21,7 @@ data class GroupChatImpl( @Serializable @RiskFeature("This class is a subject of changes. It is better to use PrivateChat due") +@ClassCastsExcluded data class PrivateChatImpl( @SerialName(idField) override val id: UserId, @@ -32,6 +35,7 @@ data class PrivateChatImpl( @Serializable @RiskFeature("This class is a subject of changes. It is better to use SupergroupChat due") +@ClassCastsExcluded data class SupergroupChatImpl( @SerialName(idField) override val id: ChatId, @@ -43,6 +47,7 @@ data class SupergroupChatImpl( @Serializable @RiskFeature("This class is a subject of changes. It is better to use ForumChat due") +@ClassCastsExcluded data class ForumChatImpl( @SerialName(idField) override val id: IdChatIdentifier, @@ -54,6 +59,7 @@ data class ForumChatImpl( @Serializable @RiskFeature("This class is a subject of changes. It is better to use ChannelChat due") +@ClassCastsExcluded data class ChannelChatImpl( @SerialName(idField) override val id: ChatId, diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/AdministratorChatMemberImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/AdministratorChatMemberImpl.kt index 4e2cf26eac..32b714d5ea 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/AdministratorChatMemberImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/AdministratorChatMemberImpl.kt @@ -2,9 +2,11 @@ package dev.inmo.tgbotapi.types.chat.member import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.chat.User +import dev.inmo.tgbotapi.utils.internal.ClassCastsExcluded import kotlinx.serialization.* @Serializable +@ClassCastsExcluded data class AdministratorChatMemberImpl( @SerialName(userField) override val user: User, diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/ChatAdministratorRightsImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/ChatAdministratorRightsImpl.kt index 823f3ebebb..2ca3157001 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/ChatAdministratorRightsImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/ChatAdministratorRightsImpl.kt @@ -1,10 +1,12 @@ package dev.inmo.tgbotapi.types.chat.member import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.utils.internal.ClassCastsExcluded import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @Serializable +@ClassCastsExcluded data class ChatAdministratorRightsImpl( @SerialName(canChangeInfoField) override val canChangeInfo: Boolean = false, diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/LeftChatMemberImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/LeftChatMemberImpl.kt index 617d2f2531..64566c1194 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/LeftChatMemberImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/LeftChatMemberImpl.kt @@ -2,9 +2,11 @@ package dev.inmo.tgbotapi.types.chat.member import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.chat.User +import dev.inmo.tgbotapi.utils.internal.ClassCastsExcluded import kotlinx.serialization.* @Serializable +@ClassCastsExcluded data class LeftChatMemberImpl(@SerialName(userField) override val user: User) : LeftChatMember { @SerialName(statusField) @Required diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/MemberChatMemberImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/MemberChatMemberImpl.kt index 489bbb9b92..ff6c7515b8 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/MemberChatMemberImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/MemberChatMemberImpl.kt @@ -2,9 +2,11 @@ package dev.inmo.tgbotapi.types.chat.member import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.chat.User +import dev.inmo.tgbotapi.utils.internal.ClassCastsExcluded import kotlinx.serialization.* @Serializable +@ClassCastsExcluded data class MemberChatMemberImpl(@SerialName(userField) override val user: User) : MemberChatMember { @SerialName(statusField) @Required 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 da30c0d9d7..eb922ce0db 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 @@ -11,7 +11,7 @@ import kotlinx.serialization.descriptors.* import kotlinx.serialization.encoding.Decoder import kotlinx.serialization.encoding.Encoder -@ClassCastsIncluded +@ClassCastsIncluded(excludeRegex = ".*Impl") interface Message : WithChat { val messageId: MessageId val date: DateTime diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/internal/ClassCastsIncluded.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/internal/ClassCastsIncluded.kt index eecc6bd01b..fdece312a7 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/internal/ClassCastsIncluded.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/internal/ClassCastsIncluded.kt @@ -1,5 +1,13 @@ package dev.inmo.tgbotapi.utils.internal +import dev.inmo.tgbotapi.utils.RiskFeature + @Target(AnnotationTarget.CLASS) @Retention(AnnotationRetention.SOURCE) -internal annotation class ClassCastsIncluded(val typesRegex: String = ".*", val excludeRegex: String = "") +@RiskFeature("It is internal API in tgbotapi.core and should not be used outside") +annotation class ClassCastsIncluded(val typesRegex: String = "", val excludeRegex: String = "") + +@Target(AnnotationTarget.CLASS) +@Retention(AnnotationRetention.SOURCE) +@RiskFeature("It is internal API in tgbotapi.core and should not be used outside") +annotation class ClassCastsExcluded() diff --git a/tgbotapi.ksp/build.gradle b/tgbotapi.ksp/build.gradle index fd1afa0516..bcf67a0160 100644 --- a/tgbotapi.ksp/build.gradle +++ b/tgbotapi.ksp/build.gradle @@ -9,4 +9,5 @@ repositories { dependencies { implementation libs.kotlin.poet implementation libs.ksp + implementation project(":tgbotapi.core") } diff --git a/tgbotapi.ksp/src/main/kotlin/TelegramBotAPISymbolProcessor.kt b/tgbotapi.ksp/src/main/kotlin/TelegramBotAPISymbolProcessor.kt index a81f55a7a8..4eeff1ecc1 100644 --- a/tgbotapi.ksp/src/main/kotlin/TelegramBotAPISymbolProcessor.kt +++ b/tgbotapi.ksp/src/main/kotlin/TelegramBotAPISymbolProcessor.kt @@ -1,15 +1,21 @@ package dev.inmo.tgbotapi.ksp.processor +import com.google.devtools.ksp.KspExperimental import com.google.devtools.ksp.getAllSuperTypes import com.google.devtools.ksp.getAnnotationsByType +import com.google.devtools.ksp.isAnnotationPresent import com.google.devtools.ksp.processing.* import com.google.devtools.ksp.symbol.KSAnnotated import com.google.devtools.ksp.symbol.KSClassDeclaration import com.squareup.kotlinpoet.AnnotationSpec import com.squareup.kotlinpoet.ClassName import com.squareup.kotlinpoet.FileSpec +import com.squareup.kotlinpoet.asClassName import com.squareup.kotlinpoet.ksp.toClassName import com.squareup.kotlinpoet.ksp.writeTo +import dev.inmo.tgbotapi.utils.RiskFeature +import dev.inmo.tgbotapi.utils.internal.ClassCastsExcluded +import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded import java.io.File class TelegramBotAPISymbolProcessor( @@ -18,35 +24,33 @@ class TelegramBotAPISymbolProcessor( private val outputFile: String = "Output", private val outputFolder: String? = null ) : SymbolProcessor { - private val classCastsIncludedClassName = ClassName("dev.inmo.tgbotapi.utils.internal", "ClassCastsIncluded") + private val classCastsIncludedClassName = ClassCastsIncluded::class.asClassName() + @OptIn(KspExperimental::class, RiskFeature::class) override fun process(resolver: Resolver): List { val classes = resolver.getSymbolsWithAnnotation(classCastsIncludedClassName.canonicalName).filterIsInstance() - val classesRegexes: Map> = classes.mapNotNull { - it to (it.annotations.firstNotNullOfOrNull { - runCatching { - if (it.annotationType.resolve().toClassName() == classCastsIncludedClassName) { - val regex = it.arguments.first().value as? String ?: return@runCatching null - val negativeRegex = (it.arguments.first().value as? String) ?.takeIf { it.isNotEmpty() } - Regex(regex) to (negativeRegex ?.let(::Regex)) - } else { - null - } - }.getOrNull() + val classesRegexes: Map> = classes.mapNotNull { + it to (it.getAnnotationsByType(ClassCastsIncluded::class).firstNotNullOfOrNull { + it.typesRegex.takeIf { it.isNotEmpty() } ?.let(::Regex) to it.excludeRegex.takeIf { it.isNotEmpty() } ?.let(::Regex) } ?: return@mapNotNull null) }.toMap() val classesSubtypes = mutableMapOf>() resolver.getAllFiles().forEach { it.declarations.forEach { potentialSubtype -> - if (potentialSubtype is KSClassDeclaration) { + if ( + potentialSubtype is KSClassDeclaration + && potentialSubtype.isAnnotationPresent(ClassCastsExcluded::class).not() + ) { val allSupertypes = potentialSubtype.getAllSuperTypes().map { it.declaration } for (currentClass in classes) { val regexes = classesRegexes[currentClass] + val simpleName = potentialSubtype.simpleName.getShortName() when { - currentClass in allSupertypes - && regexes ?.first ?.matches(potentialSubtype.simpleName.toString()) != false - && regexes ?.second ?.matches(potentialSubtype.simpleName.toString()) != true-> { + currentClass !in allSupertypes + || regexes ?.first ?.matches(simpleName) == false + || regexes ?.second ?.matches(simpleName) == true -> continue + else -> { classesSubtypes.getOrPut(currentClass) { mutableSetOf() }.add(potentialSubtype) } } @@ -55,7 +59,16 @@ class TelegramBotAPISymbolProcessor( } } fun fillWithSealeds(source: KSClassDeclaration, current: KSClassDeclaration = source) { + val regexes = classesRegexes[source] current.getSealedSubclasses().forEach { + val simpleName = it.simpleName.getShortName() + if ( + regexes ?.first ?.matches(simpleName) == false + || regexes ?.second ?.matches(simpleName) == true + || it.isAnnotationPresent(ClassCastsExcluded::class) + ) { + return@forEach + } classesSubtypes.getOrPut(source) { mutableSetOf() }.add(it) fillWithSealeds(source, it) } diff --git a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/ClassCastsNew.kt b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/ClassCastsNew.kt index a0ab885e4e..d8cd7d52f4 100644 --- a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/ClassCastsNew.kt +++ b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/ClassCastsNew.kt @@ -9,18 +9,73 @@ package dev.inmo.tgbotapi.extensions.utils +import dev.inmo.tgbotapi.abstracts.CommonSendInvoiceData +import dev.inmo.tgbotapi.abstracts.FromUser +import dev.inmo.tgbotapi.abstracts.WithUser import dev.inmo.tgbotapi.requests.answers.InlineQueryResultsButton +import dev.inmo.tgbotapi.requests.send.payments.CreateInvoiceLink +import dev.inmo.tgbotapi.requests.send.payments.SendInvoice import dev.inmo.tgbotapi.requests.stickers.InputSticker import dev.inmo.tgbotapi.types.ChatId import dev.inmo.tgbotapi.types.ChatIdWithThreadId import dev.inmo.tgbotapi.types.ChatIdentifier +import dev.inmo.tgbotapi.types.ChatInviteLink +import dev.inmo.tgbotapi.types.ChatInviteLinkUnlimited +import dev.inmo.tgbotapi.types.ChatInviteLinkWithJoinRequest +import dev.inmo.tgbotapi.types.ChatInviteLinkWithLimitedMembers import dev.inmo.tgbotapi.types.IdChatIdentifier +import dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.BaseChosenInlineResult +import dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.ChosenInlineResult +import dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.LocationChosenInlineResult +import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultArticle +import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultContact +import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultGame +import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultLocation +import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultStickerCached +import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultVenue +import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.DescribedInlineQueryResult +import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.FileInlineQueryResult +import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult +import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.OptionallyTitledInlineQueryResult +import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.SizedInlineQueryResult +import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.ThumbSizedInlineQueryResult +import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.ThumbedInlineQueryResult +import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.ThumbedWithMimeTypeInlineQueryResult +import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.TitledInlineQueryResult +import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.UrlInlineQueryResult +import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.WithInputMessageContentInlineQueryResult +import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.audio.InlineQueryResultAudio +import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.audio.InlineQueryResultAudioCached +import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.audio.InlineQueryResultAudioCommon +import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.document.InlineQueryResultDocument +import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.document.InlineQueryResultDocumentCached +import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.document.InlineQueryResultDocumentCommon +import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.gif.InlineQueryResultGif +import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.gif.InlineQueryResultGifCached +import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.gif.InlineQueryResultGifCommon +import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.mpeg4gif.InlineQueryResultMpeg4Gif +import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.mpeg4gif.InlineQueryResultMpeg4GifCached +import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.mpeg4gif.InlineQueryResultMpeg4GifCommon +import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.photo.InlineQueryResultPhoto +import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.photo.InlineQueryResultPhotoCached +import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.photo.InlineQueryResultPhotoCommon +import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.video.InlineQueryResultVideo +import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.video.InlineQueryResultVideoCached +import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.video.InlineQueryResultVideoCommon +import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.voice.InlineQueryResultVoice +import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.voice.InlineQueryResultVoiceCached +import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.voice.InlineQueryResultVoiceCommon import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputContactMessageContent import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputInvoiceMessageContent import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputLocationMessageContent import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputTextMessageContent import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputVenueMessageContent +import dev.inmo.tgbotapi.types.InlineQueries.query.BaseInlineQuery +import dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery +import dev.inmo.tgbotapi.types.InlineQueries.query.LocationInlineQuery +import dev.inmo.tgbotapi.types.PrimaryInviteLink +import dev.inmo.tgbotapi.types.SecondaryChatInviteLink import dev.inmo.tgbotapi.types.Username import dev.inmo.tgbotapi.types.actions.BotAction import dev.inmo.tgbotapi.types.actions.ChooseStickerAction @@ -55,39 +110,40 @@ import dev.inmo.tgbotapi.types.buttons.ReplyKeyboardRemove import dev.inmo.tgbotapi.types.chat.AbleToAddInAttachmentMenuChat import dev.inmo.tgbotapi.types.chat.Bot import dev.inmo.tgbotapi.types.chat.ChannelChat -import dev.inmo.tgbotapi.types.chat.ChannelChatImpl import dev.inmo.tgbotapi.types.chat.Chat +import dev.inmo.tgbotapi.types.chat.ChatJoinRequest import dev.inmo.tgbotapi.types.chat.CommonBot import dev.inmo.tgbotapi.types.chat.CommonUser import dev.inmo.tgbotapi.types.chat.ExtendedBot import dev.inmo.tgbotapi.types.chat.ExtendedChannelChat -import dev.inmo.tgbotapi.types.chat.ExtendedChannelChatImpl import dev.inmo.tgbotapi.types.chat.ExtendedChat import dev.inmo.tgbotapi.types.chat.ExtendedChatWithUsername import dev.inmo.tgbotapi.types.chat.ExtendedForumChat -import dev.inmo.tgbotapi.types.chat.ExtendedForumChatImpl import dev.inmo.tgbotapi.types.chat.ExtendedGroupChat -import dev.inmo.tgbotapi.types.chat.ExtendedGroupChatImpl import dev.inmo.tgbotapi.types.chat.ExtendedPrivateChat -import dev.inmo.tgbotapi.types.chat.ExtendedPrivateChatImpl import dev.inmo.tgbotapi.types.chat.ExtendedPublicChat import dev.inmo.tgbotapi.types.chat.ExtendedSupergroupChat -import dev.inmo.tgbotapi.types.chat.ExtendedSupergroupChatImpl import dev.inmo.tgbotapi.types.chat.ForumChat -import dev.inmo.tgbotapi.types.chat.ForumChatImpl import dev.inmo.tgbotapi.types.chat.GroupChat -import dev.inmo.tgbotapi.types.chat.GroupChatImpl import dev.inmo.tgbotapi.types.chat.PossiblyPremiumChat import dev.inmo.tgbotapi.types.chat.PrivateChat -import dev.inmo.tgbotapi.types.chat.PrivateChatImpl import dev.inmo.tgbotapi.types.chat.PublicChat import dev.inmo.tgbotapi.types.chat.SuperPublicChat import dev.inmo.tgbotapi.types.chat.SupergroupChat -import dev.inmo.tgbotapi.types.chat.SupergroupChatImpl import dev.inmo.tgbotapi.types.chat.UnknownChatType import dev.inmo.tgbotapi.types.chat.UnknownExtendedChat import dev.inmo.tgbotapi.types.chat.User import dev.inmo.tgbotapi.types.chat.UsernameChat +import dev.inmo.tgbotapi.types.chat.member.AdministratorChatMember +import dev.inmo.tgbotapi.types.chat.member.BannedChatMember +import dev.inmo.tgbotapi.types.chat.member.ChatMember +import dev.inmo.tgbotapi.types.chat.member.ChatMemberUpdated +import dev.inmo.tgbotapi.types.chat.member.KickedChatMember +import dev.inmo.tgbotapi.types.chat.member.LeftChatMember +import dev.inmo.tgbotapi.types.chat.member.MemberChatMember +import dev.inmo.tgbotapi.types.chat.member.OwnerChatMember +import dev.inmo.tgbotapi.types.chat.member.RestrictedChatMember +import dev.inmo.tgbotapi.types.chat.member.SpecialRightsChatMember import dev.inmo.tgbotapi.types.dice.BasketballDiceAnimationType import dev.inmo.tgbotapi.types.dice.BowlingDiceAnimationType import dev.inmo.tgbotapi.types.dice.CubeDiceAnimationType @@ -145,7 +201,74 @@ import dev.inmo.tgbotapi.types.media.TelegramMediaVideo import dev.inmo.tgbotapi.types.media.ThumbedTelegramMedia import dev.inmo.tgbotapi.types.media.TitledTelegramMedia import dev.inmo.tgbotapi.types.media.VisualMediaGroupMemberTelegramMedia +import dev.inmo.tgbotapi.types.message.ChannelEventMessage +import dev.inmo.tgbotapi.types.message.ChatEvents.ChannelChatCreated +import dev.inmo.tgbotapi.types.message.ChatEvents.DeleteChatPhoto +import dev.inmo.tgbotapi.types.message.ChatEvents.GroupChatCreated +import dev.inmo.tgbotapi.types.message.ChatEvents.LeftChatMemberEvent +import dev.inmo.tgbotapi.types.message.ChatEvents.MessageAutoDeleteTimerChanged +import dev.inmo.tgbotapi.types.message.ChatEvents.MigratedToSupergroup +import dev.inmo.tgbotapi.types.message.ChatEvents.NewChatMembers +import dev.inmo.tgbotapi.types.message.ChatEvents.NewChatPhoto +import dev.inmo.tgbotapi.types.message.ChatEvents.NewChatTitle +import dev.inmo.tgbotapi.types.message.ChatEvents.PinnedMessage +import dev.inmo.tgbotapi.types.message.ChatEvents.ProximityAlertTriggered +import dev.inmo.tgbotapi.types.message.ChatEvents.SupergroupChatCreated +import dev.inmo.tgbotapi.types.message.ChatEvents.UserLoggedIn +import dev.inmo.tgbotapi.types.message.ChatEvents.WebAppData +import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.ChannelEvent +import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.ChatEvent +import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.CommonEvent +import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.ForumEvent +import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.GroupEvent +import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.PrivateEvent +import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.PublicChatEvent +import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.SupergroupEvent +import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.VideoChatEvent +import dev.inmo.tgbotapi.types.message.ChatEvents.forum.ForumTopicClosed +import dev.inmo.tgbotapi.types.message.ChatEvents.forum.ForumTopicCreated +import dev.inmo.tgbotapi.types.message.ChatEvents.forum.ForumTopicEdited +import dev.inmo.tgbotapi.types.message.ChatEvents.forum.ForumTopicReopened +import dev.inmo.tgbotapi.types.message.ChatEvents.forum.GeneralForumTopicHidden +import dev.inmo.tgbotapi.types.message.ChatEvents.forum.GeneralForumTopicUnhidden +import dev.inmo.tgbotapi.types.message.ChatEvents.forum.WriteAccessAllowed +import dev.inmo.tgbotapi.types.message.ChatEvents.voice.VideoChatEnded +import dev.inmo.tgbotapi.types.message.ChatEvents.voice.VideoChatParticipantsInvited +import dev.inmo.tgbotapi.types.message.ChatEvents.voice.VideoChatScheduled +import dev.inmo.tgbotapi.types.message.ChatEvents.voice.VideoChatStarted +import dev.inmo.tgbotapi.types.message.CommonGroupEventMessage +import dev.inmo.tgbotapi.types.message.CommonSupergroupEventMessage import dev.inmo.tgbotapi.types.message.ForwardInfo +import dev.inmo.tgbotapi.types.message.PassportMessage +import dev.inmo.tgbotapi.types.message.PrivateEventMessage +import dev.inmo.tgbotapi.types.message.abstracts.AnonymousForumContentMessage +import dev.inmo.tgbotapi.types.message.abstracts.AnonymousGroupContentMessage +import dev.inmo.tgbotapi.types.message.abstracts.ChannelContentMessage +import dev.inmo.tgbotapi.types.message.abstracts.ChatEventMessage +import dev.inmo.tgbotapi.types.message.abstracts.CommonForumContentMessage +import dev.inmo.tgbotapi.types.message.abstracts.CommonGroupContentMessage +import dev.inmo.tgbotapi.types.message.abstracts.CommonMessage +import dev.inmo.tgbotapi.types.message.abstracts.ConnectedFromChannelGroupContentMessage +import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage +import dev.inmo.tgbotapi.types.message.abstracts.ForumContentMessage +import dev.inmo.tgbotapi.types.message.abstracts.FromChannelForumContentMessage +import dev.inmo.tgbotapi.types.message.abstracts.FromChannelGroupContentMessage +import dev.inmo.tgbotapi.types.message.abstracts.FromUserMessage +import dev.inmo.tgbotapi.types.message.abstracts.GroupContentMessage +import dev.inmo.tgbotapi.types.message.abstracts.GroupEventMessage +import dev.inmo.tgbotapi.types.message.abstracts.Message +import dev.inmo.tgbotapi.types.message.abstracts.PossiblyEditedMessage +import dev.inmo.tgbotapi.types.message.abstracts.PossiblyForwardedMessage +import dev.inmo.tgbotapi.types.message.abstracts.PossiblyMediaGroupMessage +import dev.inmo.tgbotapi.types.message.abstracts.PossiblyPaymentMessage +import dev.inmo.tgbotapi.types.message.abstracts.PossiblySentViaBotCommonMessage +import dev.inmo.tgbotapi.types.message.abstracts.PossiblyTopicMessage +import dev.inmo.tgbotapi.types.message.abstracts.PrivateContentMessage +import dev.inmo.tgbotapi.types.message.abstracts.PublicContentMessage +import dev.inmo.tgbotapi.types.message.abstracts.SignedMessage +import dev.inmo.tgbotapi.types.message.abstracts.SupergroupEventMessage +import dev.inmo.tgbotapi.types.message.abstracts.UnconnectedFromChannelGroupContentMessage +import dev.inmo.tgbotapi.types.message.abstracts.UnknownMessageType import dev.inmo.tgbotapi.types.message.content.AnimationContent import dev.inmo.tgbotapi.types.message.content.AudioContent import dev.inmo.tgbotapi.types.message.content.AudioMediaGroupPartContent @@ -177,6 +300,7 @@ import dev.inmo.tgbotapi.types.message.content.VideoContent import dev.inmo.tgbotapi.types.message.content.VideoNoteContent import dev.inmo.tgbotapi.types.message.content.VisualMediaGroupPartContent import dev.inmo.tgbotapi.types.message.content.VoiceContent +import dev.inmo.tgbotapi.types.message.payments.SuccessfulPaymentEvent import dev.inmo.tgbotapi.types.message.textsources.BoldTextSource import dev.inmo.tgbotapi.types.message.textsources.BotCommandTextSource import dev.inmo.tgbotapi.types.message.textsources.CashTagTextSource @@ -212,20 +336,586 @@ import dev.inmo.tgbotapi.types.passport.PassportElementFilesError import dev.inmo.tgbotapi.types.passport.PassportMultipleElementsError import dev.inmo.tgbotapi.types.passport.PassportSingleElementError import dev.inmo.tgbotapi.types.passport.UnknownPassportElementError +import dev.inmo.tgbotapi.types.passport.decrypted.AddressSecureValue +import dev.inmo.tgbotapi.types.passport.decrypted.BankStatementSecureValue +import dev.inmo.tgbotapi.types.passport.decrypted.CommonPassportSecureValue +import dev.inmo.tgbotapi.types.passport.decrypted.DriverLicenseSecureValue +import dev.inmo.tgbotapi.types.passport.decrypted.IdentityCardSecureValue +import dev.inmo.tgbotapi.types.passport.decrypted.IdentityWithReverseSideSecureValue +import dev.inmo.tgbotapi.types.passport.decrypted.InternalPassportSecureValue +import dev.inmo.tgbotapi.types.passport.decrypted.OtherDocumentsSecureValue +import dev.inmo.tgbotapi.types.passport.decrypted.PassportRegistrationSecureValue +import dev.inmo.tgbotapi.types.passport.decrypted.PassportSecureValue +import dev.inmo.tgbotapi.types.passport.decrypted.PersonalDetailsSecureValue +import dev.inmo.tgbotapi.types.passport.decrypted.RentalAgreementSecureValue +import dev.inmo.tgbotapi.types.passport.decrypted.TemporalRegistrationSecureValue +import dev.inmo.tgbotapi.types.passport.decrypted.UtilityBillSecureValue +import dev.inmo.tgbotapi.types.passport.decrypted.abstracts.SecureValue +import dev.inmo.tgbotapi.types.passport.decrypted.abstracts.SecureValueIdentity +import dev.inmo.tgbotapi.types.passport.decrypted.abstracts.SecureValueWithData +import dev.inmo.tgbotapi.types.passport.decrypted.abstracts.SecureValueWithFiles +import dev.inmo.tgbotapi.types.passport.decrypted.abstracts.SecureValueWithReverseSide +import dev.inmo.tgbotapi.types.passport.decrypted.abstracts.SecureValueWithTranslations +import dev.inmo.tgbotapi.types.passport.encrypted.BankStatement +import dev.inmo.tgbotapi.types.passport.encrypted.CommonPassport +import dev.inmo.tgbotapi.types.passport.encrypted.DriverLicense +import dev.inmo.tgbotapi.types.passport.encrypted.Email +import dev.inmo.tgbotapi.types.passport.encrypted.EncryptedAddress +import dev.inmo.tgbotapi.types.passport.encrypted.EncryptedPassportElementWithTranslatableFilesCollection +import dev.inmo.tgbotapi.types.passport.encrypted.EncryptedPassportElementWithTranslatableIDDocument +import dev.inmo.tgbotapi.types.passport.encrypted.EncryptedPersonalDetails +import dev.inmo.tgbotapi.types.passport.encrypted.IdentityCard +import dev.inmo.tgbotapi.types.passport.encrypted.InternalPassport +import dev.inmo.tgbotapi.types.passport.encrypted.Passport +import dev.inmo.tgbotapi.types.passport.encrypted.PassportRegistration +import dev.inmo.tgbotapi.types.passport.encrypted.PhoneNumber +import dev.inmo.tgbotapi.types.passport.encrypted.RentalAgreement +import dev.inmo.tgbotapi.types.passport.encrypted.TemporaryRegistration +import dev.inmo.tgbotapi.types.passport.encrypted.UtilityBill +import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.EncryptedPassportElement +import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.EncryptedPassportElementTranslatable +import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.EncryptedPassportElementWithData +import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.EncryptedPassportElementWithEmail +import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.EncryptedPassportElementWithFilesCollection +import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.EncryptedPassportElementWithFrontSide +import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.EncryptedPassportElementWithPhoneNumber +import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.EncryptedPassportElementWithReverseSide +import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.EncryptedPassportElementWithSelfie +import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.UnknownEncryptedPassportElement +import dev.inmo.tgbotapi.types.payments.PreCheckoutQuery +import dev.inmo.tgbotapi.types.payments.ShippingQuery import dev.inmo.tgbotapi.types.polls.ApproximateScheduledCloseInfo import dev.inmo.tgbotapi.types.polls.ExactScheduledCloseInfo import dev.inmo.tgbotapi.types.polls.MultipleAnswersPoll import dev.inmo.tgbotapi.types.polls.Poll +import dev.inmo.tgbotapi.types.polls.PollAnswer import dev.inmo.tgbotapi.types.polls.QuizPoll import dev.inmo.tgbotapi.types.polls.RegularPoll import dev.inmo.tgbotapi.types.polls.ScheduledCloseInfo import dev.inmo.tgbotapi.types.polls.UnknownPollType +import dev.inmo.tgbotapi.types.queries.callback.CallbackQuery +import dev.inmo.tgbotapi.types.queries.callback.DataCallbackQuery +import dev.inmo.tgbotapi.types.queries.callback.GameShortNameCallbackQuery +import dev.inmo.tgbotapi.types.queries.callback.InlineMessageIdCallbackQuery +import dev.inmo.tgbotapi.types.queries.callback.InlineMessageIdDataCallbackQuery +import dev.inmo.tgbotapi.types.queries.callback.InlineMessageIdGameShortNameCallbackQuery +import dev.inmo.tgbotapi.types.queries.callback.MessageCallbackQuery +import dev.inmo.tgbotapi.types.queries.callback.MessageDataCallbackQuery +import dev.inmo.tgbotapi.types.queries.callback.MessageGameShortNameCallbackQuery +import dev.inmo.tgbotapi.types.queries.callback.UnknownCallbackQueryType import dev.inmo.tgbotapi.types.request.ChatShared import dev.inmo.tgbotapi.types.request.ChatSharedRequest import dev.inmo.tgbotapi.types.request.RequestResponse import dev.inmo.tgbotapi.types.request.UserShared +import dev.inmo.tgbotapi.types.update.CallbackQueryUpdate +import dev.inmo.tgbotapi.types.update.ChannelPostUpdate +import dev.inmo.tgbotapi.types.update.ChatJoinRequestUpdate +import dev.inmo.tgbotapi.types.update.ChosenInlineResultUpdate +import dev.inmo.tgbotapi.types.update.CommonChatMemberUpdatedUpdate +import dev.inmo.tgbotapi.types.update.EditChannelPostUpdate +import dev.inmo.tgbotapi.types.update.EditMessageUpdate +import dev.inmo.tgbotapi.types.update.InlineQueryUpdate +import dev.inmo.tgbotapi.types.update.MessageUpdate +import dev.inmo.tgbotapi.types.update.MyChatMemberUpdatedUpdate +import dev.inmo.tgbotapi.types.update.PollAnswerUpdate +import dev.inmo.tgbotapi.types.update.PollUpdate +import dev.inmo.tgbotapi.types.update.PreCheckoutQueryUpdate +import dev.inmo.tgbotapi.types.update.ShippingQueryUpdate +import dev.inmo.tgbotapi.types.update.abstracts.BaseEditMessageUpdate +import dev.inmo.tgbotapi.types.update.abstracts.BaseMessageUpdate +import dev.inmo.tgbotapi.types.update.abstracts.BaseSentMessageUpdate +import dev.inmo.tgbotapi.types.update.abstracts.ChatMemberUpdatedUpdate +import dev.inmo.tgbotapi.types.update.abstracts.UnknownUpdate +import dev.inmo.tgbotapi.types.update.abstracts.Update import kotlin.Suppress +public inline fun CommonSendInvoiceData.createInvoiceLinkOrNull(): CreateInvoiceLink? = this as? + dev.inmo.tgbotapi.requests.send.payments.CreateInvoiceLink + +public inline fun CommonSendInvoiceData.createInvoiceLinkOrThrow(): CreateInvoiceLink = this as + dev.inmo.tgbotapi.requests.send.payments.CreateInvoiceLink + +public inline fun CommonSendInvoiceData.ifCreateInvoiceLink(block: (CreateInvoiceLink) -> T): T? + = createInvoiceLinkOrNull() ?.let(block) + +public inline fun CommonSendInvoiceData.sendInvoiceOrNull(): SendInvoice? = this as? + dev.inmo.tgbotapi.requests.send.payments.SendInvoice + +public inline fun CommonSendInvoiceData.sendInvoiceOrThrow(): SendInvoice = this as + dev.inmo.tgbotapi.requests.send.payments.SendInvoice + +public inline fun CommonSendInvoiceData.ifSendInvoice(block: (SendInvoice) -> T): T? = + sendInvoiceOrNull() ?.let(block) + +public inline fun CommonSendInvoiceData.inputInvoiceMessageContentOrNull(): + InputInvoiceMessageContent? = this as? + dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputInvoiceMessageContent + +public inline fun CommonSendInvoiceData.inputInvoiceMessageContentOrThrow(): + InputInvoiceMessageContent = this as + dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputInvoiceMessageContent + +public inline fun + CommonSendInvoiceData.ifInputInvoiceMessageContent(block: (InputInvoiceMessageContent) -> T): T? + = inputInvoiceMessageContentOrNull() ?.let(block) + +public inline fun WithUser.fromUserOrNull(): FromUser? = this as? + dev.inmo.tgbotapi.abstracts.FromUser + +public inline fun WithUser.fromUserOrThrow(): FromUser = this as + dev.inmo.tgbotapi.abstracts.FromUser + +public inline fun WithUser.ifFromUser(block: (FromUser) -> T): T? = fromUserOrNull() + ?.let(block) + +public inline fun WithUser.chatInviteLinkOrNull(): ChatInviteLink? = this as? + dev.inmo.tgbotapi.types.ChatInviteLink + +public inline fun WithUser.chatInviteLinkOrThrow(): ChatInviteLink = this as + dev.inmo.tgbotapi.types.ChatInviteLink + +public inline fun WithUser.ifChatInviteLink(block: (ChatInviteLink) -> T): T? = + chatInviteLinkOrNull() ?.let(block) + +public inline fun WithUser.secondaryChatInviteLinkOrNull(): SecondaryChatInviteLink? = this as? + dev.inmo.tgbotapi.types.SecondaryChatInviteLink + +public inline fun WithUser.secondaryChatInviteLinkOrThrow(): SecondaryChatInviteLink = this as + dev.inmo.tgbotapi.types.SecondaryChatInviteLink + +public inline fun WithUser.ifSecondaryChatInviteLink(block: (SecondaryChatInviteLink) -> T): T? + = secondaryChatInviteLinkOrNull() ?.let(block) + +public inline fun WithUser.primaryInviteLinkOrNull(): PrimaryInviteLink? = this as? + dev.inmo.tgbotapi.types.PrimaryInviteLink + +public inline fun WithUser.primaryInviteLinkOrThrow(): PrimaryInviteLink = this as + dev.inmo.tgbotapi.types.PrimaryInviteLink + +public inline fun WithUser.ifPrimaryInviteLink(block: (PrimaryInviteLink) -> T): T? = + primaryInviteLinkOrNull() ?.let(block) + +public inline fun WithUser.chatInviteLinkWithJoinRequestOrNull(): ChatInviteLinkWithJoinRequest? = + this as? dev.inmo.tgbotapi.types.ChatInviteLinkWithJoinRequest + +public inline fun WithUser.chatInviteLinkWithJoinRequestOrThrow(): ChatInviteLinkWithJoinRequest = + this as dev.inmo.tgbotapi.types.ChatInviteLinkWithJoinRequest + +public inline fun + WithUser.ifChatInviteLinkWithJoinRequest(block: (ChatInviteLinkWithJoinRequest) -> T): T? = + chatInviteLinkWithJoinRequestOrNull() ?.let(block) + +public inline fun WithUser.chatInviteLinkWithLimitedMembersOrNull(): + ChatInviteLinkWithLimitedMembers? = this as? + dev.inmo.tgbotapi.types.ChatInviteLinkWithLimitedMembers + +public inline fun WithUser.chatInviteLinkWithLimitedMembersOrThrow(): + ChatInviteLinkWithLimitedMembers = this as + dev.inmo.tgbotapi.types.ChatInviteLinkWithLimitedMembers + +public inline fun + WithUser.ifChatInviteLinkWithLimitedMembers(block: (ChatInviteLinkWithLimitedMembers) -> T): T? + = chatInviteLinkWithLimitedMembersOrNull() ?.let(block) + +public inline fun WithUser.chatInviteLinkUnlimitedOrNull(): ChatInviteLinkUnlimited? = this as? + dev.inmo.tgbotapi.types.ChatInviteLinkUnlimited + +public inline fun WithUser.chatInviteLinkUnlimitedOrThrow(): ChatInviteLinkUnlimited = this as + dev.inmo.tgbotapi.types.ChatInviteLinkUnlimited + +public inline fun WithUser.ifChatInviteLinkUnlimited(block: (ChatInviteLinkUnlimited) -> T): T? + = chatInviteLinkUnlimitedOrNull() ?.let(block) + +public inline fun WithUser.baseChosenInlineResultOrNull(): BaseChosenInlineResult? = this as? + dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.BaseChosenInlineResult + +public inline fun WithUser.baseChosenInlineResultOrThrow(): BaseChosenInlineResult = this as + dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.BaseChosenInlineResult + +public inline fun WithUser.ifBaseChosenInlineResult(block: (BaseChosenInlineResult) -> T): T? = + baseChosenInlineResultOrNull() ?.let(block) + +public inline fun WithUser.chosenInlineResultOrNull(): ChosenInlineResult? = this as? + dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.ChosenInlineResult + +public inline fun WithUser.chosenInlineResultOrThrow(): ChosenInlineResult = this as + dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.ChosenInlineResult + +public inline fun WithUser.ifChosenInlineResult(block: (ChosenInlineResult) -> T): T? = + chosenInlineResultOrNull() ?.let(block) + +public inline fun WithUser.locationChosenInlineResultOrNull(): LocationChosenInlineResult? = this + as? dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.LocationChosenInlineResult + +public inline fun WithUser.locationChosenInlineResultOrThrow(): LocationChosenInlineResult = this as + dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.LocationChosenInlineResult + +public inline fun + WithUser.ifLocationChosenInlineResult(block: (LocationChosenInlineResult) -> T): T? = + locationChosenInlineResultOrNull() ?.let(block) + +public inline fun WithUser.baseInlineQueryOrNull(): BaseInlineQuery? = this as? + dev.inmo.tgbotapi.types.InlineQueries.query.BaseInlineQuery + +public inline fun WithUser.baseInlineQueryOrThrow(): BaseInlineQuery = this as + dev.inmo.tgbotapi.types.InlineQueries.query.BaseInlineQuery + +public inline fun WithUser.ifBaseInlineQuery(block: (BaseInlineQuery) -> T): T? = + baseInlineQueryOrNull() ?.let(block) + +public inline fun WithUser.inlineQueryOrNull(): InlineQuery? = this as? + dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery + +public inline fun WithUser.inlineQueryOrThrow(): InlineQuery = this as + dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery + +public inline fun WithUser.ifInlineQuery(block: (InlineQuery) -> T): T? = inlineQueryOrNull() + ?.let(block) + +public inline fun WithUser.locationInlineQueryOrNull(): LocationInlineQuery? = this as? + dev.inmo.tgbotapi.types.InlineQueries.query.LocationInlineQuery + +public inline fun WithUser.locationInlineQueryOrThrow(): LocationInlineQuery = this as + dev.inmo.tgbotapi.types.InlineQueries.query.LocationInlineQuery + +public inline fun WithUser.ifLocationInlineQuery(block: (LocationInlineQuery) -> T): T? = + locationInlineQueryOrNull() ?.let(block) + +public inline fun WithUser.chatJoinRequestOrNull(): ChatJoinRequest? = this as? + dev.inmo.tgbotapi.types.chat.ChatJoinRequest + +public inline fun WithUser.chatJoinRequestOrThrow(): ChatJoinRequest = this as + dev.inmo.tgbotapi.types.chat.ChatJoinRequest + +public inline fun WithUser.ifChatJoinRequest(block: (ChatJoinRequest) -> T): T? = + chatJoinRequestOrNull() ?.let(block) + +public inline fun WithUser.administratorChatMemberOrNull(): AdministratorChatMember? = this as? + dev.inmo.tgbotapi.types.chat.member.AdministratorChatMember + +public inline fun WithUser.administratorChatMemberOrThrow(): AdministratorChatMember = this as + dev.inmo.tgbotapi.types.chat.member.AdministratorChatMember + +public inline fun WithUser.ifAdministratorChatMember(block: (AdministratorChatMember) -> T): T? + = administratorChatMemberOrNull() ?.let(block) + +public inline fun WithUser.bannedChatMemberOrNull(): BannedChatMember? = this as? + dev.inmo.tgbotapi.types.chat.member.BannedChatMember + +public inline fun WithUser.bannedChatMemberOrThrow(): BannedChatMember = this as + dev.inmo.tgbotapi.types.chat.member.BannedChatMember + +public inline fun WithUser.ifBannedChatMember(block: (BannedChatMember) -> T): T? = + bannedChatMemberOrNull() ?.let(block) + +public inline fun WithUser.chatMemberOrNull(): ChatMember? = this as? + dev.inmo.tgbotapi.types.chat.member.ChatMember + +public inline fun WithUser.chatMemberOrThrow(): ChatMember = this as + dev.inmo.tgbotapi.types.chat.member.ChatMember + +public inline fun WithUser.ifChatMember(block: (ChatMember) -> T): T? = chatMemberOrNull() + ?.let(block) + +public inline fun WithUser.chatMemberUpdatedOrNull(): ChatMemberUpdated? = this as? + dev.inmo.tgbotapi.types.chat.member.ChatMemberUpdated + +public inline fun WithUser.chatMemberUpdatedOrThrow(): ChatMemberUpdated = this as + dev.inmo.tgbotapi.types.chat.member.ChatMemberUpdated + +public inline fun WithUser.ifChatMemberUpdated(block: (ChatMemberUpdated) -> T): T? = + chatMemberUpdatedOrNull() ?.let(block) + +public inline fun WithUser.kickedChatMemberOrNull(): KickedChatMember? = this as? + dev.inmo.tgbotapi.types.chat.member.KickedChatMember + +public inline fun WithUser.kickedChatMemberOrThrow(): KickedChatMember = this as + dev.inmo.tgbotapi.types.chat.member.KickedChatMember + +public inline fun WithUser.ifKickedChatMember(block: (KickedChatMember) -> T): T? = + kickedChatMemberOrNull() ?.let(block) + +public inline fun WithUser.leftChatMemberOrNull(): LeftChatMember? = this as? + dev.inmo.tgbotapi.types.chat.member.LeftChatMember + +public inline fun WithUser.leftChatMemberOrThrow(): LeftChatMember = this as + dev.inmo.tgbotapi.types.chat.member.LeftChatMember + +public inline fun WithUser.ifLeftChatMember(block: (LeftChatMember) -> T): T? = + leftChatMemberOrNull() ?.let(block) + +public inline fun WithUser.memberChatMemberOrNull(): MemberChatMember? = this as? + dev.inmo.tgbotapi.types.chat.member.MemberChatMember + +public inline fun WithUser.memberChatMemberOrThrow(): MemberChatMember = this as + dev.inmo.tgbotapi.types.chat.member.MemberChatMember + +public inline fun WithUser.ifMemberChatMember(block: (MemberChatMember) -> T): T? = + memberChatMemberOrNull() ?.let(block) + +public inline fun WithUser.ownerChatMemberOrNull(): OwnerChatMember? = this as? + dev.inmo.tgbotapi.types.chat.member.OwnerChatMember + +public inline fun WithUser.ownerChatMemberOrThrow(): OwnerChatMember = this as + dev.inmo.tgbotapi.types.chat.member.OwnerChatMember + +public inline fun WithUser.ifOwnerChatMember(block: (OwnerChatMember) -> T): T? = + ownerChatMemberOrNull() ?.let(block) + +public inline fun WithUser.restrictedChatMemberOrNull(): RestrictedChatMember? = this as? + dev.inmo.tgbotapi.types.chat.member.RestrictedChatMember + +public inline fun WithUser.restrictedChatMemberOrThrow(): RestrictedChatMember = this as + dev.inmo.tgbotapi.types.chat.member.RestrictedChatMember + +public inline fun WithUser.ifRestrictedChatMember(block: (RestrictedChatMember) -> T): T? = + restrictedChatMemberOrNull() ?.let(block) + +public inline fun WithUser.specialRightsChatMemberOrNull(): SpecialRightsChatMember? = this as? + dev.inmo.tgbotapi.types.chat.member.SpecialRightsChatMember + +public inline fun WithUser.specialRightsChatMemberOrThrow(): SpecialRightsChatMember = this as + dev.inmo.tgbotapi.types.chat.member.SpecialRightsChatMember + +public inline fun WithUser.ifSpecialRightsChatMember(block: (SpecialRightsChatMember) -> T): T? + = specialRightsChatMemberOrNull() ?.let(block) + +public inline fun WithUser.leftChatMemberEventOrNull(): LeftChatMemberEvent? = this as? + dev.inmo.tgbotapi.types.message.ChatEvents.LeftChatMemberEvent + +public inline fun WithUser.leftChatMemberEventOrThrow(): LeftChatMemberEvent = this as + dev.inmo.tgbotapi.types.message.ChatEvents.LeftChatMemberEvent + +public inline fun WithUser.ifLeftChatMemberEvent(block: (LeftChatMemberEvent) -> T): T? = + leftChatMemberEventOrNull() ?.let(block) + +public inline fun WithUser.commonGroupEventMessageOrNull(): CommonGroupEventMessage? = + this as? + dev.inmo.tgbotapi.types.message.CommonGroupEventMessage + +public inline fun WithUser.commonGroupEventMessageOrThrow(): CommonGroupEventMessage = + this as + dev.inmo.tgbotapi.types.message.CommonGroupEventMessage + +public inline fun + WithUser.ifCommonGroupEventMessage(block: (CommonGroupEventMessage) -> T): T? = + commonGroupEventMessageOrNull() ?.let(block) + +public inline fun WithUser.commonSupergroupEventMessageOrNull(): + CommonSupergroupEventMessage? = this as? + dev.inmo.tgbotapi.types.message.CommonSupergroupEventMessage + +public inline fun WithUser.commonSupergroupEventMessageOrThrow(): + CommonSupergroupEventMessage = this as + dev.inmo.tgbotapi.types.message.CommonSupergroupEventMessage + +public inline fun + WithUser.ifCommonSupergroupEventMessage(block: (CommonSupergroupEventMessage) -> T): + T? = commonSupergroupEventMessageOrNull() ?.let(block) + +public inline fun WithUser.passportMessageOrNull(): PassportMessage? = this as? + dev.inmo.tgbotapi.types.message.PassportMessage + +public inline fun WithUser.passportMessageOrThrow(): PassportMessage = this as + dev.inmo.tgbotapi.types.message.PassportMessage + +public inline fun WithUser.ifPassportMessage(block: (PassportMessage) -> T): T? = + passportMessageOrNull() ?.let(block) + +public inline fun WithUser.fromUserMessageOrNull(): FromUserMessage? = this as? + dev.inmo.tgbotapi.types.message.abstracts.FromUserMessage + +public inline fun WithUser.fromUserMessageOrThrow(): FromUserMessage = this as + dev.inmo.tgbotapi.types.message.abstracts.FromUserMessage + +public inline fun WithUser.ifFromUserMessage(block: (FromUserMessage) -> T): T? = + fromUserMessageOrNull() ?.let(block) + +public inline fun WithUser.groupEventMessageOrNull(): GroupEventMessage? = this as? + dev.inmo.tgbotapi.types.message.abstracts.GroupEventMessage + +public inline fun WithUser.groupEventMessageOrThrow(): GroupEventMessage = this as + dev.inmo.tgbotapi.types.message.abstracts.GroupEventMessage + +public inline fun WithUser.ifGroupEventMessage(block: (GroupEventMessage) -> T): T? + = groupEventMessageOrNull() ?.let(block) + +public inline fun WithUser.commonGroupContentMessageOrNull(): + CommonGroupContentMessage? = this as? + dev.inmo.tgbotapi.types.message.abstracts.CommonGroupContentMessage + +public inline fun WithUser.commonGroupContentMessageOrThrow(): + CommonGroupContentMessage = this as + dev.inmo.tgbotapi.types.message.abstracts.CommonGroupContentMessage + +public inline fun + WithUser.ifCommonGroupContentMessage(block: (CommonGroupContentMessage) -> T): + T? = commonGroupContentMessageOrNull() ?.let(block) + +public inline fun WithUser.commonForumContentMessageOrNull(): + CommonForumContentMessage? = this as? + dev.inmo.tgbotapi.types.message.abstracts.CommonForumContentMessage + +public inline fun WithUser.commonForumContentMessageOrThrow(): + CommonForumContentMessage = this as + dev.inmo.tgbotapi.types.message.abstracts.CommonForumContentMessage + +public inline fun + WithUser.ifCommonForumContentMessage(block: (CommonForumContentMessage) -> T): + T? = commonForumContentMessageOrNull() ?.let(block) + +public inline fun WithUser.privateContentMessageOrNull(): PrivateContentMessage? = + this as? + dev.inmo.tgbotapi.types.message.abstracts.PrivateContentMessage + +public inline fun WithUser.privateContentMessageOrThrow(): PrivateContentMessage = + this as + dev.inmo.tgbotapi.types.message.abstracts.PrivateContentMessage + +public inline fun + WithUser.ifPrivateContentMessage(block: (PrivateContentMessage) -> T): T? = + privateContentMessageOrNull() ?.let(block) + +public inline fun WithUser.supergroupEventMessageOrNull(): SupergroupEventMessage? + = this as? + dev.inmo.tgbotapi.types.message.abstracts.SupergroupEventMessage + +public inline fun WithUser.supergroupEventMessageOrThrow(): SupergroupEventMessage + = this as + dev.inmo.tgbotapi.types.message.abstracts.SupergroupEventMessage + +public inline fun + WithUser.ifSupergroupEventMessage(block: (SupergroupEventMessage) -> T): T? = + supergroupEventMessageOrNull() ?.let(block) + +public inline fun WithUser.preCheckoutQueryOrNull(): PreCheckoutQuery? = this as? + dev.inmo.tgbotapi.types.payments.PreCheckoutQuery + +public inline fun WithUser.preCheckoutQueryOrThrow(): PreCheckoutQuery = this as + dev.inmo.tgbotapi.types.payments.PreCheckoutQuery + +public inline fun WithUser.ifPreCheckoutQuery(block: (PreCheckoutQuery) -> T): T? = + preCheckoutQueryOrNull() ?.let(block) + +public inline fun WithUser.shippingQueryOrNull(): ShippingQuery? = this as? + dev.inmo.tgbotapi.types.payments.ShippingQuery + +public inline fun WithUser.shippingQueryOrThrow(): ShippingQuery = this as + dev.inmo.tgbotapi.types.payments.ShippingQuery + +public inline fun WithUser.ifShippingQuery(block: (ShippingQuery) -> T): T? = + shippingQueryOrNull() ?.let(block) + +public inline fun WithUser.pollAnswerOrNull(): PollAnswer? = this as? + dev.inmo.tgbotapi.types.polls.PollAnswer + +public inline fun WithUser.pollAnswerOrThrow(): PollAnswer = this as + dev.inmo.tgbotapi.types.polls.PollAnswer + +public inline fun WithUser.ifPollAnswer(block: (PollAnswer) -> T): T? = pollAnswerOrNull() + ?.let(block) + +public inline fun WithUser.callbackQueryOrNull(): CallbackQuery? = this as? + dev.inmo.tgbotapi.types.queries.callback.CallbackQuery + +public inline fun WithUser.callbackQueryOrThrow(): CallbackQuery = this as + dev.inmo.tgbotapi.types.queries.callback.CallbackQuery + +public inline fun WithUser.ifCallbackQuery(block: (CallbackQuery) -> T): T? = + callbackQueryOrNull() ?.let(block) + +public inline fun WithUser.unknownCallbackQueryTypeOrNull(): UnknownCallbackQueryType? = this as? + dev.inmo.tgbotapi.types.queries.callback.UnknownCallbackQueryType + +public inline fun WithUser.unknownCallbackQueryTypeOrThrow(): UnknownCallbackQueryType = this as + dev.inmo.tgbotapi.types.queries.callback.UnknownCallbackQueryType + +public inline fun WithUser.ifUnknownCallbackQueryType(block: (UnknownCallbackQueryType) -> T): + T? = unknownCallbackQueryTypeOrNull() ?.let(block) + +public inline fun WithUser.dataCallbackQueryOrNull(): DataCallbackQuery? = this as? + dev.inmo.tgbotapi.types.queries.callback.DataCallbackQuery + +public inline fun WithUser.dataCallbackQueryOrThrow(): DataCallbackQuery = this as + dev.inmo.tgbotapi.types.queries.callback.DataCallbackQuery + +public inline fun WithUser.ifDataCallbackQuery(block: (DataCallbackQuery) -> T): T? = + dataCallbackQueryOrNull() ?.let(block) + +public inline fun WithUser.gameShortNameCallbackQueryOrNull(): GameShortNameCallbackQuery? = this + as? dev.inmo.tgbotapi.types.queries.callback.GameShortNameCallbackQuery + +public inline fun WithUser.gameShortNameCallbackQueryOrThrow(): GameShortNameCallbackQuery = this as + dev.inmo.tgbotapi.types.queries.callback.GameShortNameCallbackQuery + +public inline fun + WithUser.ifGameShortNameCallbackQuery(block: (GameShortNameCallbackQuery) -> T): T? = + gameShortNameCallbackQueryOrNull() ?.let(block) + +public inline fun WithUser.inlineMessageIdCallbackQueryOrNull(): InlineMessageIdCallbackQuery? = + this as? dev.inmo.tgbotapi.types.queries.callback.InlineMessageIdCallbackQuery + +public inline fun WithUser.inlineMessageIdCallbackQueryOrThrow(): InlineMessageIdCallbackQuery = + this as dev.inmo.tgbotapi.types.queries.callback.InlineMessageIdCallbackQuery + +public inline fun + WithUser.ifInlineMessageIdCallbackQuery(block: (InlineMessageIdCallbackQuery) -> T): T? = + inlineMessageIdCallbackQueryOrNull() ?.let(block) + +public inline fun WithUser.inlineMessageIdDataCallbackQueryOrNull(): + InlineMessageIdDataCallbackQuery? = this as? + dev.inmo.tgbotapi.types.queries.callback.InlineMessageIdDataCallbackQuery + +public inline fun WithUser.inlineMessageIdDataCallbackQueryOrThrow(): + InlineMessageIdDataCallbackQuery = this as + dev.inmo.tgbotapi.types.queries.callback.InlineMessageIdDataCallbackQuery + +public inline fun + WithUser.ifInlineMessageIdDataCallbackQuery(block: (InlineMessageIdDataCallbackQuery) -> T): T? + = inlineMessageIdDataCallbackQueryOrNull() ?.let(block) + +public inline fun WithUser.inlineMessageIdGameShortNameCallbackQueryOrNull(): + InlineMessageIdGameShortNameCallbackQuery? = this as? + dev.inmo.tgbotapi.types.queries.callback.InlineMessageIdGameShortNameCallbackQuery + +public inline fun WithUser.inlineMessageIdGameShortNameCallbackQueryOrThrow(): + InlineMessageIdGameShortNameCallbackQuery = this as + dev.inmo.tgbotapi.types.queries.callback.InlineMessageIdGameShortNameCallbackQuery + +public inline fun + WithUser.ifInlineMessageIdGameShortNameCallbackQuery(block: (InlineMessageIdGameShortNameCallbackQuery) -> T): + T? = inlineMessageIdGameShortNameCallbackQueryOrNull() ?.let(block) + +public inline fun WithUser.messageCallbackQueryOrNull(): MessageCallbackQuery? = this as? + dev.inmo.tgbotapi.types.queries.callback.MessageCallbackQuery + +public inline fun WithUser.messageCallbackQueryOrThrow(): MessageCallbackQuery = this as + dev.inmo.tgbotapi.types.queries.callback.MessageCallbackQuery + +public inline fun WithUser.ifMessageCallbackQuery(block: (MessageCallbackQuery) -> T): T? = + messageCallbackQueryOrNull() ?.let(block) + +public inline fun WithUser.messageDataCallbackQueryOrNull(): MessageDataCallbackQuery? = this as? + dev.inmo.tgbotapi.types.queries.callback.MessageDataCallbackQuery + +public inline fun WithUser.messageDataCallbackQueryOrThrow(): MessageDataCallbackQuery = this as + dev.inmo.tgbotapi.types.queries.callback.MessageDataCallbackQuery + +public inline fun WithUser.ifMessageDataCallbackQuery(block: (MessageDataCallbackQuery) -> T): + T? = messageDataCallbackQueryOrNull() ?.let(block) + +public inline fun WithUser.messageGameShortNameCallbackQueryOrNull(): + MessageGameShortNameCallbackQuery? = this as? + dev.inmo.tgbotapi.types.queries.callback.MessageGameShortNameCallbackQuery + +public inline fun WithUser.messageGameShortNameCallbackQueryOrThrow(): + MessageGameShortNameCallbackQuery = this as + dev.inmo.tgbotapi.types.queries.callback.MessageGameShortNameCallbackQuery + +public inline fun + WithUser.ifMessageGameShortNameCallbackQuery(block: (MessageGameShortNameCallbackQuery) -> T): + T? = messageGameShortNameCallbackQueryOrNull() ?.let(block) + public inline fun InlineQueryResultsButton.startOrNull(): InlineQueryResultsButton.Start? = this as? dev.inmo.tgbotapi.requests.answers.InlineQueryResultsButton.Start @@ -327,6 +1017,428 @@ public inline fun ChatIdentifier.usernameOrThrow(): Username = this as public inline fun ChatIdentifier.ifUsername(block: (Username) -> T): T? = usernameOrNull() ?.let(block) +public inline fun InlineQueryResult.inlineQueryResultArticleOrNull(): InlineQueryResultArticle? = + this as? dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultArticle + +public inline fun InlineQueryResult.inlineQueryResultArticleOrThrow(): InlineQueryResultArticle = + this as dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultArticle + +public inline fun + InlineQueryResult.ifInlineQueryResultArticle(block: (InlineQueryResultArticle) -> T): T? = + inlineQueryResultArticleOrNull() ?.let(block) + +public inline fun InlineQueryResult.inlineQueryResultContactOrNull(): InlineQueryResultContact? = + this as? dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultContact + +public inline fun InlineQueryResult.inlineQueryResultContactOrThrow(): InlineQueryResultContact = + this as dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultContact + +public inline fun + InlineQueryResult.ifInlineQueryResultContact(block: (InlineQueryResultContact) -> T): T? = + inlineQueryResultContactOrNull() ?.let(block) + +public inline fun InlineQueryResult.inlineQueryResultGameOrNull(): InlineQueryResultGame? = this as? + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultGame + +public inline fun InlineQueryResult.inlineQueryResultGameOrThrow(): InlineQueryResultGame = this as + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultGame + +public inline fun + InlineQueryResult.ifInlineQueryResultGame(block: (InlineQueryResultGame) -> T): T? = + inlineQueryResultGameOrNull() ?.let(block) + +public inline fun InlineQueryResult.inlineQueryResultLocationOrNull(): InlineQueryResultLocation? = + this as? dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultLocation + +public inline fun InlineQueryResult.inlineQueryResultLocationOrThrow(): InlineQueryResultLocation = + this as dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultLocation + +public inline fun + InlineQueryResult.ifInlineQueryResultLocation(block: (InlineQueryResultLocation) -> T): T? = + inlineQueryResultLocationOrNull() ?.let(block) + +public inline fun InlineQueryResult.inlineQueryResultStickerCachedOrNull(): + InlineQueryResultStickerCached? = this as? + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultStickerCached + +public inline fun InlineQueryResult.inlineQueryResultStickerCachedOrThrow(): + InlineQueryResultStickerCached = this as + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultStickerCached + +public inline fun + InlineQueryResult.ifInlineQueryResultStickerCached(block: (InlineQueryResultStickerCached) -> T): + T? = inlineQueryResultStickerCachedOrNull() ?.let(block) + +public inline fun InlineQueryResult.inlineQueryResultVenueOrNull(): InlineQueryResultVenue? = this + as? dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultVenue + +public inline fun InlineQueryResult.inlineQueryResultVenueOrThrow(): InlineQueryResultVenue = this + as dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultVenue + +public inline fun + InlineQueryResult.ifInlineQueryResultVenue(block: (InlineQueryResultVenue) -> T): T? = + inlineQueryResultVenueOrNull() ?.let(block) + +public inline fun InlineQueryResult.describedInlineQueryResultOrNull(): DescribedInlineQueryResult? + = this as? + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.DescribedInlineQueryResult + +public inline fun InlineQueryResult.describedInlineQueryResultOrThrow(): DescribedInlineQueryResult + = this as + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.DescribedInlineQueryResult + +public inline fun + InlineQueryResult.ifDescribedInlineQueryResult(block: (DescribedInlineQueryResult) -> T): T? = + describedInlineQueryResultOrNull() ?.let(block) + +public inline fun InlineQueryResult.fileInlineQueryResultOrNull(): FileInlineQueryResult? = this as? + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.FileInlineQueryResult + +public inline fun InlineQueryResult.fileInlineQueryResultOrThrow(): FileInlineQueryResult = this as + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.FileInlineQueryResult + +public inline fun + InlineQueryResult.ifFileInlineQueryResult(block: (FileInlineQueryResult) -> T): T? = + fileInlineQueryResultOrNull() ?.let(block) + +public inline fun InlineQueryResult.optionallyTitledInlineQueryResultOrNull(): + OptionallyTitledInlineQueryResult? = this as? + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.OptionallyTitledInlineQueryResult + +public inline fun InlineQueryResult.optionallyTitledInlineQueryResultOrThrow(): + OptionallyTitledInlineQueryResult = this as + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.OptionallyTitledInlineQueryResult + +public inline fun + InlineQueryResult.ifOptionallyTitledInlineQueryResult(block: (OptionallyTitledInlineQueryResult) -> T): + T? = optionallyTitledInlineQueryResultOrNull() ?.let(block) + +public inline fun InlineQueryResult.sizedInlineQueryResultOrNull(): SizedInlineQueryResult? = this + as? dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.SizedInlineQueryResult + +public inline fun InlineQueryResult.sizedInlineQueryResultOrThrow(): SizedInlineQueryResult = this + as dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.SizedInlineQueryResult + +public inline fun + InlineQueryResult.ifSizedInlineQueryResult(block: (SizedInlineQueryResult) -> T): T? = + sizedInlineQueryResultOrNull() ?.let(block) + +public inline fun InlineQueryResult.thumbSizedInlineQueryResultOrNull(): + ThumbSizedInlineQueryResult? = this as? + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.ThumbSizedInlineQueryResult + +public inline fun InlineQueryResult.thumbSizedInlineQueryResultOrThrow(): + ThumbSizedInlineQueryResult = this as + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.ThumbSizedInlineQueryResult + +public inline fun + InlineQueryResult.ifThumbSizedInlineQueryResult(block: (ThumbSizedInlineQueryResult) -> T): T? = + thumbSizedInlineQueryResultOrNull() ?.let(block) + +public inline fun InlineQueryResult.thumbedInlineQueryResultOrNull(): ThumbedInlineQueryResult? = + this as? + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.ThumbedInlineQueryResult + +public inline fun InlineQueryResult.thumbedInlineQueryResultOrThrow(): ThumbedInlineQueryResult = + this as + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.ThumbedInlineQueryResult + +public inline fun + InlineQueryResult.ifThumbedInlineQueryResult(block: (ThumbedInlineQueryResult) -> T): T? = + thumbedInlineQueryResultOrNull() ?.let(block) + +public inline fun InlineQueryResult.thumbedWithMimeTypeInlineQueryResultOrNull(): + ThumbedWithMimeTypeInlineQueryResult? = this as? + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.ThumbedWithMimeTypeInlineQueryResult + +public inline fun InlineQueryResult.thumbedWithMimeTypeInlineQueryResultOrThrow(): + ThumbedWithMimeTypeInlineQueryResult = this as + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.ThumbedWithMimeTypeInlineQueryResult + +public inline fun + InlineQueryResult.ifThumbedWithMimeTypeInlineQueryResult(block: (ThumbedWithMimeTypeInlineQueryResult) -> T): + T? = thumbedWithMimeTypeInlineQueryResultOrNull() ?.let(block) + +public inline fun InlineQueryResult.titledInlineQueryResultOrNull(): TitledInlineQueryResult? = this + as? dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.TitledInlineQueryResult + +public inline fun InlineQueryResult.titledInlineQueryResultOrThrow(): TitledInlineQueryResult = this + as dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.TitledInlineQueryResult + +public inline fun + InlineQueryResult.ifTitledInlineQueryResult(block: (TitledInlineQueryResult) -> T): T? = + titledInlineQueryResultOrNull() ?.let(block) + +public inline fun InlineQueryResult.urlInlineQueryResultOrNull(): UrlInlineQueryResult? = this as? + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.UrlInlineQueryResult + +public inline fun InlineQueryResult.urlInlineQueryResultOrThrow(): UrlInlineQueryResult = this as + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.UrlInlineQueryResult + +public inline fun InlineQueryResult.ifUrlInlineQueryResult(block: (UrlInlineQueryResult) -> T): + T? = urlInlineQueryResultOrNull() ?.let(block) + +public inline fun InlineQueryResult.withInputMessageContentInlineQueryResultOrNull(): + WithInputMessageContentInlineQueryResult? = this as? + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.WithInputMessageContentInlineQueryResult + +public inline fun InlineQueryResult.withInputMessageContentInlineQueryResultOrThrow(): + WithInputMessageContentInlineQueryResult = this as + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.WithInputMessageContentInlineQueryResult + +public inline fun + InlineQueryResult.ifWithInputMessageContentInlineQueryResult(block: (WithInputMessageContentInlineQueryResult) -> T): + T? = withInputMessageContentInlineQueryResultOrNull() ?.let(block) + +public inline fun InlineQueryResult.inlineQueryResultAudioOrNull(): InlineQueryResultAudio? = this + as? + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.audio.InlineQueryResultAudio + +public inline fun InlineQueryResult.inlineQueryResultAudioOrThrow(): InlineQueryResultAudio = this + as + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.audio.InlineQueryResultAudio + +public inline fun + InlineQueryResult.ifInlineQueryResultAudio(block: (InlineQueryResultAudio) -> T): T? = + inlineQueryResultAudioOrNull() ?.let(block) + +public inline fun InlineQueryResult.inlineQueryResultAudioCachedOrNull(): + InlineQueryResultAudioCached? = this as? + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.audio.InlineQueryResultAudioCached + +public inline fun InlineQueryResult.inlineQueryResultAudioCachedOrThrow(): + InlineQueryResultAudioCached = this as + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.audio.InlineQueryResultAudioCached + +public inline fun + InlineQueryResult.ifInlineQueryResultAudioCached(block: (InlineQueryResultAudioCached) -> T): T? + = inlineQueryResultAudioCachedOrNull() ?.let(block) + +public inline fun InlineQueryResult.inlineQueryResultAudioCommonOrNull(): + InlineQueryResultAudioCommon? = this as? + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.audio.InlineQueryResultAudioCommon + +public inline fun InlineQueryResult.inlineQueryResultAudioCommonOrThrow(): + InlineQueryResultAudioCommon = this as + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.audio.InlineQueryResultAudioCommon + +public inline fun + InlineQueryResult.ifInlineQueryResultAudioCommon(block: (InlineQueryResultAudioCommon) -> T): T? + = inlineQueryResultAudioCommonOrNull() ?.let(block) + +public inline fun InlineQueryResult.inlineQueryResultDocumentOrNull(): InlineQueryResultDocument? = + this as? + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.document.InlineQueryResultDocument + +public inline fun InlineQueryResult.inlineQueryResultDocumentOrThrow(): InlineQueryResultDocument = + this as + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.document.InlineQueryResultDocument + +public inline fun + InlineQueryResult.ifInlineQueryResultDocument(block: (InlineQueryResultDocument) -> T): T? = + inlineQueryResultDocumentOrNull() ?.let(block) + +public inline fun InlineQueryResult.inlineQueryResultDocumentCachedOrNull(): + InlineQueryResultDocumentCached? = this as? + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.document.InlineQueryResultDocumentCached + +public inline fun InlineQueryResult.inlineQueryResultDocumentCachedOrThrow(): + InlineQueryResultDocumentCached = this as + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.document.InlineQueryResultDocumentCached + +public inline fun + InlineQueryResult.ifInlineQueryResultDocumentCached(block: (InlineQueryResultDocumentCached) -> T): + T? = inlineQueryResultDocumentCachedOrNull() ?.let(block) + +public inline fun InlineQueryResult.inlineQueryResultDocumentCommonOrNull(): + InlineQueryResultDocumentCommon? = this as? + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.document.InlineQueryResultDocumentCommon + +public inline fun InlineQueryResult.inlineQueryResultDocumentCommonOrThrow(): + InlineQueryResultDocumentCommon = this as + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.document.InlineQueryResultDocumentCommon + +public inline fun + InlineQueryResult.ifInlineQueryResultDocumentCommon(block: (InlineQueryResultDocumentCommon) -> T): + T? = inlineQueryResultDocumentCommonOrNull() ?.let(block) + +public inline fun InlineQueryResult.inlineQueryResultGifOrNull(): InlineQueryResultGif? = this as? + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.gif.InlineQueryResultGif + +public inline fun InlineQueryResult.inlineQueryResultGifOrThrow(): InlineQueryResultGif = this as + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.gif.InlineQueryResultGif + +public inline fun InlineQueryResult.ifInlineQueryResultGif(block: (InlineQueryResultGif) -> T): + T? = inlineQueryResultGifOrNull() ?.let(block) + +public inline fun InlineQueryResult.inlineQueryResultGifCachedOrNull(): InlineQueryResultGifCached? + = this as? + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.gif.InlineQueryResultGifCached + +public inline fun InlineQueryResult.inlineQueryResultGifCachedOrThrow(): InlineQueryResultGifCached + = this as + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.gif.InlineQueryResultGifCached + +public inline fun + InlineQueryResult.ifInlineQueryResultGifCached(block: (InlineQueryResultGifCached) -> T): T? = + inlineQueryResultGifCachedOrNull() ?.let(block) + +public inline fun InlineQueryResult.inlineQueryResultGifCommonOrNull(): InlineQueryResultGifCommon? + = this as? + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.gif.InlineQueryResultGifCommon + +public inline fun InlineQueryResult.inlineQueryResultGifCommonOrThrow(): InlineQueryResultGifCommon + = this as + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.gif.InlineQueryResultGifCommon + +public inline fun + InlineQueryResult.ifInlineQueryResultGifCommon(block: (InlineQueryResultGifCommon) -> T): T? = + inlineQueryResultGifCommonOrNull() ?.let(block) + +public inline fun InlineQueryResult.inlineQueryResultMpeg4GifOrNull(): InlineQueryResultMpeg4Gif? = + this as? + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.mpeg4gif.InlineQueryResultMpeg4Gif + +public inline fun InlineQueryResult.inlineQueryResultMpeg4GifOrThrow(): InlineQueryResultMpeg4Gif = + this as + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.mpeg4gif.InlineQueryResultMpeg4Gif + +public inline fun + InlineQueryResult.ifInlineQueryResultMpeg4Gif(block: (InlineQueryResultMpeg4Gif) -> T): T? = + inlineQueryResultMpeg4GifOrNull() ?.let(block) + +public inline fun InlineQueryResult.inlineQueryResultMpeg4GifCachedOrNull(): + InlineQueryResultMpeg4GifCached? = this as? + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.mpeg4gif.InlineQueryResultMpeg4GifCached + +public inline fun InlineQueryResult.inlineQueryResultMpeg4GifCachedOrThrow(): + InlineQueryResultMpeg4GifCached = this as + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.mpeg4gif.InlineQueryResultMpeg4GifCached + +public inline fun + InlineQueryResult.ifInlineQueryResultMpeg4GifCached(block: (InlineQueryResultMpeg4GifCached) -> T): + T? = inlineQueryResultMpeg4GifCachedOrNull() ?.let(block) + +public inline fun InlineQueryResult.inlineQueryResultMpeg4GifCommonOrNull(): + InlineQueryResultMpeg4GifCommon? = this as? + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.mpeg4gif.InlineQueryResultMpeg4GifCommon + +public inline fun InlineQueryResult.inlineQueryResultMpeg4GifCommonOrThrow(): + InlineQueryResultMpeg4GifCommon = this as + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.mpeg4gif.InlineQueryResultMpeg4GifCommon + +public inline fun + InlineQueryResult.ifInlineQueryResultMpeg4GifCommon(block: (InlineQueryResultMpeg4GifCommon) -> T): + T? = inlineQueryResultMpeg4GifCommonOrNull() ?.let(block) + +public inline fun InlineQueryResult.inlineQueryResultPhotoOrNull(): InlineQueryResultPhoto? = this + as? + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.photo.InlineQueryResultPhoto + +public inline fun InlineQueryResult.inlineQueryResultPhotoOrThrow(): InlineQueryResultPhoto = this + as + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.photo.InlineQueryResultPhoto + +public inline fun + InlineQueryResult.ifInlineQueryResultPhoto(block: (InlineQueryResultPhoto) -> T): T? = + inlineQueryResultPhotoOrNull() ?.let(block) + +public inline fun InlineQueryResult.inlineQueryResultPhotoCachedOrNull(): + InlineQueryResultPhotoCached? = this as? + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.photo.InlineQueryResultPhotoCached + +public inline fun InlineQueryResult.inlineQueryResultPhotoCachedOrThrow(): + InlineQueryResultPhotoCached = this as + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.photo.InlineQueryResultPhotoCached + +public inline fun + InlineQueryResult.ifInlineQueryResultPhotoCached(block: (InlineQueryResultPhotoCached) -> T): T? + = inlineQueryResultPhotoCachedOrNull() ?.let(block) + +public inline fun InlineQueryResult.inlineQueryResultPhotoCommonOrNull(): + InlineQueryResultPhotoCommon? = this as? + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.photo.InlineQueryResultPhotoCommon + +public inline fun InlineQueryResult.inlineQueryResultPhotoCommonOrThrow(): + InlineQueryResultPhotoCommon = this as + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.photo.InlineQueryResultPhotoCommon + +public inline fun + InlineQueryResult.ifInlineQueryResultPhotoCommon(block: (InlineQueryResultPhotoCommon) -> T): T? + = inlineQueryResultPhotoCommonOrNull() ?.let(block) + +public inline fun InlineQueryResult.inlineQueryResultVideoOrNull(): InlineQueryResultVideo? = this + as? + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.video.InlineQueryResultVideo + +public inline fun InlineQueryResult.inlineQueryResultVideoOrThrow(): InlineQueryResultVideo = this + as + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.video.InlineQueryResultVideo + +public inline fun + InlineQueryResult.ifInlineQueryResultVideo(block: (InlineQueryResultVideo) -> T): T? = + inlineQueryResultVideoOrNull() ?.let(block) + +public inline fun InlineQueryResult.inlineQueryResultVideoCachedOrNull(): + InlineQueryResultVideoCached? = this as? + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.video.InlineQueryResultVideoCached + +public inline fun InlineQueryResult.inlineQueryResultVideoCachedOrThrow(): + InlineQueryResultVideoCached = this as + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.video.InlineQueryResultVideoCached + +public inline fun + InlineQueryResult.ifInlineQueryResultVideoCached(block: (InlineQueryResultVideoCached) -> T): T? + = inlineQueryResultVideoCachedOrNull() ?.let(block) + +public inline fun InlineQueryResult.inlineQueryResultVideoCommonOrNull(): + InlineQueryResultVideoCommon? = this as? + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.video.InlineQueryResultVideoCommon + +public inline fun InlineQueryResult.inlineQueryResultVideoCommonOrThrow(): + InlineQueryResultVideoCommon = this as + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.video.InlineQueryResultVideoCommon + +public inline fun + InlineQueryResult.ifInlineQueryResultVideoCommon(block: (InlineQueryResultVideoCommon) -> T): T? + = inlineQueryResultVideoCommonOrNull() ?.let(block) + +public inline fun InlineQueryResult.inlineQueryResultVoiceOrNull(): InlineQueryResultVoice? = this + as? + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.voice.InlineQueryResultVoice + +public inline fun InlineQueryResult.inlineQueryResultVoiceOrThrow(): InlineQueryResultVoice = this + as + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.voice.InlineQueryResultVoice + +public inline fun + InlineQueryResult.ifInlineQueryResultVoice(block: (InlineQueryResultVoice) -> T): T? = + inlineQueryResultVoiceOrNull() ?.let(block) + +public inline fun InlineQueryResult.inlineQueryResultVoiceCachedOrNull(): + InlineQueryResultVoiceCached? = this as? + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.voice.InlineQueryResultVoiceCached + +public inline fun InlineQueryResult.inlineQueryResultVoiceCachedOrThrow(): + InlineQueryResultVoiceCached = this as + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.voice.InlineQueryResultVoiceCached + +public inline fun + InlineQueryResult.ifInlineQueryResultVoiceCached(block: (InlineQueryResultVoiceCached) -> T): T? + = inlineQueryResultVoiceCachedOrNull() ?.let(block) + +public inline fun InlineQueryResult.inlineQueryResultVoiceCommonOrNull(): + InlineQueryResultVoiceCommon? = this as? + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.voice.InlineQueryResultVoiceCommon + +public inline fun InlineQueryResult.inlineQueryResultVoiceCommonOrThrow(): + InlineQueryResultVoiceCommon = this as + dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.voice.InlineQueryResultVoiceCommon + +public inline fun + InlineQueryResult.ifInlineQueryResultVoiceCommon(block: (InlineQueryResultVoiceCommon) -> T): T? + = inlineQueryResultVoiceCommonOrNull() ?.let(block) + public inline fun InputMessageContent.inputContactMessageContentOrNull(): InputContactMessageContent? = this as? dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputContactMessageContent @@ -383,6 +1495,96 @@ public inline fun InputMessageContent.ifInputVenueMessageContent(block: (InputVenueMessageContent) -> T): T? = inputVenueMessageContentOrNull() ?.let(block) +public inline fun BotAction.typingActionOrNull(): TypingAction? = this as? + dev.inmo.tgbotapi.types.actions.TypingAction + +public inline fun BotAction.typingActionOrThrow(): TypingAction = this as + dev.inmo.tgbotapi.types.actions.TypingAction + +public inline fun BotAction.ifTypingAction(block: (TypingAction) -> T): T? = + typingActionOrNull() ?.let(block) + +public inline fun BotAction.uploadPhotoActionOrNull(): UploadPhotoAction? = this as? + dev.inmo.tgbotapi.types.actions.UploadPhotoAction + +public inline fun BotAction.uploadPhotoActionOrThrow(): UploadPhotoAction = this as + dev.inmo.tgbotapi.types.actions.UploadPhotoAction + +public inline fun BotAction.ifUploadPhotoAction(block: (UploadPhotoAction) -> T): T? = + uploadPhotoActionOrNull() ?.let(block) + +public inline fun BotAction.recordVideoActionOrNull(): RecordVideoAction? = this as? + dev.inmo.tgbotapi.types.actions.RecordVideoAction + +public inline fun BotAction.recordVideoActionOrThrow(): RecordVideoAction = this as + dev.inmo.tgbotapi.types.actions.RecordVideoAction + +public inline fun BotAction.ifRecordVideoAction(block: (RecordVideoAction) -> T): T? = + recordVideoActionOrNull() ?.let(block) + +public inline fun BotAction.uploadVideoActionOrNull(): UploadVideoAction? = this as? + dev.inmo.tgbotapi.types.actions.UploadVideoAction + +public inline fun BotAction.uploadVideoActionOrThrow(): UploadVideoAction = this as + dev.inmo.tgbotapi.types.actions.UploadVideoAction + +public inline fun BotAction.ifUploadVideoAction(block: (UploadVideoAction) -> T): T? = + uploadVideoActionOrNull() ?.let(block) + +public inline fun BotAction.recordVoiceActionOrNull(): RecordVoiceAction? = this as? + dev.inmo.tgbotapi.types.actions.RecordVoiceAction + +public inline fun BotAction.recordVoiceActionOrThrow(): RecordVoiceAction = this as + dev.inmo.tgbotapi.types.actions.RecordVoiceAction + +public inline fun BotAction.ifRecordVoiceAction(block: (RecordVoiceAction) -> T): T? = + recordVoiceActionOrNull() ?.let(block) + +public inline fun BotAction.uploadVoiceActionOrNull(): UploadVoiceAction? = this as? + dev.inmo.tgbotapi.types.actions.UploadVoiceAction + +public inline fun BotAction.uploadVoiceActionOrThrow(): UploadVoiceAction = this as + dev.inmo.tgbotapi.types.actions.UploadVoiceAction + +public inline fun BotAction.ifUploadVoiceAction(block: (UploadVoiceAction) -> T): T? = + uploadVoiceActionOrNull() ?.let(block) + +public inline fun BotAction.uploadDocumentActionOrNull(): UploadDocumentAction? = this as? + dev.inmo.tgbotapi.types.actions.UploadDocumentAction + +public inline fun BotAction.uploadDocumentActionOrThrow(): UploadDocumentAction = this as + dev.inmo.tgbotapi.types.actions.UploadDocumentAction + +public inline fun BotAction.ifUploadDocumentAction(block: (UploadDocumentAction) -> T): T? = + uploadDocumentActionOrNull() ?.let(block) + +public inline fun BotAction.findLocationActionOrNull(): FindLocationAction? = this as? + dev.inmo.tgbotapi.types.actions.FindLocationAction + +public inline fun BotAction.findLocationActionOrThrow(): FindLocationAction = this as + dev.inmo.tgbotapi.types.actions.FindLocationAction + +public inline fun BotAction.ifFindLocationAction(block: (FindLocationAction) -> T): T? = + findLocationActionOrNull() ?.let(block) + +public inline fun BotAction.recordVideoNoteActionOrNull(): RecordVideoNoteAction? = this as? + dev.inmo.tgbotapi.types.actions.RecordVideoNoteAction + +public inline fun BotAction.recordVideoNoteActionOrThrow(): RecordVideoNoteAction = this as + dev.inmo.tgbotapi.types.actions.RecordVideoNoteAction + +public inline fun BotAction.ifRecordVideoNoteAction(block: (RecordVideoNoteAction) -> T): T? = + recordVideoNoteActionOrNull() ?.let(block) + +public inline fun BotAction.uploadVideoNoteActionOrNull(): UploadVideoNoteAction? = this as? + dev.inmo.tgbotapi.types.actions.UploadVideoNoteAction + +public inline fun BotAction.uploadVideoNoteActionOrThrow(): UploadVideoNoteAction = this as + dev.inmo.tgbotapi.types.actions.UploadVideoNoteAction + +public inline fun BotAction.ifUploadVideoNoteAction(block: (UploadVideoNoteAction) -> T): T? = + uploadVideoNoteActionOrNull() ?.let(block) + public inline fun BotAction.chooseStickerActionOrNull(): ChooseStickerAction? = this as? dev.inmo.tgbotapi.types.actions.ChooseStickerAction @@ -401,95 +1603,27 @@ public inline fun BotAction.customBotActionOrThrow(): CustomBotAction = this as public inline fun BotAction.ifCustomBotAction(block: (CustomBotAction) -> T): T? = customBotActionOrNull() ?.let(block) -public inline fun BotAction.findLocationActionOrNull(): FindLocationAction? = this as? - dev.inmo.tgbotapi.types.actions.FindLocationAction +public inline fun InlineKeyboardButton.unknownInlineKeyboardButtonOrNull(): + UnknownInlineKeyboardButton? = this as? + dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.UnknownInlineKeyboardButton -public inline fun BotAction.findLocationActionOrThrow(): FindLocationAction = this as - dev.inmo.tgbotapi.types.actions.FindLocationAction +public inline fun InlineKeyboardButton.unknownInlineKeyboardButtonOrThrow(): + UnknownInlineKeyboardButton = this as + dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.UnknownInlineKeyboardButton -public inline fun BotAction.ifFindLocationAction(block: (FindLocationAction) -> T): T? = - findLocationActionOrNull() ?.let(block) +public inline fun + InlineKeyboardButton.ifUnknownInlineKeyboardButton(block: (UnknownInlineKeyboardButton) -> T): + T? = unknownInlineKeyboardButtonOrNull() ?.let(block) -public inline fun BotAction.recordVideoActionOrNull(): RecordVideoAction? = this as? - dev.inmo.tgbotapi.types.actions.RecordVideoAction +public inline fun InlineKeyboardButton.payInlineKeyboardButtonOrNull(): PayInlineKeyboardButton? = + this as? dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.PayInlineKeyboardButton -public inline fun BotAction.recordVideoActionOrThrow(): RecordVideoAction = this as - dev.inmo.tgbotapi.types.actions.RecordVideoAction +public inline fun InlineKeyboardButton.payInlineKeyboardButtonOrThrow(): PayInlineKeyboardButton = + this as dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.PayInlineKeyboardButton -public inline fun BotAction.ifRecordVideoAction(block: (RecordVideoAction) -> T): T? = - recordVideoActionOrNull() ?.let(block) - -public inline fun BotAction.recordVideoNoteActionOrNull(): RecordVideoNoteAction? = this as? - dev.inmo.tgbotapi.types.actions.RecordVideoNoteAction - -public inline fun BotAction.recordVideoNoteActionOrThrow(): RecordVideoNoteAction = this as - dev.inmo.tgbotapi.types.actions.RecordVideoNoteAction - -public inline fun BotAction.ifRecordVideoNoteAction(block: (RecordVideoNoteAction) -> T): T? = - recordVideoNoteActionOrNull() ?.let(block) - -public inline fun BotAction.recordVoiceActionOrNull(): RecordVoiceAction? = this as? - dev.inmo.tgbotapi.types.actions.RecordVoiceAction - -public inline fun BotAction.recordVoiceActionOrThrow(): RecordVoiceAction = this as - dev.inmo.tgbotapi.types.actions.RecordVoiceAction - -public inline fun BotAction.ifRecordVoiceAction(block: (RecordVoiceAction) -> T): T? = - recordVoiceActionOrNull() ?.let(block) - -public inline fun BotAction.typingActionOrNull(): TypingAction? = this as? - dev.inmo.tgbotapi.types.actions.TypingAction - -public inline fun BotAction.typingActionOrThrow(): TypingAction = this as - dev.inmo.tgbotapi.types.actions.TypingAction - -public inline fun BotAction.ifTypingAction(block: (TypingAction) -> T): T? = - typingActionOrNull() ?.let(block) - -public inline fun BotAction.uploadDocumentActionOrNull(): UploadDocumentAction? = this as? - dev.inmo.tgbotapi.types.actions.UploadDocumentAction - -public inline fun BotAction.uploadDocumentActionOrThrow(): UploadDocumentAction = this as - dev.inmo.tgbotapi.types.actions.UploadDocumentAction - -public inline fun BotAction.ifUploadDocumentAction(block: (UploadDocumentAction) -> T): T? = - uploadDocumentActionOrNull() ?.let(block) - -public inline fun BotAction.uploadPhotoActionOrNull(): UploadPhotoAction? = this as? - dev.inmo.tgbotapi.types.actions.UploadPhotoAction - -public inline fun BotAction.uploadPhotoActionOrThrow(): UploadPhotoAction = this as - dev.inmo.tgbotapi.types.actions.UploadPhotoAction - -public inline fun BotAction.ifUploadPhotoAction(block: (UploadPhotoAction) -> T): T? = - uploadPhotoActionOrNull() ?.let(block) - -public inline fun BotAction.uploadVideoActionOrNull(): UploadVideoAction? = this as? - dev.inmo.tgbotapi.types.actions.UploadVideoAction - -public inline fun BotAction.uploadVideoActionOrThrow(): UploadVideoAction = this as - dev.inmo.tgbotapi.types.actions.UploadVideoAction - -public inline fun BotAction.ifUploadVideoAction(block: (UploadVideoAction) -> T): T? = - uploadVideoActionOrNull() ?.let(block) - -public inline fun BotAction.uploadVideoNoteActionOrNull(): UploadVideoNoteAction? = this as? - dev.inmo.tgbotapi.types.actions.UploadVideoNoteAction - -public inline fun BotAction.uploadVideoNoteActionOrThrow(): UploadVideoNoteAction = this as - dev.inmo.tgbotapi.types.actions.UploadVideoNoteAction - -public inline fun BotAction.ifUploadVideoNoteAction(block: (UploadVideoNoteAction) -> T): T? = - uploadVideoNoteActionOrNull() ?.let(block) - -public inline fun BotAction.uploadVoiceActionOrNull(): UploadVoiceAction? = this as? - dev.inmo.tgbotapi.types.actions.UploadVoiceAction - -public inline fun BotAction.uploadVoiceActionOrThrow(): UploadVoiceAction = this as - dev.inmo.tgbotapi.types.actions.UploadVoiceAction - -public inline fun BotAction.ifUploadVoiceAction(block: (UploadVoiceAction) -> T): T? = - uploadVoiceActionOrNull() ?.let(block) +public inline fun + InlineKeyboardButton.ifPayInlineKeyboardButton(block: (PayInlineKeyboardButton) -> T): T? = + payInlineKeyboardButtonOrNull() ?.let(block) public inline fun InlineKeyboardButton.callbackDataInlineKeyboardButtonOrNull(): CallbackDataInlineKeyboardButton? = this as? @@ -527,15 +1661,17 @@ public inline fun InlineKeyboardButton.ifLoginURLInlineKeyboardButton(block: (LoginURLInlineKeyboardButton) -> T): T? = loginURLInlineKeyboardButtonOrNull() ?.let(block) -public inline fun InlineKeyboardButton.payInlineKeyboardButtonOrNull(): PayInlineKeyboardButton? = - this as? dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.PayInlineKeyboardButton +public inline fun InlineKeyboardButton.switchInlineQueryCurrentChatInlineKeyboardButtonOrNull(): + SwitchInlineQueryCurrentChatInlineKeyboardButton? = this as? + dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.SwitchInlineQueryCurrentChatInlineKeyboardButton -public inline fun InlineKeyboardButton.payInlineKeyboardButtonOrThrow(): PayInlineKeyboardButton = - this as dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.PayInlineKeyboardButton +public inline fun InlineKeyboardButton.switchInlineQueryCurrentChatInlineKeyboardButtonOrThrow(): + SwitchInlineQueryCurrentChatInlineKeyboardButton = this as + dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.SwitchInlineQueryCurrentChatInlineKeyboardButton public inline fun - InlineKeyboardButton.ifPayInlineKeyboardButton(block: (PayInlineKeyboardButton) -> T): T? = - payInlineKeyboardButtonOrNull() ?.let(block) + InlineKeyboardButton.ifSwitchInlineQueryCurrentChatInlineKeyboardButton(block: (SwitchInlineQueryCurrentChatInlineKeyboardButton) -> T): + T? = switchInlineQueryCurrentChatInlineKeyboardButtonOrNull() ?.let(block) public inline fun InlineKeyboardButton.switchInlineQueryChosenChatInlineKeyboardButtonOrNull(): SwitchInlineQueryChosenChatInlineKeyboardButton? = this as? @@ -549,18 +1685,6 @@ public inline fun InlineKeyboardButton.ifSwitchInlineQueryChosenChatInlineKeyboardButton(block: (SwitchInlineQueryChosenChatInlineKeyboardButton) -> T): T? = switchInlineQueryChosenChatInlineKeyboardButtonOrNull() ?.let(block) -public inline fun InlineKeyboardButton.switchInlineQueryCurrentChatInlineKeyboardButtonOrNull(): - SwitchInlineQueryCurrentChatInlineKeyboardButton? = this as? - dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.SwitchInlineQueryCurrentChatInlineKeyboardButton - -public inline fun InlineKeyboardButton.switchInlineQueryCurrentChatInlineKeyboardButtonOrThrow(): - SwitchInlineQueryCurrentChatInlineKeyboardButton = this as - dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.SwitchInlineQueryCurrentChatInlineKeyboardButton - -public inline fun - InlineKeyboardButton.ifSwitchInlineQueryCurrentChatInlineKeyboardButton(block: (SwitchInlineQueryCurrentChatInlineKeyboardButton) -> T): - T? = switchInlineQueryCurrentChatInlineKeyboardButtonOrNull() ?.let(block) - public inline fun InlineKeyboardButton.switchInlineQueryInlineKeyboardButtonOrNull(): SwitchInlineQueryInlineKeyboardButton? = this as? dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.SwitchInlineQueryInlineKeyboardButton @@ -583,18 +1707,6 @@ public inline fun InlineKeyboardButton.ifURLInlineKeyboardButton(block: (URLInlineKeyboardButton) -> T): T? = uRLInlineKeyboardButtonOrNull() ?.let(block) -public inline fun InlineKeyboardButton.unknownInlineKeyboardButtonOrNull(): - UnknownInlineKeyboardButton? = this as? - dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.UnknownInlineKeyboardButton - -public inline fun InlineKeyboardButton.unknownInlineKeyboardButtonOrThrow(): - UnknownInlineKeyboardButton = this as - dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.UnknownInlineKeyboardButton - -public inline fun - InlineKeyboardButton.ifUnknownInlineKeyboardButton(block: (UnknownInlineKeyboardButton) -> T): - T? = unknownInlineKeyboardButtonOrNull() ?.let(block) - public inline fun InlineKeyboardButton.webAppInlineKeyboardButtonOrNull(): WebAppInlineKeyboardButton? = this as? dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.WebAppInlineKeyboardButton @@ -671,6 +1783,85 @@ public inline fun KeyboardMarkup.replyKeyboardRemoveOrThrow(): ReplyKeyboardRemo public inline fun KeyboardMarkup.ifReplyKeyboardRemove(block: (ReplyKeyboardRemove) -> T): T? = replyKeyboardRemoveOrNull() ?.let(block) +public inline fun Chat.usernameChatOrNull(): UsernameChat? = this as? + dev.inmo.tgbotapi.types.chat.UsernameChat + +public inline fun Chat.usernameChatOrThrow(): UsernameChat = this as + dev.inmo.tgbotapi.types.chat.UsernameChat + +public inline fun Chat.ifUsernameChat(block: (UsernameChat) -> T): T? = usernameChatOrNull() + ?.let(block) + +public inline fun Chat.privateChatOrNull(): PrivateChat? = this as? + dev.inmo.tgbotapi.types.chat.PrivateChat + +public inline fun Chat.privateChatOrThrow(): PrivateChat = this as + dev.inmo.tgbotapi.types.chat.PrivateChat + +public inline fun Chat.ifPrivateChat(block: (PrivateChat) -> T): T? = privateChatOrNull() + ?.let(block) + +public inline fun Chat.publicChatOrNull(): PublicChat? = this as? + dev.inmo.tgbotapi.types.chat.PublicChat + +public inline fun Chat.publicChatOrThrow(): PublicChat = this as + dev.inmo.tgbotapi.types.chat.PublicChat + +public inline fun Chat.ifPublicChat(block: (PublicChat) -> T): T? = publicChatOrNull() + ?.let(block) + +public inline fun Chat.superPublicChatOrNull(): SuperPublicChat? = this as? + dev.inmo.tgbotapi.types.chat.SuperPublicChat + +public inline fun Chat.superPublicChatOrThrow(): SuperPublicChat = this as + dev.inmo.tgbotapi.types.chat.SuperPublicChat + +public inline fun Chat.ifSuperPublicChat(block: (SuperPublicChat) -> T): T? = + superPublicChatOrNull() ?.let(block) + +public inline fun Chat.channelChatOrNull(): ChannelChat? = this as? + dev.inmo.tgbotapi.types.chat.ChannelChat + +public inline fun Chat.channelChatOrThrow(): ChannelChat = this as + dev.inmo.tgbotapi.types.chat.ChannelChat + +public inline fun Chat.ifChannelChat(block: (ChannelChat) -> T): T? = channelChatOrNull() + ?.let(block) + +public inline fun Chat.groupChatOrNull(): GroupChat? = this as? + dev.inmo.tgbotapi.types.chat.GroupChat + +public inline fun Chat.groupChatOrThrow(): GroupChat = this as + dev.inmo.tgbotapi.types.chat.GroupChat + +public inline fun Chat.ifGroupChat(block: (GroupChat) -> T): T? = groupChatOrNull() ?.let(block) + +public inline fun Chat.supergroupChatOrNull(): SupergroupChat? = this as? + dev.inmo.tgbotapi.types.chat.SupergroupChat + +public inline fun Chat.supergroupChatOrThrow(): SupergroupChat = this as + dev.inmo.tgbotapi.types.chat.SupergroupChat + +public inline fun Chat.ifSupergroupChat(block: (SupergroupChat) -> T): T? = + supergroupChatOrNull() ?.let(block) + +public inline fun Chat.forumChatOrNull(): ForumChat? = this as? + dev.inmo.tgbotapi.types.chat.ForumChat + +public inline fun Chat.forumChatOrThrow(): ForumChat = this as + dev.inmo.tgbotapi.types.chat.ForumChat + +public inline fun Chat.ifForumChat(block: (ForumChat) -> T): T? = forumChatOrNull() ?.let(block) + +public inline fun Chat.possiblyPremiumChatOrNull(): PossiblyPremiumChat? = this as? + dev.inmo.tgbotapi.types.chat.PossiblyPremiumChat + +public inline fun Chat.possiblyPremiumChatOrThrow(): PossiblyPremiumChat = this as + dev.inmo.tgbotapi.types.chat.PossiblyPremiumChat + +public inline fun Chat.ifPossiblyPremiumChat(block: (PossiblyPremiumChat) -> T): T? = + possiblyPremiumChatOrNull() ?.let(block) + public inline fun Chat.ableToAddInAttachmentMenuChatOrNull(): AbleToAddInAttachmentMenuChat? = this as? dev.inmo.tgbotapi.types.chat.AbleToAddInAttachmentMenuChat @@ -681,32 +1872,23 @@ public inline fun Chat.ifAbleToAddInAttachmentMenuChat(block: (AbleToAddInAttachmentMenuChat) -> T): T? = ableToAddInAttachmentMenuChatOrNull() ?.let(block) -public inline fun Chat.commonUserOrNull(): CommonUser? = this as? - dev.inmo.tgbotapi.types.chat.CommonUser +public inline fun Chat.extendedBotOrNull(): ExtendedBot? = this as? + dev.inmo.tgbotapi.types.chat.ExtendedBot -public inline fun Chat.commonUserOrThrow(): CommonUser = this as - dev.inmo.tgbotapi.types.chat.CommonUser +public inline fun Chat.extendedBotOrThrow(): ExtendedBot = this as + dev.inmo.tgbotapi.types.chat.ExtendedBot -public inline fun Chat.ifCommonUser(block: (CommonUser) -> T): T? = commonUserOrNull() +public inline fun Chat.ifExtendedBot(block: (ExtendedBot) -> T): T? = extendedBotOrNull() ?.let(block) -public inline fun Chat.extendedChatOrNull(): ExtendedChat? = this as? - dev.inmo.tgbotapi.types.chat.ExtendedChat +public inline fun Chat.unknownExtendedChatOrNull(): UnknownExtendedChat? = this as? + dev.inmo.tgbotapi.types.chat.UnknownExtendedChat -public inline fun Chat.extendedChatOrThrow(): ExtendedChat = this as - dev.inmo.tgbotapi.types.chat.ExtendedChat +public inline fun Chat.unknownExtendedChatOrThrow(): UnknownExtendedChat = this as + dev.inmo.tgbotapi.types.chat.UnknownExtendedChat -public inline fun Chat.ifExtendedChat(block: (ExtendedChat) -> T): T? = extendedChatOrNull() - ?.let(block) - -public inline fun Chat.extendedChatWithUsernameOrNull(): ExtendedChatWithUsername? = this as? - dev.inmo.tgbotapi.types.chat.ExtendedChatWithUsername - -public inline fun Chat.extendedChatWithUsernameOrThrow(): ExtendedChatWithUsername = this as - dev.inmo.tgbotapi.types.chat.ExtendedChatWithUsername - -public inline fun Chat.ifExtendedChatWithUsername(block: (ExtendedChatWithUsername) -> T): T? = - extendedChatWithUsernameOrNull() ?.let(block) +public inline fun Chat.ifUnknownExtendedChat(block: (UnknownExtendedChat) -> T): T? = + unknownExtendedChatOrNull() ?.let(block) public inline fun Chat.extendedChannelChatOrNull(): ExtendedChannelChat? = this as? dev.inmo.tgbotapi.types.chat.ExtendedChannelChat @@ -717,14 +1899,14 @@ public inline fun Chat.extendedChannelChatOrThrow(): ExtendedChannelChat = this public inline fun Chat.ifExtendedChannelChat(block: (ExtendedChannelChat) -> T): T? = extendedChannelChatOrNull() ?.let(block) -public inline fun Chat.extendedChannelChatImplOrNull(): ExtendedChannelChatImpl? = this as? - dev.inmo.tgbotapi.types.chat.ExtendedChannelChatImpl +public inline fun Chat.extendedGroupChatOrNull(): ExtendedGroupChat? = this as? + dev.inmo.tgbotapi.types.chat.ExtendedGroupChat -public inline fun Chat.extendedChannelChatImplOrThrow(): ExtendedChannelChatImpl = this as - dev.inmo.tgbotapi.types.chat.ExtendedChannelChatImpl +public inline fun Chat.extendedGroupChatOrThrow(): ExtendedGroupChat = this as + dev.inmo.tgbotapi.types.chat.ExtendedGroupChat -public inline fun Chat.ifExtendedChannelChatImpl(block: (ExtendedChannelChatImpl) -> T): T? = - extendedChannelChatImplOrNull() ?.let(block) +public inline fun Chat.ifExtendedGroupChat(block: (ExtendedGroupChat) -> T): T? = + extendedGroupChatOrNull() ?.let(block) public inline fun Chat.extendedPrivateChatOrNull(): ExtendedPrivateChat? = this as? dev.inmo.tgbotapi.types.chat.ExtendedPrivateChat @@ -735,14 +1917,14 @@ public inline fun Chat.extendedPrivateChatOrThrow(): ExtendedPrivateChat = this public inline fun Chat.ifExtendedPrivateChat(block: (ExtendedPrivateChat) -> T): T? = extendedPrivateChatOrNull() ?.let(block) -public inline fun Chat.extendedPrivateChatImplOrNull(): ExtendedPrivateChatImpl? = this as? - dev.inmo.tgbotapi.types.chat.ExtendedPrivateChatImpl +public inline fun Chat.extendedPublicChatOrNull(): ExtendedPublicChat? = this as? + dev.inmo.tgbotapi.types.chat.ExtendedPublicChat -public inline fun Chat.extendedPrivateChatImplOrThrow(): ExtendedPrivateChatImpl = this as - dev.inmo.tgbotapi.types.chat.ExtendedPrivateChatImpl +public inline fun Chat.extendedPublicChatOrThrow(): ExtendedPublicChat = this as + dev.inmo.tgbotapi.types.chat.ExtendedPublicChat -public inline fun Chat.ifExtendedPrivateChatImpl(block: (ExtendedPrivateChatImpl) -> T): T? = - extendedPrivateChatImplOrNull() ?.let(block) +public inline fun Chat.ifExtendedPublicChat(block: (ExtendedPublicChat) -> T): T? = + extendedPublicChatOrNull() ?.let(block) public inline fun Chat.extendedSupergroupChatOrNull(): ExtendedSupergroupChat? = this as? dev.inmo.tgbotapi.types.chat.ExtendedSupergroupChat @@ -762,86 +1944,23 @@ public inline fun Chat.extendedForumChatOrThrow(): ExtendedForumChat = this as public inline fun Chat.ifExtendedForumChat(block: (ExtendedForumChat) -> T): T? = extendedForumChatOrNull() ?.let(block) -public inline fun Chat.extendedForumChatImplOrNull(): ExtendedForumChatImpl? = this as? - dev.inmo.tgbotapi.types.chat.ExtendedForumChatImpl +public inline fun Chat.extendedChatOrNull(): ExtendedChat? = this as? + dev.inmo.tgbotapi.types.chat.ExtendedChat -public inline fun Chat.extendedForumChatImplOrThrow(): ExtendedForumChatImpl = this as - dev.inmo.tgbotapi.types.chat.ExtendedForumChatImpl +public inline fun Chat.extendedChatOrThrow(): ExtendedChat = this as + dev.inmo.tgbotapi.types.chat.ExtendedChat -public inline fun Chat.ifExtendedForumChatImpl(block: (ExtendedForumChatImpl) -> T): T? = - extendedForumChatImplOrNull() ?.let(block) - -public inline fun Chat.extendedSupergroupChatImplOrNull(): ExtendedSupergroupChatImpl? = this as? - dev.inmo.tgbotapi.types.chat.ExtendedSupergroupChatImpl - -public inline fun Chat.extendedSupergroupChatImplOrThrow(): ExtendedSupergroupChatImpl = this as - dev.inmo.tgbotapi.types.chat.ExtendedSupergroupChatImpl - -public inline fun Chat.ifExtendedSupergroupChatImpl(block: (ExtendedSupergroupChatImpl) -> T): - T? = extendedSupergroupChatImplOrNull() ?.let(block) - -public inline fun Chat.extendedPublicChatOrNull(): ExtendedPublicChat? = this as? - dev.inmo.tgbotapi.types.chat.ExtendedPublicChat - -public inline fun Chat.extendedPublicChatOrThrow(): ExtendedPublicChat = this as - dev.inmo.tgbotapi.types.chat.ExtendedPublicChat - -public inline fun Chat.ifExtendedPublicChat(block: (ExtendedPublicChat) -> T): T? = - extendedPublicChatOrNull() ?.let(block) - -public inline fun Chat.extendedGroupChatOrNull(): ExtendedGroupChat? = this as? - dev.inmo.tgbotapi.types.chat.ExtendedGroupChat - -public inline fun Chat.extendedGroupChatOrThrow(): ExtendedGroupChat = this as - dev.inmo.tgbotapi.types.chat.ExtendedGroupChat - -public inline fun Chat.ifExtendedGroupChat(block: (ExtendedGroupChat) -> T): T? = - extendedGroupChatOrNull() ?.let(block) - -public inline fun Chat.extendedGroupChatImplOrNull(): ExtendedGroupChatImpl? = this as? - dev.inmo.tgbotapi.types.chat.ExtendedGroupChatImpl - -public inline fun Chat.extendedGroupChatImplOrThrow(): ExtendedGroupChatImpl = this as - dev.inmo.tgbotapi.types.chat.ExtendedGroupChatImpl - -public inline fun Chat.ifExtendedGroupChatImpl(block: (ExtendedGroupChatImpl) -> T): T? = - extendedGroupChatImplOrNull() ?.let(block) - -public inline fun Chat.unknownExtendedChatOrNull(): UnknownExtendedChat? = this as? - dev.inmo.tgbotapi.types.chat.UnknownExtendedChat - -public inline fun Chat.unknownExtendedChatOrThrow(): UnknownExtendedChat = this as - dev.inmo.tgbotapi.types.chat.UnknownExtendedChat - -public inline fun Chat.ifUnknownExtendedChat(block: (UnknownExtendedChat) -> T): T? = - unknownExtendedChatOrNull() ?.let(block) - -public inline fun Chat.possiblyPremiumChatOrNull(): PossiblyPremiumChat? = this as? - dev.inmo.tgbotapi.types.chat.PossiblyPremiumChat - -public inline fun Chat.possiblyPremiumChatOrThrow(): PossiblyPremiumChat = this as - dev.inmo.tgbotapi.types.chat.PossiblyPremiumChat - -public inline fun Chat.ifPossiblyPremiumChat(block: (PossiblyPremiumChat) -> T): T? = - possiblyPremiumChatOrNull() ?.let(block) - -public inline fun Chat.privateChatOrNull(): PrivateChat? = this as? - dev.inmo.tgbotapi.types.chat.PrivateChat - -public inline fun Chat.privateChatOrThrow(): PrivateChat = this as - dev.inmo.tgbotapi.types.chat.PrivateChat - -public inline fun Chat.ifPrivateChat(block: (PrivateChat) -> T): T? = privateChatOrNull() +public inline fun Chat.ifExtendedChat(block: (ExtendedChat) -> T): T? = extendedChatOrNull() ?.let(block) -public inline fun Chat.privateChatImplOrNull(): PrivateChatImpl? = this as? - dev.inmo.tgbotapi.types.chat.PrivateChatImpl +public inline fun Chat.extendedChatWithUsernameOrNull(): ExtendedChatWithUsername? = this as? + dev.inmo.tgbotapi.types.chat.ExtendedChatWithUsername -public inline fun Chat.privateChatImplOrThrow(): PrivateChatImpl = this as - dev.inmo.tgbotapi.types.chat.PrivateChatImpl +public inline fun Chat.extendedChatWithUsernameOrThrow(): ExtendedChatWithUsername = this as + dev.inmo.tgbotapi.types.chat.ExtendedChatWithUsername -public inline fun Chat.ifPrivateChatImpl(block: (PrivateChatImpl) -> T): T? = - privateChatImplOrNull() ?.let(block) +public inline fun Chat.ifExtendedChatWithUsername(block: (ExtendedChatWithUsername) -> T): T? = + extendedChatWithUsernameOrNull() ?.let(block) public inline fun Chat.userOrNull(): User? = this as? dev.inmo.tgbotapi.types.chat.User @@ -863,103 +1982,15 @@ public inline fun Chat.commonBotOrThrow(): CommonBot = this as public inline fun Chat.ifCommonBot(block: (CommonBot) -> T): T? = commonBotOrNull() ?.let(block) -public inline fun Chat.extendedBotOrNull(): ExtendedBot? = this as? - dev.inmo.tgbotapi.types.chat.ExtendedBot +public inline fun Chat.commonUserOrNull(): CommonUser? = this as? + dev.inmo.tgbotapi.types.chat.CommonUser -public inline fun Chat.extendedBotOrThrow(): ExtendedBot = this as - dev.inmo.tgbotapi.types.chat.ExtendedBot +public inline fun Chat.commonUserOrThrow(): CommonUser = this as + dev.inmo.tgbotapi.types.chat.CommonUser -public inline fun Chat.ifExtendedBot(block: (ExtendedBot) -> T): T? = extendedBotOrNull() +public inline fun Chat.ifCommonUser(block: (CommonUser) -> T): T? = commonUserOrNull() ?.let(block) -public inline fun Chat.publicChatOrNull(): PublicChat? = this as? - dev.inmo.tgbotapi.types.chat.PublicChat - -public inline fun Chat.publicChatOrThrow(): PublicChat = this as - dev.inmo.tgbotapi.types.chat.PublicChat - -public inline fun Chat.ifPublicChat(block: (PublicChat) -> T): T? = publicChatOrNull() - ?.let(block) - -public inline fun Chat.groupChatOrNull(): GroupChat? = this as? - dev.inmo.tgbotapi.types.chat.GroupChat - -public inline fun Chat.groupChatOrThrow(): GroupChat = this as - dev.inmo.tgbotapi.types.chat.GroupChat - -public inline fun Chat.ifGroupChat(block: (GroupChat) -> T): T? = groupChatOrNull() ?.let(block) - -public inline fun Chat.groupChatImplOrNull(): GroupChatImpl? = this as? - dev.inmo.tgbotapi.types.chat.GroupChatImpl - -public inline fun Chat.groupChatImplOrThrow(): GroupChatImpl = this as - dev.inmo.tgbotapi.types.chat.GroupChatImpl - -public inline fun Chat.ifGroupChatImpl(block: (GroupChatImpl) -> T): T? = groupChatImplOrNull() - ?.let(block) - -public inline fun Chat.supergroupChatOrNull(): SupergroupChat? = this as? - dev.inmo.tgbotapi.types.chat.SupergroupChat - -public inline fun Chat.supergroupChatOrThrow(): SupergroupChat = this as - dev.inmo.tgbotapi.types.chat.SupergroupChat - -public inline fun Chat.ifSupergroupChat(block: (SupergroupChat) -> T): T? = - supergroupChatOrNull() ?.let(block) - -public inline fun Chat.forumChatOrNull(): ForumChat? = this as? - dev.inmo.tgbotapi.types.chat.ForumChat - -public inline fun Chat.forumChatOrThrow(): ForumChat = this as - dev.inmo.tgbotapi.types.chat.ForumChat - -public inline fun Chat.ifForumChat(block: (ForumChat) -> T): T? = forumChatOrNull() ?.let(block) - -public inline fun Chat.forumChatImplOrNull(): ForumChatImpl? = this as? - dev.inmo.tgbotapi.types.chat.ForumChatImpl - -public inline fun Chat.forumChatImplOrThrow(): ForumChatImpl = this as - dev.inmo.tgbotapi.types.chat.ForumChatImpl - -public inline fun Chat.ifForumChatImpl(block: (ForumChatImpl) -> T): T? = forumChatImplOrNull() - ?.let(block) - -public inline fun Chat.supergroupChatImplOrNull(): SupergroupChatImpl? = this as? - dev.inmo.tgbotapi.types.chat.SupergroupChatImpl - -public inline fun Chat.supergroupChatImplOrThrow(): SupergroupChatImpl = this as - dev.inmo.tgbotapi.types.chat.SupergroupChatImpl - -public inline fun Chat.ifSupergroupChatImpl(block: (SupergroupChatImpl) -> T): T? = - supergroupChatImplOrNull() ?.let(block) - -public inline fun Chat.superPublicChatOrNull(): SuperPublicChat? = this as? - dev.inmo.tgbotapi.types.chat.SuperPublicChat - -public inline fun Chat.superPublicChatOrThrow(): SuperPublicChat = this as - dev.inmo.tgbotapi.types.chat.SuperPublicChat - -public inline fun Chat.ifSuperPublicChat(block: (SuperPublicChat) -> T): T? = - superPublicChatOrNull() ?.let(block) - -public inline fun Chat.channelChatOrNull(): ChannelChat? = this as? - dev.inmo.tgbotapi.types.chat.ChannelChat - -public inline fun Chat.channelChatOrThrow(): ChannelChat = this as - dev.inmo.tgbotapi.types.chat.ChannelChat - -public inline fun Chat.ifChannelChat(block: (ChannelChat) -> T): T? = channelChatOrNull() - ?.let(block) - -public inline fun Chat.channelChatImplOrNull(): ChannelChatImpl? = this as? - dev.inmo.tgbotapi.types.chat.ChannelChatImpl - -public inline fun Chat.channelChatImplOrThrow(): ChannelChatImpl = this as - dev.inmo.tgbotapi.types.chat.ChannelChatImpl - -public inline fun Chat.ifChannelChatImpl(block: (ChannelChatImpl) -> T): T? = - channelChatImplOrNull() ?.let(block) - public inline fun Chat.unknownChatTypeOrNull(): UnknownChatType? = this as? dev.inmo.tgbotapi.types.chat.UnknownChatType @@ -969,35 +2000,6 @@ public inline fun Chat.unknownChatTypeOrThrow(): UnknownChatType = this as public inline fun Chat.ifUnknownChatType(block: (UnknownChatType) -> T): T? = unknownChatTypeOrNull() ?.let(block) -public inline fun Chat.usernameChatOrNull(): UsernameChat? = this as? - dev.inmo.tgbotapi.types.chat.UsernameChat - -public inline fun Chat.usernameChatOrThrow(): UsernameChat = this as - dev.inmo.tgbotapi.types.chat.UsernameChat - -public inline fun Chat.ifUsernameChat(block: (UsernameChat) -> T): T? = usernameChatOrNull() - ?.let(block) - -public inline fun DiceAnimationType.basketballDiceAnimationTypeOrNull(): - BasketballDiceAnimationType? = this as? dev.inmo.tgbotapi.types.dice.BasketballDiceAnimationType - -public inline fun DiceAnimationType.basketballDiceAnimationTypeOrThrow(): - BasketballDiceAnimationType = this as dev.inmo.tgbotapi.types.dice.BasketballDiceAnimationType - -public inline fun - DiceAnimationType.ifBasketballDiceAnimationType(block: (BasketballDiceAnimationType) -> T): T? = - basketballDiceAnimationTypeOrNull() ?.let(block) - -public inline fun DiceAnimationType.bowlingDiceAnimationTypeOrNull(): BowlingDiceAnimationType? = - this as? dev.inmo.tgbotapi.types.dice.BowlingDiceAnimationType - -public inline fun DiceAnimationType.bowlingDiceAnimationTypeOrThrow(): BowlingDiceAnimationType = - this as dev.inmo.tgbotapi.types.dice.BowlingDiceAnimationType - -public inline fun - DiceAnimationType.ifBowlingDiceAnimationType(block: (BowlingDiceAnimationType) -> T): T? = - bowlingDiceAnimationTypeOrNull() ?.let(block) - public inline fun DiceAnimationType.cubeDiceAnimationTypeOrNull(): CubeDiceAnimationType? = this as? dev.inmo.tgbotapi.types.dice.CubeDiceAnimationType @@ -1008,16 +2010,6 @@ public inline fun DiceAnimationType.ifCubeDiceAnimationType(block: (CubeDiceAnimationType) -> T): T? = cubeDiceAnimationTypeOrNull() ?.let(block) -public inline fun DiceAnimationType.customDiceAnimationTypeOrNull(): CustomDiceAnimationType? = this - as? dev.inmo.tgbotapi.types.dice.CustomDiceAnimationType - -public inline fun DiceAnimationType.customDiceAnimationTypeOrThrow(): CustomDiceAnimationType = this - as dev.inmo.tgbotapi.types.dice.CustomDiceAnimationType - -public inline fun - DiceAnimationType.ifCustomDiceAnimationType(block: (CustomDiceAnimationType) -> T): T? = - customDiceAnimationTypeOrNull() ?.let(block) - public inline fun DiceAnimationType.dartsDiceAnimationTypeOrNull(): DartsDiceAnimationType? = this as? dev.inmo.tgbotapi.types.dice.DartsDiceAnimationType @@ -1028,6 +2020,16 @@ public inline fun DiceAnimationType.ifDartsDiceAnimationType(block: (DartsDiceAnimationType) -> T): T? = dartsDiceAnimationTypeOrNull() ?.let(block) +public inline fun DiceAnimationType.basketballDiceAnimationTypeOrNull(): + BasketballDiceAnimationType? = this as? dev.inmo.tgbotapi.types.dice.BasketballDiceAnimationType + +public inline fun DiceAnimationType.basketballDiceAnimationTypeOrThrow(): + BasketballDiceAnimationType = this as dev.inmo.tgbotapi.types.dice.BasketballDiceAnimationType + +public inline fun + DiceAnimationType.ifBasketballDiceAnimationType(block: (BasketballDiceAnimationType) -> T): T? = + basketballDiceAnimationTypeOrNull() ?.let(block) + public inline fun DiceAnimationType.footballDiceAnimationTypeOrNull(): FootballDiceAnimationType? = this as? dev.inmo.tgbotapi.types.dice.FootballDiceAnimationType @@ -1038,6 +2040,16 @@ public inline fun DiceAnimationType.ifFootballDiceAnimationType(block: (FootballDiceAnimationType) -> T): T? = footballDiceAnimationTypeOrNull() ?.let(block) +public inline fun DiceAnimationType.bowlingDiceAnimationTypeOrNull(): BowlingDiceAnimationType? = + this as? dev.inmo.tgbotapi.types.dice.BowlingDiceAnimationType + +public inline fun DiceAnimationType.bowlingDiceAnimationTypeOrThrow(): BowlingDiceAnimationType = + this as dev.inmo.tgbotapi.types.dice.BowlingDiceAnimationType + +public inline fun + DiceAnimationType.ifBowlingDiceAnimationType(block: (BowlingDiceAnimationType) -> T): T? = + bowlingDiceAnimationTypeOrNull() ?.let(block) + public inline fun DiceAnimationType.slotMachineDiceAnimationTypeOrNull(): SlotMachineDiceAnimationType? = this as? dev.inmo.tgbotapi.types.dice.SlotMachineDiceAnimationType @@ -1049,6 +2061,16 @@ public inline fun DiceAnimationType.ifSlotMachineDiceAnimationType(block: (SlotMachineDiceAnimationType) -> T): T? = slotMachineDiceAnimationTypeOrNull() ?.let(block) +public inline fun DiceAnimationType.customDiceAnimationTypeOrNull(): CustomDiceAnimationType? = this + as? dev.inmo.tgbotapi.types.dice.CustomDiceAnimationType + +public inline fun DiceAnimationType.customDiceAnimationTypeOrThrow(): CustomDiceAnimationType = this + as dev.inmo.tgbotapi.types.dice.CustomDiceAnimationType + +public inline fun + DiceAnimationType.ifCustomDiceAnimationType(block: (CustomDiceAnimationType) -> T): T? = + customDiceAnimationTypeOrNull() ?.let(block) + public inline fun TelegramMediaFile.animationFileOrNull(): AnimationFile? = this as? dev.inmo.tgbotapi.types.files.AnimationFile @@ -1092,24 +2114,6 @@ public inline fun TelegramMediaFile.mimedMediaFileOrThrow(): MimedMediaFile = th public inline fun TelegramMediaFile.ifMimedMediaFile(block: (MimedMediaFile) -> T): T? = mimedMediaFileOrNull() ?.let(block) -public inline fun TelegramMediaFile.videoFileOrNull(): VideoFile? = this as? - dev.inmo.tgbotapi.types.files.VideoFile - -public inline fun TelegramMediaFile.videoFileOrThrow(): VideoFile = this as - dev.inmo.tgbotapi.types.files.VideoFile - -public inline fun TelegramMediaFile.ifVideoFile(block: (VideoFile) -> T): T? = videoFileOrNull() - ?.let(block) - -public inline fun TelegramMediaFile.voiceFileOrNull(): VoiceFile? = this as? - dev.inmo.tgbotapi.types.files.VoiceFile - -public inline fun TelegramMediaFile.voiceFileOrThrow(): VoiceFile = this as - dev.inmo.tgbotapi.types.files.VoiceFile - -public inline fun TelegramMediaFile.ifVoiceFile(block: (VoiceFile) -> T): T? = voiceFileOrNull() - ?.let(block) - public inline fun TelegramMediaFile.passportFileOrNull(): PassportFile? = this as? dev.inmo.tgbotapi.types.files.PassportFile @@ -1128,6 +2132,15 @@ public inline fun TelegramMediaFile.pathedFileOrThrow(): PathedFile = this as public inline fun TelegramMediaFile.ifPathedFile(block: (PathedFile) -> T): T? = pathedFileOrNull() ?.let(block) +public inline fun TelegramMediaFile.photoSizeOrNull(): PhotoSize? = this as? + dev.inmo.tgbotapi.types.files.PhotoSize + +public inline fun TelegramMediaFile.photoSizeOrThrow(): PhotoSize = this as + dev.inmo.tgbotapi.types.files.PhotoSize + +public inline fun TelegramMediaFile.ifPhotoSize(block: (PhotoSize) -> T): T? = photoSizeOrNull() + ?.let(block) + public inline fun TelegramMediaFile.playableMediaFileOrNull(): PlayableMediaFile? = this as? dev.inmo.tgbotapi.types.files.PlayableMediaFile @@ -1137,15 +2150,6 @@ public inline fun TelegramMediaFile.playableMediaFileOrThrow(): PlayableMediaFil public inline fun TelegramMediaFile.ifPlayableMediaFile(block: (PlayableMediaFile) -> T): T? = playableMediaFileOrNull() ?.let(block) -public inline fun TelegramMediaFile.videoNoteFileOrNull(): VideoNoteFile? = this as? - dev.inmo.tgbotapi.types.files.VideoNoteFile - -public inline fun TelegramMediaFile.videoNoteFileOrThrow(): VideoNoteFile = this as - dev.inmo.tgbotapi.types.files.VideoNoteFile - -public inline fun TelegramMediaFile.ifVideoNoteFile(block: (VideoNoteFile) -> T): T? = - videoNoteFileOrNull() ?.let(block) - public inline fun TelegramMediaFile.sizedMediaFileOrNull(): SizedMediaFile? = this as? dev.inmo.tgbotapi.types.files.SizedMediaFile @@ -1155,15 +2159,6 @@ public inline fun TelegramMediaFile.sizedMediaFileOrThrow(): SizedMediaFile = th public inline fun TelegramMediaFile.ifSizedMediaFile(block: (SizedMediaFile) -> T): T? = sizedMediaFileOrNull() ?.let(block) -public inline fun TelegramMediaFile.photoSizeOrNull(): PhotoSize? = this as? - dev.inmo.tgbotapi.types.files.PhotoSize - -public inline fun TelegramMediaFile.photoSizeOrThrow(): PhotoSize = this as - dev.inmo.tgbotapi.types.files.PhotoSize - -public inline fun TelegramMediaFile.ifPhotoSize(block: (PhotoSize) -> T): T? = photoSizeOrNull() - ?.let(block) - public inline fun TelegramMediaFile.stickerOrNull(): Sticker? = this as? dev.inmo.tgbotapi.types.files.Sticker @@ -1173,6 +2168,15 @@ public inline fun TelegramMediaFile.stickerOrThrow(): Sticker = this as public inline fun TelegramMediaFile.ifSticker(block: (Sticker) -> T): T? = stickerOrNull() ?.let(block) +public inline fun TelegramMediaFile.videoStickerOrNull(): VideoSticker? = this as? + dev.inmo.tgbotapi.types.files.VideoSticker + +public inline fun TelegramMediaFile.videoStickerOrThrow(): VideoSticker = this as + dev.inmo.tgbotapi.types.files.VideoSticker + +public inline fun TelegramMediaFile.ifVideoSticker(block: (VideoSticker) -> T): T? = + videoStickerOrNull() ?.let(block) + public inline fun TelegramMediaFile.animatedStickerOrNull(): AnimatedSticker? = this as? dev.inmo.tgbotapi.types.files.AnimatedSticker @@ -1182,24 +2186,23 @@ public inline fun TelegramMediaFile.animatedStickerOrThrow(): AnimatedSticker = public inline fun TelegramMediaFile.ifAnimatedSticker(block: (AnimatedSticker) -> T): T? = animatedStickerOrNull() ?.let(block) -public inline fun TelegramMediaFile.customEmojiAnimatedStickerOrNull(): CustomEmojiAnimatedSticker? - = this as? dev.inmo.tgbotapi.types.files.CustomEmojiAnimatedSticker +public inline fun TelegramMediaFile.regularStickerOrNull(): RegularSticker? = this as? + dev.inmo.tgbotapi.types.files.RegularSticker -public inline fun TelegramMediaFile.customEmojiAnimatedStickerOrThrow(): CustomEmojiAnimatedSticker - = this as dev.inmo.tgbotapi.types.files.CustomEmojiAnimatedSticker +public inline fun TelegramMediaFile.regularStickerOrThrow(): RegularSticker = this as + dev.inmo.tgbotapi.types.files.RegularSticker -public inline fun - TelegramMediaFile.ifCustomEmojiAnimatedSticker(block: (CustomEmojiAnimatedSticker) -> T): T? = - customEmojiAnimatedStickerOrNull() ?.let(block) +public inline fun TelegramMediaFile.ifRegularSticker(block: (RegularSticker) -> T): T? = + regularStickerOrNull() ?.let(block) -public inline fun TelegramMediaFile.maskAnimatedStickerOrNull(): MaskAnimatedSticker? = this as? - dev.inmo.tgbotapi.types.files.MaskAnimatedSticker +public inline fun TelegramMediaFile.regularSimpleStickerOrNull(): RegularSimpleSticker? = this as? + dev.inmo.tgbotapi.types.files.RegularSimpleSticker -public inline fun TelegramMediaFile.maskAnimatedStickerOrThrow(): MaskAnimatedSticker = this as - dev.inmo.tgbotapi.types.files.MaskAnimatedSticker +public inline fun TelegramMediaFile.regularSimpleStickerOrThrow(): RegularSimpleSticker = this as + dev.inmo.tgbotapi.types.files.RegularSimpleSticker -public inline fun TelegramMediaFile.ifMaskAnimatedSticker(block: (MaskAnimatedSticker) -> T): T? - = maskAnimatedStickerOrNull() ?.let(block) +public inline fun TelegramMediaFile.ifRegularSimpleSticker(block: (RegularSimpleSticker) -> T): + T? = regularSimpleStickerOrNull() ?.let(block) public inline fun TelegramMediaFile.regularAnimatedStickerOrNull(): RegularAnimatedSticker? = this as? dev.inmo.tgbotapi.types.files.RegularAnimatedSticker @@ -1211,6 +2214,51 @@ public inline fun TelegramMediaFile.ifRegularAnimatedSticker(block: (RegularAnimatedSticker) -> T): T? = regularAnimatedStickerOrNull() ?.let(block) +public inline fun TelegramMediaFile.regularVideoStickerOrNull(): RegularVideoSticker? = this as? + dev.inmo.tgbotapi.types.files.RegularVideoSticker + +public inline fun TelegramMediaFile.regularVideoStickerOrThrow(): RegularVideoSticker = this as + dev.inmo.tgbotapi.types.files.RegularVideoSticker + +public inline fun TelegramMediaFile.ifRegularVideoSticker(block: (RegularVideoSticker) -> T): T? + = regularVideoStickerOrNull() ?.let(block) + +public inline fun TelegramMediaFile.maskStickerOrNull(): MaskSticker? = this as? + dev.inmo.tgbotapi.types.files.MaskSticker + +public inline fun TelegramMediaFile.maskStickerOrThrow(): MaskSticker = this as + dev.inmo.tgbotapi.types.files.MaskSticker + +public inline fun TelegramMediaFile.ifMaskSticker(block: (MaskSticker) -> T): T? = + maskStickerOrNull() ?.let(block) + +public inline fun TelegramMediaFile.maskSimpleStickerOrNull(): MaskSimpleSticker? = this as? + dev.inmo.tgbotapi.types.files.MaskSimpleSticker + +public inline fun TelegramMediaFile.maskSimpleStickerOrThrow(): MaskSimpleSticker = this as + dev.inmo.tgbotapi.types.files.MaskSimpleSticker + +public inline fun TelegramMediaFile.ifMaskSimpleSticker(block: (MaskSimpleSticker) -> T): T? = + maskSimpleStickerOrNull() ?.let(block) + +public inline fun TelegramMediaFile.maskAnimatedStickerOrNull(): MaskAnimatedSticker? = this as? + dev.inmo.tgbotapi.types.files.MaskAnimatedSticker + +public inline fun TelegramMediaFile.maskAnimatedStickerOrThrow(): MaskAnimatedSticker = this as + dev.inmo.tgbotapi.types.files.MaskAnimatedSticker + +public inline fun TelegramMediaFile.ifMaskAnimatedSticker(block: (MaskAnimatedSticker) -> T): T? + = maskAnimatedStickerOrNull() ?.let(block) + +public inline fun TelegramMediaFile.maskVideoStickerOrNull(): MaskVideoSticker? = this as? + dev.inmo.tgbotapi.types.files.MaskVideoSticker + +public inline fun TelegramMediaFile.maskVideoStickerOrThrow(): MaskVideoSticker = this as + dev.inmo.tgbotapi.types.files.MaskVideoSticker + +public inline fun TelegramMediaFile.ifMaskVideoSticker(block: (MaskVideoSticker) -> T): T? = + maskVideoStickerOrNull() ?.let(block) + public inline fun TelegramMediaFile.customEmojiStickerOrNull(): CustomEmojiSticker? = this as? dev.inmo.tgbotapi.types.files.CustomEmojiSticker @@ -1230,6 +2278,16 @@ public inline fun TelegramMediaFile.ifCustomEmojiSimpleSticker(block: (CustomEmojiSimpleSticker) -> T): T? = customEmojiSimpleStickerOrNull() ?.let(block) +public inline fun TelegramMediaFile.customEmojiAnimatedStickerOrNull(): CustomEmojiAnimatedSticker? + = this as? dev.inmo.tgbotapi.types.files.CustomEmojiAnimatedSticker + +public inline fun TelegramMediaFile.customEmojiAnimatedStickerOrThrow(): CustomEmojiAnimatedSticker + = this as dev.inmo.tgbotapi.types.files.CustomEmojiAnimatedSticker + +public inline fun + TelegramMediaFile.ifCustomEmojiAnimatedSticker(block: (CustomEmojiAnimatedSticker) -> T): T? = + customEmojiAnimatedStickerOrNull() ?.let(block) + public inline fun TelegramMediaFile.customEmojiVideoStickerOrNull(): CustomEmojiVideoSticker? = this as? dev.inmo.tgbotapi.types.files.CustomEmojiVideoSticker @@ -1240,60 +2298,6 @@ public inline fun TelegramMediaFile.ifCustomEmojiVideoSticker(block: (CustomEmojiVideoSticker) -> T): T? = customEmojiVideoStickerOrNull() ?.let(block) -public inline fun TelegramMediaFile.maskStickerOrNull(): MaskSticker? = this as? - dev.inmo.tgbotapi.types.files.MaskSticker - -public inline fun TelegramMediaFile.maskStickerOrThrow(): MaskSticker = this as - dev.inmo.tgbotapi.types.files.MaskSticker - -public inline fun TelegramMediaFile.ifMaskSticker(block: (MaskSticker) -> T): T? = - maskStickerOrNull() ?.let(block) - -public inline fun TelegramMediaFile.maskSimpleStickerOrNull(): MaskSimpleSticker? = this as? - dev.inmo.tgbotapi.types.files.MaskSimpleSticker - -public inline fun TelegramMediaFile.maskSimpleStickerOrThrow(): MaskSimpleSticker = this as - dev.inmo.tgbotapi.types.files.MaskSimpleSticker - -public inline fun TelegramMediaFile.ifMaskSimpleSticker(block: (MaskSimpleSticker) -> T): T? = - maskSimpleStickerOrNull() ?.let(block) - -public inline fun TelegramMediaFile.maskVideoStickerOrNull(): MaskVideoSticker? = this as? - dev.inmo.tgbotapi.types.files.MaskVideoSticker - -public inline fun TelegramMediaFile.maskVideoStickerOrThrow(): MaskVideoSticker = this as - dev.inmo.tgbotapi.types.files.MaskVideoSticker - -public inline fun TelegramMediaFile.ifMaskVideoSticker(block: (MaskVideoSticker) -> T): T? = - maskVideoStickerOrNull() ?.let(block) - -public inline fun TelegramMediaFile.regularStickerOrNull(): RegularSticker? = this as? - dev.inmo.tgbotapi.types.files.RegularSticker - -public inline fun TelegramMediaFile.regularStickerOrThrow(): RegularSticker = this as - dev.inmo.tgbotapi.types.files.RegularSticker - -public inline fun TelegramMediaFile.ifRegularSticker(block: (RegularSticker) -> T): T? = - regularStickerOrNull() ?.let(block) - -public inline fun TelegramMediaFile.regularSimpleStickerOrNull(): RegularSimpleSticker? = this as? - dev.inmo.tgbotapi.types.files.RegularSimpleSticker - -public inline fun TelegramMediaFile.regularSimpleStickerOrThrow(): RegularSimpleSticker = this as - dev.inmo.tgbotapi.types.files.RegularSimpleSticker - -public inline fun TelegramMediaFile.ifRegularSimpleSticker(block: (RegularSimpleSticker) -> T): - T? = regularSimpleStickerOrNull() ?.let(block) - -public inline fun TelegramMediaFile.regularVideoStickerOrNull(): RegularVideoSticker? = this as? - dev.inmo.tgbotapi.types.files.RegularVideoSticker - -public inline fun TelegramMediaFile.regularVideoStickerOrThrow(): RegularVideoSticker = this as - dev.inmo.tgbotapi.types.files.RegularVideoSticker - -public inline fun TelegramMediaFile.ifRegularVideoSticker(block: (RegularVideoSticker) -> T): T? - = regularVideoStickerOrNull() ?.let(block) - public inline fun TelegramMediaFile.unknownStickerOrNull(): UnknownSticker? = this as? dev.inmo.tgbotapi.types.files.UnknownSticker @@ -1303,15 +2307,6 @@ public inline fun TelegramMediaFile.unknownStickerOrThrow(): UnknownSticker = th public inline fun TelegramMediaFile.ifUnknownSticker(block: (UnknownSticker) -> T): T? = unknownStickerOrNull() ?.let(block) -public inline fun TelegramMediaFile.videoStickerOrNull(): VideoSticker? = this as? - dev.inmo.tgbotapi.types.files.VideoSticker - -public inline fun TelegramMediaFile.videoStickerOrThrow(): VideoSticker = this as - dev.inmo.tgbotapi.types.files.VideoSticker - -public inline fun TelegramMediaFile.ifVideoSticker(block: (VideoSticker) -> T): T? = - videoStickerOrNull() ?.let(block) - public inline fun TelegramMediaFile.thumbedMediaFileOrNull(): ThumbedMediaFile? = this as? dev.inmo.tgbotapi.types.files.ThumbedMediaFile @@ -1321,13 +2316,31 @@ public inline fun TelegramMediaFile.thumbedMediaFileOrThrow(): ThumbedMediaFile public inline fun TelegramMediaFile.ifThumbedMediaFile(block: (ThumbedMediaFile) -> T): T? = thumbedMediaFileOrNull() ?.let(block) -public inline fun Location.liveLocationOrNull(): LiveLocation? = this as? - dev.inmo.tgbotapi.types.location.LiveLocation +public inline fun TelegramMediaFile.videoFileOrNull(): VideoFile? = this as? + dev.inmo.tgbotapi.types.files.VideoFile -public inline fun Location.liveLocationOrThrow(): LiveLocation = this as - dev.inmo.tgbotapi.types.location.LiveLocation +public inline fun TelegramMediaFile.videoFileOrThrow(): VideoFile = this as + dev.inmo.tgbotapi.types.files.VideoFile -public inline fun Location.ifLiveLocation(block: (LiveLocation) -> T): T? = liveLocationOrNull() +public inline fun TelegramMediaFile.ifVideoFile(block: (VideoFile) -> T): T? = videoFileOrNull() + ?.let(block) + +public inline fun TelegramMediaFile.videoNoteFileOrNull(): VideoNoteFile? = this as? + dev.inmo.tgbotapi.types.files.VideoNoteFile + +public inline fun TelegramMediaFile.videoNoteFileOrThrow(): VideoNoteFile = this as + dev.inmo.tgbotapi.types.files.VideoNoteFile + +public inline fun TelegramMediaFile.ifVideoNoteFile(block: (VideoNoteFile) -> T): T? = + videoNoteFileOrNull() ?.let(block) + +public inline fun TelegramMediaFile.voiceFileOrNull(): VoiceFile? = this as? + dev.inmo.tgbotapi.types.files.VoiceFile + +public inline fun TelegramMediaFile.voiceFileOrThrow(): VoiceFile = this as + dev.inmo.tgbotapi.types.files.VoiceFile + +public inline fun TelegramMediaFile.ifVoiceFile(block: (VoiceFile) -> T): T? = voiceFileOrNull() ?.let(block) public inline fun Location.staticLocationOrNull(): StaticLocation? = this as? @@ -1339,6 +2352,15 @@ public inline fun Location.staticLocationOrThrow(): StaticLocation = this as public inline fun Location.ifStaticLocation(block: (StaticLocation) -> T): T? = staticLocationOrNull() ?.let(block) +public inline fun Location.liveLocationOrNull(): LiveLocation? = this as? + dev.inmo.tgbotapi.types.location.LiveLocation + +public inline fun Location.liveLocationOrThrow(): LiveLocation = this as + dev.inmo.tgbotapi.types.location.LiveLocation + +public inline fun Location.ifLiveLocation(block: (LiveLocation) -> T): T? = liveLocationOrNull() + ?.let(block) + public inline fun TelegramMedia.duratedTelegramMediaOrNull(): DuratedTelegramMedia? = this as? dev.inmo.tgbotapi.types.media.DuratedTelegramMedia @@ -1348,33 +2370,6 @@ public inline fun TelegramMedia.duratedTelegramMediaOrThrow(): DuratedTelegramMe public inline fun TelegramMedia.ifDuratedTelegramMedia(block: (DuratedTelegramMedia) -> T): T? = duratedTelegramMediaOrNull() ?.let(block) -public inline fun TelegramMedia.telegramMediaAnimationOrNull(): TelegramMediaAnimation? = this as? - dev.inmo.tgbotapi.types.media.TelegramMediaAnimation - -public inline fun TelegramMedia.telegramMediaAnimationOrThrow(): TelegramMediaAnimation = this as - dev.inmo.tgbotapi.types.media.TelegramMediaAnimation - -public inline fun TelegramMedia.ifTelegramMediaAnimation(block: (TelegramMediaAnimation) -> T): - T? = telegramMediaAnimationOrNull() ?.let(block) - -public inline fun TelegramMedia.telegramMediaAudioOrNull(): TelegramMediaAudio? = this as? - dev.inmo.tgbotapi.types.media.TelegramMediaAudio - -public inline fun TelegramMedia.telegramMediaAudioOrThrow(): TelegramMediaAudio = this as - dev.inmo.tgbotapi.types.media.TelegramMediaAudio - -public inline fun TelegramMedia.ifTelegramMediaAudio(block: (TelegramMediaAudio) -> T): T? = - telegramMediaAudioOrNull() ?.let(block) - -public inline fun TelegramMedia.telegramMediaVideoOrNull(): TelegramMediaVideo? = this as? - dev.inmo.tgbotapi.types.media.TelegramMediaVideo - -public inline fun TelegramMedia.telegramMediaVideoOrThrow(): TelegramMediaVideo = this as - dev.inmo.tgbotapi.types.media.TelegramMediaVideo - -public inline fun TelegramMedia.ifTelegramMediaVideo(block: (TelegramMediaVideo) -> T): T? = - telegramMediaVideoOrNull() ?.let(block) - public inline fun TelegramMedia.mediaGroupMemberTelegramMediaOrNull(): MediaGroupMemberTelegramMedia? = this as? dev.inmo.tgbotapi.types.media.MediaGroupMemberTelegramMedia @@ -1411,15 +2406,6 @@ public inline fun TelegramMedia.ifDocumentMediaGroupMemberTelegramMedia(block: (DocumentMediaGroupMemberTelegramMedia) -> T): T? = documentMediaGroupMemberTelegramMediaOrNull() ?.let(block) -public inline fun TelegramMedia.telegramMediaDocumentOrNull(): TelegramMediaDocument? = this as? - dev.inmo.tgbotapi.types.media.TelegramMediaDocument - -public inline fun TelegramMedia.telegramMediaDocumentOrThrow(): TelegramMediaDocument = this as - dev.inmo.tgbotapi.types.media.TelegramMediaDocument - -public inline fun TelegramMedia.ifTelegramMediaDocument(block: (TelegramMediaDocument) -> T): T? - = telegramMediaDocumentOrNull() ?.let(block) - public inline fun TelegramMedia.visualMediaGroupMemberTelegramMediaOrNull(): VisualMediaGroupMemberTelegramMedia? = this as? dev.inmo.tgbotapi.types.media.VisualMediaGroupMemberTelegramMedia @@ -1432,15 +2418,6 @@ public inline fun TelegramMedia.ifVisualMediaGroupMemberTelegramMedia(block: (VisualMediaGroupMemberTelegramMedia) -> T): T? = visualMediaGroupMemberTelegramMediaOrNull() ?.let(block) -public inline fun TelegramMedia.telegramMediaPhotoOrNull(): TelegramMediaPhoto? = this as? - dev.inmo.tgbotapi.types.media.TelegramMediaPhoto - -public inline fun TelegramMedia.telegramMediaPhotoOrThrow(): TelegramMediaPhoto = this as - dev.inmo.tgbotapi.types.media.TelegramMediaPhoto - -public inline fun TelegramMedia.ifTelegramMediaPhoto(block: (TelegramMediaPhoto) -> T): T? = - telegramMediaPhotoOrNull() ?.let(block) - public inline fun TelegramMedia.sizedTelegramMediaOrNull(): SizedTelegramMedia? = this as? dev.inmo.tgbotapi.types.media.SizedTelegramMedia @@ -1460,6 +2437,51 @@ public inline fun TelegramMedia.ifSpoilerableTelegramMedia(block: (SpoilerableTelegramMedia) -> T): T? = spoilerableTelegramMediaOrNull() ?.let(block) +public inline fun TelegramMedia.telegramMediaAnimationOrNull(): TelegramMediaAnimation? = this as? + dev.inmo.tgbotapi.types.media.TelegramMediaAnimation + +public inline fun TelegramMedia.telegramMediaAnimationOrThrow(): TelegramMediaAnimation = this as + dev.inmo.tgbotapi.types.media.TelegramMediaAnimation + +public inline fun TelegramMedia.ifTelegramMediaAnimation(block: (TelegramMediaAnimation) -> T): + T? = telegramMediaAnimationOrNull() ?.let(block) + +public inline fun TelegramMedia.telegramMediaAudioOrNull(): TelegramMediaAudio? = this as? + dev.inmo.tgbotapi.types.media.TelegramMediaAudio + +public inline fun TelegramMedia.telegramMediaAudioOrThrow(): TelegramMediaAudio = this as + dev.inmo.tgbotapi.types.media.TelegramMediaAudio + +public inline fun TelegramMedia.ifTelegramMediaAudio(block: (TelegramMediaAudio) -> T): T? = + telegramMediaAudioOrNull() ?.let(block) + +public inline fun TelegramMedia.telegramMediaDocumentOrNull(): TelegramMediaDocument? = this as? + dev.inmo.tgbotapi.types.media.TelegramMediaDocument + +public inline fun TelegramMedia.telegramMediaDocumentOrThrow(): TelegramMediaDocument = this as + dev.inmo.tgbotapi.types.media.TelegramMediaDocument + +public inline fun TelegramMedia.ifTelegramMediaDocument(block: (TelegramMediaDocument) -> T): T? + = telegramMediaDocumentOrNull() ?.let(block) + +public inline fun TelegramMedia.telegramMediaPhotoOrNull(): TelegramMediaPhoto? = this as? + dev.inmo.tgbotapi.types.media.TelegramMediaPhoto + +public inline fun TelegramMedia.telegramMediaPhotoOrThrow(): TelegramMediaPhoto = this as + dev.inmo.tgbotapi.types.media.TelegramMediaPhoto + +public inline fun TelegramMedia.ifTelegramMediaPhoto(block: (TelegramMediaPhoto) -> T): T? = + telegramMediaPhotoOrNull() ?.let(block) + +public inline fun TelegramMedia.telegramMediaVideoOrNull(): TelegramMediaVideo? = this as? + dev.inmo.tgbotapi.types.media.TelegramMediaVideo + +public inline fun TelegramMedia.telegramMediaVideoOrThrow(): TelegramMediaVideo = this as + dev.inmo.tgbotapi.types.media.TelegramMediaVideo + +public inline fun TelegramMedia.ifTelegramMediaVideo(block: (TelegramMediaVideo) -> T): T? = + telegramMediaVideoOrNull() ?.let(block) + public inline fun TelegramMedia.thumbedTelegramMediaOrNull(): ThumbedTelegramMedia? = this as? dev.inmo.tgbotapi.types.media.ThumbedTelegramMedia @@ -1478,6 +2500,342 @@ public inline fun TelegramMedia.titledTelegramMediaOrThrow(): TitledTelegramMedi public inline fun TelegramMedia.ifTitledTelegramMedia(block: (TitledTelegramMedia) -> T): T? = titledTelegramMediaOrNull() ?.let(block) +public inline fun ChatEvent.channelChatCreatedOrNull(): ChannelChatCreated? = this as? + dev.inmo.tgbotapi.types.message.ChatEvents.ChannelChatCreated + +public inline fun ChatEvent.channelChatCreatedOrThrow(): ChannelChatCreated = this as + dev.inmo.tgbotapi.types.message.ChatEvents.ChannelChatCreated + +public inline fun ChatEvent.ifChannelChatCreated(block: (ChannelChatCreated) -> T): T? = + channelChatCreatedOrNull() ?.let(block) + +public inline fun ChatEvent.deleteChatPhotoOrNull(): DeleteChatPhoto? = this as? + dev.inmo.tgbotapi.types.message.ChatEvents.DeleteChatPhoto + +public inline fun ChatEvent.deleteChatPhotoOrThrow(): DeleteChatPhoto = this as + dev.inmo.tgbotapi.types.message.ChatEvents.DeleteChatPhoto + +public inline fun ChatEvent.ifDeleteChatPhoto(block: (DeleteChatPhoto) -> T): T? = + deleteChatPhotoOrNull() ?.let(block) + +public inline fun ChatEvent.groupChatCreatedOrNull(): GroupChatCreated? = this as? + dev.inmo.tgbotapi.types.message.ChatEvents.GroupChatCreated + +public inline fun ChatEvent.groupChatCreatedOrThrow(): GroupChatCreated = this as + dev.inmo.tgbotapi.types.message.ChatEvents.GroupChatCreated + +public inline fun ChatEvent.ifGroupChatCreated(block: (GroupChatCreated) -> T): T? = + groupChatCreatedOrNull() ?.let(block) + +public inline fun ChatEvent.leftChatMemberEventOrNull(): LeftChatMemberEvent? = this as? + dev.inmo.tgbotapi.types.message.ChatEvents.LeftChatMemberEvent + +public inline fun ChatEvent.leftChatMemberEventOrThrow(): LeftChatMemberEvent = this as + dev.inmo.tgbotapi.types.message.ChatEvents.LeftChatMemberEvent + +public inline fun ChatEvent.ifLeftChatMemberEvent(block: (LeftChatMemberEvent) -> T): T? = + leftChatMemberEventOrNull() ?.let(block) + +public inline fun ChatEvent.messageAutoDeleteTimerChangedOrNull(): MessageAutoDeleteTimerChanged? = + this as? dev.inmo.tgbotapi.types.message.ChatEvents.MessageAutoDeleteTimerChanged + +public inline fun ChatEvent.messageAutoDeleteTimerChangedOrThrow(): MessageAutoDeleteTimerChanged = + this as dev.inmo.tgbotapi.types.message.ChatEvents.MessageAutoDeleteTimerChanged + +public inline fun + ChatEvent.ifMessageAutoDeleteTimerChanged(block: (MessageAutoDeleteTimerChanged) -> T): T? = + messageAutoDeleteTimerChangedOrNull() ?.let(block) + +public inline fun ChatEvent.migratedToSupergroupOrNull(): MigratedToSupergroup? = this as? + dev.inmo.tgbotapi.types.message.ChatEvents.MigratedToSupergroup + +public inline fun ChatEvent.migratedToSupergroupOrThrow(): MigratedToSupergroup = this as + dev.inmo.tgbotapi.types.message.ChatEvents.MigratedToSupergroup + +public inline fun ChatEvent.ifMigratedToSupergroup(block: (MigratedToSupergroup) -> T): T? = + migratedToSupergroupOrNull() ?.let(block) + +public inline fun ChatEvent.newChatMembersOrNull(): NewChatMembers? = this as? + dev.inmo.tgbotapi.types.message.ChatEvents.NewChatMembers + +public inline fun ChatEvent.newChatMembersOrThrow(): NewChatMembers = this as + dev.inmo.tgbotapi.types.message.ChatEvents.NewChatMembers + +public inline fun ChatEvent.ifNewChatMembers(block: (NewChatMembers) -> T): T? = + newChatMembersOrNull() ?.let(block) + +public inline fun ChatEvent.newChatPhotoOrNull(): NewChatPhoto? = this as? + dev.inmo.tgbotapi.types.message.ChatEvents.NewChatPhoto + +public inline fun ChatEvent.newChatPhotoOrThrow(): NewChatPhoto = this as + dev.inmo.tgbotapi.types.message.ChatEvents.NewChatPhoto + +public inline fun ChatEvent.ifNewChatPhoto(block: (NewChatPhoto) -> T): T? = + newChatPhotoOrNull() ?.let(block) + +public inline fun ChatEvent.newChatTitleOrNull(): NewChatTitle? = this as? + dev.inmo.tgbotapi.types.message.ChatEvents.NewChatTitle + +public inline fun ChatEvent.newChatTitleOrThrow(): NewChatTitle = this as + dev.inmo.tgbotapi.types.message.ChatEvents.NewChatTitle + +public inline fun ChatEvent.ifNewChatTitle(block: (NewChatTitle) -> T): T? = + newChatTitleOrNull() ?.let(block) + +public inline fun ChatEvent.pinnedMessageOrNull(): PinnedMessage? = this as? + dev.inmo.tgbotapi.types.message.ChatEvents.PinnedMessage + +public inline fun ChatEvent.pinnedMessageOrThrow(): PinnedMessage = this as + dev.inmo.tgbotapi.types.message.ChatEvents.PinnedMessage + +public inline fun ChatEvent.ifPinnedMessage(block: (PinnedMessage) -> T): T? = + pinnedMessageOrNull() ?.let(block) + +public inline fun ChatEvent.proximityAlertTriggeredOrNull(): ProximityAlertTriggered? = this as? + dev.inmo.tgbotapi.types.message.ChatEvents.ProximityAlertTriggered + +public inline fun ChatEvent.proximityAlertTriggeredOrThrow(): ProximityAlertTriggered = this as + dev.inmo.tgbotapi.types.message.ChatEvents.ProximityAlertTriggered + +public inline fun ChatEvent.ifProximityAlertTriggered(block: (ProximityAlertTriggered) -> T): T? + = proximityAlertTriggeredOrNull() ?.let(block) + +public inline fun ChatEvent.supergroupChatCreatedOrNull(): SupergroupChatCreated? = this as? + dev.inmo.tgbotapi.types.message.ChatEvents.SupergroupChatCreated + +public inline fun ChatEvent.supergroupChatCreatedOrThrow(): SupergroupChatCreated = this as + dev.inmo.tgbotapi.types.message.ChatEvents.SupergroupChatCreated + +public inline fun ChatEvent.ifSupergroupChatCreated(block: (SupergroupChatCreated) -> T): T? = + supergroupChatCreatedOrNull() ?.let(block) + +public inline fun ChatEvent.userLoggedInOrNull(): UserLoggedIn? = this as? + dev.inmo.tgbotapi.types.message.ChatEvents.UserLoggedIn + +public inline fun ChatEvent.userLoggedInOrThrow(): UserLoggedIn = this as + dev.inmo.tgbotapi.types.message.ChatEvents.UserLoggedIn + +public inline fun ChatEvent.ifUserLoggedIn(block: (UserLoggedIn) -> T): T? = + userLoggedInOrNull() ?.let(block) + +public inline fun ChatEvent.webAppDataOrNull(): WebAppData? = this as? + dev.inmo.tgbotapi.types.message.ChatEvents.WebAppData + +public inline fun ChatEvent.webAppDataOrThrow(): WebAppData = this as + dev.inmo.tgbotapi.types.message.ChatEvents.WebAppData + +public inline fun ChatEvent.ifWebAppData(block: (WebAppData) -> T): T? = webAppDataOrNull() + ?.let(block) + +public inline fun ChatEvent.channelEventOrNull(): ChannelEvent? = this as? + dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.ChannelEvent + +public inline fun ChatEvent.channelEventOrThrow(): ChannelEvent = this as + dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.ChannelEvent + +public inline fun ChatEvent.ifChannelEvent(block: (ChannelEvent) -> T): T? = + channelEventOrNull() ?.let(block) + +public inline fun ChatEvent.commonEventOrNull(): CommonEvent? = this as? + dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.CommonEvent + +public inline fun ChatEvent.commonEventOrThrow(): CommonEvent = this as + dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.CommonEvent + +public inline fun ChatEvent.ifCommonEvent(block: (CommonEvent) -> T): T? = commonEventOrNull() + ?.let(block) + +public inline fun ChatEvent.forumEventOrNull(): ForumEvent? = this as? + dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.ForumEvent + +public inline fun ChatEvent.forumEventOrThrow(): ForumEvent = this as + dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.ForumEvent + +public inline fun ChatEvent.ifForumEvent(block: (ForumEvent) -> T): T? = forumEventOrNull() + ?.let(block) + +public inline fun ChatEvent.groupEventOrNull(): GroupEvent? = this as? + dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.GroupEvent + +public inline fun ChatEvent.groupEventOrThrow(): GroupEvent = this as + dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.GroupEvent + +public inline fun ChatEvent.ifGroupEvent(block: (GroupEvent) -> T): T? = groupEventOrNull() + ?.let(block) + +public inline fun ChatEvent.privateEventOrNull(): PrivateEvent? = this as? + dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.PrivateEvent + +public inline fun ChatEvent.privateEventOrThrow(): PrivateEvent = this as + dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.PrivateEvent + +public inline fun ChatEvent.ifPrivateEvent(block: (PrivateEvent) -> T): T? = + privateEventOrNull() ?.let(block) + +public inline fun ChatEvent.publicChatEventOrNull(): PublicChatEvent? = this as? + dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.PublicChatEvent + +public inline fun ChatEvent.publicChatEventOrThrow(): PublicChatEvent = this as + dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.PublicChatEvent + +public inline fun ChatEvent.ifPublicChatEvent(block: (PublicChatEvent) -> T): T? = + publicChatEventOrNull() ?.let(block) + +public inline fun ChatEvent.supergroupEventOrNull(): SupergroupEvent? = this as? + dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.SupergroupEvent + +public inline fun ChatEvent.supergroupEventOrThrow(): SupergroupEvent = this as + dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.SupergroupEvent + +public inline fun ChatEvent.ifSupergroupEvent(block: (SupergroupEvent) -> T): T? = + supergroupEventOrNull() ?.let(block) + +public inline fun ChatEvent.videoChatEventOrNull(): VideoChatEvent? = this as? + dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.VideoChatEvent + +public inline fun ChatEvent.videoChatEventOrThrow(): VideoChatEvent = this as + dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.VideoChatEvent + +public inline fun ChatEvent.ifVideoChatEvent(block: (VideoChatEvent) -> T): T? = + videoChatEventOrNull() ?.let(block) + +public inline fun ChatEvent.forumTopicClosedOrNull(): ForumTopicClosed? = this as? + dev.inmo.tgbotapi.types.message.ChatEvents.forum.ForumTopicClosed + +public inline fun ChatEvent.forumTopicClosedOrThrow(): ForumTopicClosed = this as + dev.inmo.tgbotapi.types.message.ChatEvents.forum.ForumTopicClosed + +public inline fun ChatEvent.ifForumTopicClosed(block: (ForumTopicClosed) -> T): T? = + forumTopicClosedOrNull() ?.let(block) + +public inline fun ChatEvent.forumTopicCreatedOrNull(): ForumTopicCreated? = this as? + dev.inmo.tgbotapi.types.message.ChatEvents.forum.ForumTopicCreated + +public inline fun ChatEvent.forumTopicCreatedOrThrow(): ForumTopicCreated = this as + dev.inmo.tgbotapi.types.message.ChatEvents.forum.ForumTopicCreated + +public inline fun ChatEvent.ifForumTopicCreated(block: (ForumTopicCreated) -> T): T? = + forumTopicCreatedOrNull() ?.let(block) + +public inline fun ChatEvent.forumTopicEditedOrNull(): ForumTopicEdited? = this as? + dev.inmo.tgbotapi.types.message.ChatEvents.forum.ForumTopicEdited + +public inline fun ChatEvent.forumTopicEditedOrThrow(): ForumTopicEdited = this as + dev.inmo.tgbotapi.types.message.ChatEvents.forum.ForumTopicEdited + +public inline fun ChatEvent.ifForumTopicEdited(block: (ForumTopicEdited) -> T): T? = + forumTopicEditedOrNull() ?.let(block) + +public inline fun ChatEvent.forumTopicReopenedOrNull(): ForumTopicReopened? = this as? + dev.inmo.tgbotapi.types.message.ChatEvents.forum.ForumTopicReopened + +public inline fun ChatEvent.forumTopicReopenedOrThrow(): ForumTopicReopened = this as + dev.inmo.tgbotapi.types.message.ChatEvents.forum.ForumTopicReopened + +public inline fun ChatEvent.ifForumTopicReopened(block: (ForumTopicReopened) -> T): T? = + forumTopicReopenedOrNull() ?.let(block) + +public inline fun ChatEvent.generalForumTopicHiddenOrNull(): GeneralForumTopicHidden? = this as? + dev.inmo.tgbotapi.types.message.ChatEvents.forum.GeneralForumTopicHidden + +public inline fun ChatEvent.generalForumTopicHiddenOrThrow(): GeneralForumTopicHidden = this as + dev.inmo.tgbotapi.types.message.ChatEvents.forum.GeneralForumTopicHidden + +public inline fun ChatEvent.ifGeneralForumTopicHidden(block: (GeneralForumTopicHidden) -> T): T? + = generalForumTopicHiddenOrNull() ?.let(block) + +public inline fun ChatEvent.generalForumTopicUnhiddenOrNull(): GeneralForumTopicUnhidden? = this as? + dev.inmo.tgbotapi.types.message.ChatEvents.forum.GeneralForumTopicUnhidden + +public inline fun ChatEvent.generalForumTopicUnhiddenOrThrow(): GeneralForumTopicUnhidden = this as + dev.inmo.tgbotapi.types.message.ChatEvents.forum.GeneralForumTopicUnhidden + +public inline fun + ChatEvent.ifGeneralForumTopicUnhidden(block: (GeneralForumTopicUnhidden) -> T): T? = + generalForumTopicUnhiddenOrNull() ?.let(block) + +public inline fun ChatEvent.writeAccessAllowedOrNull(): WriteAccessAllowed? = this as? + dev.inmo.tgbotapi.types.message.ChatEvents.forum.WriteAccessAllowed + +public inline fun ChatEvent.writeAccessAllowedOrThrow(): WriteAccessAllowed = this as + dev.inmo.tgbotapi.types.message.ChatEvents.forum.WriteAccessAllowed + +public inline fun ChatEvent.ifWriteAccessAllowed(block: (WriteAccessAllowed) -> T): T? = + writeAccessAllowedOrNull() ?.let(block) + +public inline fun ChatEvent.videoChatEndedOrNull(): VideoChatEnded? = this as? + dev.inmo.tgbotapi.types.message.ChatEvents.voice.VideoChatEnded + +public inline fun ChatEvent.videoChatEndedOrThrow(): VideoChatEnded = this as + dev.inmo.tgbotapi.types.message.ChatEvents.voice.VideoChatEnded + +public inline fun ChatEvent.ifVideoChatEnded(block: (VideoChatEnded) -> T): T? = + videoChatEndedOrNull() ?.let(block) + +public inline fun ChatEvent.videoChatParticipantsInvitedOrNull(): VideoChatParticipantsInvited? = + this as? dev.inmo.tgbotapi.types.message.ChatEvents.voice.VideoChatParticipantsInvited + +public inline fun ChatEvent.videoChatParticipantsInvitedOrThrow(): VideoChatParticipantsInvited = + this as dev.inmo.tgbotapi.types.message.ChatEvents.voice.VideoChatParticipantsInvited + +public inline fun + ChatEvent.ifVideoChatParticipantsInvited(block: (VideoChatParticipantsInvited) -> T): T? = + videoChatParticipantsInvitedOrNull() ?.let(block) + +public inline fun ChatEvent.videoChatScheduledOrNull(): VideoChatScheduled? = this as? + dev.inmo.tgbotapi.types.message.ChatEvents.voice.VideoChatScheduled + +public inline fun ChatEvent.videoChatScheduledOrThrow(): VideoChatScheduled = this as + dev.inmo.tgbotapi.types.message.ChatEvents.voice.VideoChatScheduled + +public inline fun ChatEvent.ifVideoChatScheduled(block: (VideoChatScheduled) -> T): T? = + videoChatScheduledOrNull() ?.let(block) + +public inline fun ChatEvent.videoChatStartedOrNull(): VideoChatStarted? = this as? + dev.inmo.tgbotapi.types.message.ChatEvents.voice.VideoChatStarted + +public inline fun ChatEvent.videoChatStartedOrThrow(): VideoChatStarted = this as + dev.inmo.tgbotapi.types.message.ChatEvents.voice.VideoChatStarted + +public inline fun ChatEvent.ifVideoChatStarted(block: (VideoChatStarted) -> T): T? = + videoChatStartedOrNull() ?.let(block) + +public inline fun ChatEvent.successfulPaymentEventOrNull(): SuccessfulPaymentEvent? = this as? + dev.inmo.tgbotapi.types.message.payments.SuccessfulPaymentEvent + +public inline fun ChatEvent.successfulPaymentEventOrThrow(): SuccessfulPaymentEvent = this as + dev.inmo.tgbotapi.types.message.payments.SuccessfulPaymentEvent + +public inline fun ChatEvent.ifSuccessfulPaymentEvent(block: (SuccessfulPaymentEvent) -> T): T? = + successfulPaymentEventOrNull() ?.let(block) + +public inline fun ChatEvent.chatSharedOrNull(): ChatShared? = this as? + dev.inmo.tgbotapi.types.request.ChatShared + +public inline fun ChatEvent.chatSharedOrThrow(): ChatShared = this as + dev.inmo.tgbotapi.types.request.ChatShared + +public inline fun ChatEvent.ifChatShared(block: (ChatShared) -> T): T? = chatSharedOrNull() + ?.let(block) + +public inline fun ChatEvent.chatSharedRequestOrNull(): ChatSharedRequest? = this as? + dev.inmo.tgbotapi.types.request.ChatSharedRequest + +public inline fun ChatEvent.chatSharedRequestOrThrow(): ChatSharedRequest = this as + dev.inmo.tgbotapi.types.request.ChatSharedRequest + +public inline fun ChatEvent.ifChatSharedRequest(block: (ChatSharedRequest) -> T): T? = + chatSharedRequestOrNull() ?.let(block) + +public inline fun ChatEvent.userSharedOrNull(): UserShared? = this as? + dev.inmo.tgbotapi.types.request.UserShared + +public inline fun ChatEvent.userSharedOrThrow(): UserShared = this as + dev.inmo.tgbotapi.types.request.UserShared + +public inline fun ChatEvent.ifUserShared(block: (UserShared) -> T): T? = userSharedOrNull() + ?.let(block) + public inline fun ForwardInfo.byAnonymousOrNull(): ForwardInfo.ByAnonymous? = this as? dev.inmo.tgbotapi.types.message.ForwardInfo.ByAnonymous @@ -1534,6 +2892,350 @@ public inline fun ForwardInfo.ifSentByChannel(block: (ForwardInfo.PublicChat.SentByChannel) -> T): T? = sentByChannelOrNull() ?.let(block) +public inline fun Message.channelEventMessageOrNull(): ChannelEventMessage? = this as? + dev.inmo.tgbotapi.types.message.ChannelEventMessage + +public inline fun Message.channelEventMessageOrThrow(): ChannelEventMessage = this as + dev.inmo.tgbotapi.types.message.ChannelEventMessage + +public inline fun + Message.ifChannelEventMessage(block: (ChannelEventMessage) -> T): T? = + channelEventMessageOrNull() ?.let(block) + +public inline fun Message.commonGroupEventMessageOrNull(): CommonGroupEventMessage? = + this as? + dev.inmo.tgbotapi.types.message.CommonGroupEventMessage + +public inline fun Message.commonGroupEventMessageOrThrow(): CommonGroupEventMessage = + this as + dev.inmo.tgbotapi.types.message.CommonGroupEventMessage + +public inline fun + Message.ifCommonGroupEventMessage(block: (CommonGroupEventMessage) -> T): T? = + commonGroupEventMessageOrNull() ?.let(block) + +public inline fun Message.commonSupergroupEventMessageOrNull(): + CommonSupergroupEventMessage? = this as? + dev.inmo.tgbotapi.types.message.CommonSupergroupEventMessage + +public inline fun Message.commonSupergroupEventMessageOrThrow(): + CommonSupergroupEventMessage = this as + dev.inmo.tgbotapi.types.message.CommonSupergroupEventMessage + +public inline fun + Message.ifCommonSupergroupEventMessage(block: (CommonSupergroupEventMessage) -> T): + T? = commonSupergroupEventMessageOrNull() ?.let(block) + +public inline fun Message.passportMessageOrNull(): PassportMessage? = this as? + dev.inmo.tgbotapi.types.message.PassportMessage + +public inline fun Message.passportMessageOrThrow(): PassportMessage = this as + dev.inmo.tgbotapi.types.message.PassportMessage + +public inline fun Message.ifPassportMessage(block: (PassportMessage) -> T): T? = + passportMessageOrNull() ?.let(block) + +public inline fun Message.privateEventMessageOrNull(): PrivateEventMessage? = this as? + dev.inmo.tgbotapi.types.message.PrivateEventMessage + +public inline fun Message.privateEventMessageOrThrow(): PrivateEventMessage = this as + dev.inmo.tgbotapi.types.message.PrivateEventMessage + +public inline fun + Message.ifPrivateEventMessage(block: (PrivateEventMessage) -> T): T? = + privateEventMessageOrNull() ?.let(block) + +public inline fun Message.channelContentMessageOrNull(): ChannelContentMessage? = + this as? + dev.inmo.tgbotapi.types.message.abstracts.ChannelContentMessage + +public inline fun Message.channelContentMessageOrThrow(): ChannelContentMessage = + this as + dev.inmo.tgbotapi.types.message.abstracts.ChannelContentMessage + +public inline fun + Message.ifChannelContentMessage(block: (ChannelContentMessage) -> T): T? = + channelContentMessageOrNull() ?.let(block) + +public inline fun Message.chatEventMessageOrNull(): ChatEventMessage? = this as? + dev.inmo.tgbotapi.types.message.abstracts.ChatEventMessage + +public inline fun Message.chatEventMessageOrThrow(): ChatEventMessage = this as + dev.inmo.tgbotapi.types.message.abstracts.ChatEventMessage + +public inline fun Message.ifChatEventMessage(block: (ChatEventMessage) -> T): T? = + chatEventMessageOrNull() ?.let(block) + +public inline fun Message.commonMessageOrNull(): CommonMessage? = this as? + dev.inmo.tgbotapi.types.message.abstracts.CommonMessage + +public inline fun Message.commonMessageOrThrow(): CommonMessage = this as + dev.inmo.tgbotapi.types.message.abstracts.CommonMessage + +public inline fun Message.ifCommonMessage(block: (CommonMessage) -> T): T? = + commonMessageOrNull() ?.let(block) + +public inline fun Message.contentMessageOrNull(): ContentMessage? = this as? + dev.inmo.tgbotapi.types.message.abstracts.ContentMessage + +public inline fun Message.contentMessageOrThrow(): ContentMessage = this as + dev.inmo.tgbotapi.types.message.abstracts.ContentMessage + +public inline fun Message.ifContentMessage(block: (ContentMessage) -> T): T? = + contentMessageOrNull() ?.let(block) + +public inline fun Message.fromUserMessageOrNull(): FromUserMessage? = this as? + dev.inmo.tgbotapi.types.message.abstracts.FromUserMessage + +public inline fun Message.fromUserMessageOrThrow(): FromUserMessage = this as + dev.inmo.tgbotapi.types.message.abstracts.FromUserMessage + +public inline fun Message.ifFromUserMessage(block: (FromUserMessage) -> T): T? = + fromUserMessageOrNull() ?.let(block) + +public inline fun Message.groupEventMessageOrNull(): GroupEventMessage? = this as? + dev.inmo.tgbotapi.types.message.abstracts.GroupEventMessage + +public inline fun Message.groupEventMessageOrThrow(): GroupEventMessage = this as + dev.inmo.tgbotapi.types.message.abstracts.GroupEventMessage + +public inline fun Message.ifGroupEventMessage(block: (GroupEventMessage) -> T): T? = + groupEventMessageOrNull() ?.let(block) + +public inline fun Message.groupContentMessageOrNull(): GroupContentMessage? = this + as? + dev.inmo.tgbotapi.types.message.abstracts.GroupContentMessage + +public inline fun Message.groupContentMessageOrThrow(): GroupContentMessage = this + as + dev.inmo.tgbotapi.types.message.abstracts.GroupContentMessage + +public inline fun + Message.ifGroupContentMessage(block: (GroupContentMessage) -> T): T? = + groupContentMessageOrNull() ?.let(block) + +public inline fun Message.forumContentMessageOrNull(): ForumContentMessage? = this + as? + dev.inmo.tgbotapi.types.message.abstracts.ForumContentMessage + +public inline fun Message.forumContentMessageOrThrow(): ForumContentMessage = this + as + dev.inmo.tgbotapi.types.message.abstracts.ForumContentMessage + +public inline fun + Message.ifForumContentMessage(block: (ForumContentMessage) -> T): T? = + forumContentMessageOrNull() ?.let(block) + +public inline fun Message.fromChannelGroupContentMessageOrNull(): + FromChannelGroupContentMessage? = this as? + dev.inmo.tgbotapi.types.message.abstracts.FromChannelGroupContentMessage + +public inline fun Message.fromChannelGroupContentMessageOrThrow(): + FromChannelGroupContentMessage = this as + dev.inmo.tgbotapi.types.message.abstracts.FromChannelGroupContentMessage + +public inline fun + Message.ifFromChannelGroupContentMessage(block: (FromChannelGroupContentMessage) -> T): + T? = fromChannelGroupContentMessageOrNull() ?.let(block) + +public inline fun Message.connectedFromChannelGroupContentMessageOrNull(): + ConnectedFromChannelGroupContentMessage? = this as? + dev.inmo.tgbotapi.types.message.abstracts.ConnectedFromChannelGroupContentMessage + +public inline fun Message.connectedFromChannelGroupContentMessageOrThrow(): + ConnectedFromChannelGroupContentMessage = this as + dev.inmo.tgbotapi.types.message.abstracts.ConnectedFromChannelGroupContentMessage + +public inline fun + Message.ifConnectedFromChannelGroupContentMessage(block: (ConnectedFromChannelGroupContentMessage) -> T): + T? = connectedFromChannelGroupContentMessageOrNull() ?.let(block) + +public inline fun Message.unconnectedFromChannelGroupContentMessageOrNull(): + UnconnectedFromChannelGroupContentMessage? = this as? + dev.inmo.tgbotapi.types.message.abstracts.UnconnectedFromChannelGroupContentMessage + +public inline fun Message.unconnectedFromChannelGroupContentMessageOrThrow(): + UnconnectedFromChannelGroupContentMessage = this as + dev.inmo.tgbotapi.types.message.abstracts.UnconnectedFromChannelGroupContentMessage + +public inline fun + Message.ifUnconnectedFromChannelGroupContentMessage(block: (UnconnectedFromChannelGroupContentMessage) -> T): + T? = unconnectedFromChannelGroupContentMessageOrNull() ?.let(block) + +public inline fun Message.anonymousGroupContentMessageOrNull(): + AnonymousGroupContentMessage? = this as? + dev.inmo.tgbotapi.types.message.abstracts.AnonymousGroupContentMessage + +public inline fun Message.anonymousGroupContentMessageOrThrow(): + AnonymousGroupContentMessage = this as + dev.inmo.tgbotapi.types.message.abstracts.AnonymousGroupContentMessage + +public inline fun + Message.ifAnonymousGroupContentMessage(block: (AnonymousGroupContentMessage) -> T): + T? = anonymousGroupContentMessageOrNull() ?.let(block) + +public inline fun Message.commonGroupContentMessageOrNull(): + CommonGroupContentMessage? = this as? + dev.inmo.tgbotapi.types.message.abstracts.CommonGroupContentMessage + +public inline fun Message.commonGroupContentMessageOrThrow(): + CommonGroupContentMessage = this as + dev.inmo.tgbotapi.types.message.abstracts.CommonGroupContentMessage + +public inline fun + Message.ifCommonGroupContentMessage(block: (CommonGroupContentMessage) -> T): T? + = commonGroupContentMessageOrNull() ?.let(block) + +public inline fun Message.fromChannelForumContentMessageOrNull(): + FromChannelForumContentMessage? = this as? + dev.inmo.tgbotapi.types.message.abstracts.FromChannelForumContentMessage + +public inline fun Message.fromChannelForumContentMessageOrThrow(): + FromChannelForumContentMessage = this as + dev.inmo.tgbotapi.types.message.abstracts.FromChannelForumContentMessage + +public inline fun + Message.ifFromChannelForumContentMessage(block: (FromChannelForumContentMessage) -> T): + T? = fromChannelForumContentMessageOrNull() ?.let(block) + +public inline fun Message.anonymousForumContentMessageOrNull(): + AnonymousForumContentMessage? = this as? + dev.inmo.tgbotapi.types.message.abstracts.AnonymousForumContentMessage + +public inline fun Message.anonymousForumContentMessageOrThrow(): + AnonymousForumContentMessage = this as + dev.inmo.tgbotapi.types.message.abstracts.AnonymousForumContentMessage + +public inline fun + Message.ifAnonymousForumContentMessage(block: (AnonymousForumContentMessage) -> T): + T? = anonymousForumContentMessageOrNull() ?.let(block) + +public inline fun Message.commonForumContentMessageOrNull(): + CommonForumContentMessage? = this as? + dev.inmo.tgbotapi.types.message.abstracts.CommonForumContentMessage + +public inline fun Message.commonForumContentMessageOrThrow(): + CommonForumContentMessage = this as + dev.inmo.tgbotapi.types.message.abstracts.CommonForumContentMessage + +public inline fun + Message.ifCommonForumContentMessage(block: (CommonForumContentMessage) -> T): T? + = commonForumContentMessageOrNull() ?.let(block) + +public inline fun Message.unknownMessageTypeOrNull(): UnknownMessageType? = this as? + dev.inmo.tgbotapi.types.message.abstracts.UnknownMessageType + +public inline fun Message.unknownMessageTypeOrThrow(): UnknownMessageType = this as + dev.inmo.tgbotapi.types.message.abstracts.UnknownMessageType + +public inline fun Message.ifUnknownMessageType(block: (UnknownMessageType) -> T): T? = + unknownMessageTypeOrNull() ?.let(block) + +public inline fun Message.possiblyEditedMessageOrNull(): PossiblyEditedMessage? = this as? + dev.inmo.tgbotapi.types.message.abstracts.PossiblyEditedMessage + +public inline fun Message.possiblyEditedMessageOrThrow(): PossiblyEditedMessage = this as + dev.inmo.tgbotapi.types.message.abstracts.PossiblyEditedMessage + +public inline fun Message.ifPossiblyEditedMessage(block: (PossiblyEditedMessage) -> T): T? = + possiblyEditedMessageOrNull() ?.let(block) + +public inline fun Message.possiblyForwardedMessageOrNull(): PossiblyForwardedMessage? = this as? + dev.inmo.tgbotapi.types.message.abstracts.PossiblyForwardedMessage + +public inline fun Message.possiblyForwardedMessageOrThrow(): PossiblyForwardedMessage = this as + dev.inmo.tgbotapi.types.message.abstracts.PossiblyForwardedMessage + +public inline fun Message.ifPossiblyForwardedMessage(block: (PossiblyForwardedMessage) -> T): T? + = possiblyForwardedMessageOrNull() ?.let(block) + +public inline fun Message.possiblyMediaGroupMessageOrNull(): + PossiblyMediaGroupMessage? = this as? + dev.inmo.tgbotapi.types.message.abstracts.PossiblyMediaGroupMessage + +public inline fun Message.possiblyMediaGroupMessageOrThrow(): + PossiblyMediaGroupMessage = this as + dev.inmo.tgbotapi.types.message.abstracts.PossiblyMediaGroupMessage + +public inline fun + Message.ifPossiblyMediaGroupMessage(block: (PossiblyMediaGroupMessage) -> T): T? + = possiblyMediaGroupMessageOrNull() ?.let(block) + +public inline fun Message.possiblyPaymentMessageOrNull(): PossiblyPaymentMessage? = this as? + dev.inmo.tgbotapi.types.message.abstracts.PossiblyPaymentMessage + +public inline fun Message.possiblyPaymentMessageOrThrow(): PossiblyPaymentMessage = this as + dev.inmo.tgbotapi.types.message.abstracts.PossiblyPaymentMessage + +public inline fun Message.ifPossiblyPaymentMessage(block: (PossiblyPaymentMessage) -> T): T? = + possiblyPaymentMessageOrNull() ?.let(block) + +public inline fun Message.possiblySentViaBotCommonMessageOrNull(): + PossiblySentViaBotCommonMessage? = this as? + dev.inmo.tgbotapi.types.message.abstracts.PossiblySentViaBotCommonMessage + +public inline fun Message.possiblySentViaBotCommonMessageOrThrow(): + PossiblySentViaBotCommonMessage = this as + dev.inmo.tgbotapi.types.message.abstracts.PossiblySentViaBotCommonMessage + +public inline fun + Message.ifPossiblySentViaBotCommonMessage(block: (PossiblySentViaBotCommonMessage) -> T): + T? = possiblySentViaBotCommonMessageOrNull() ?.let(block) + +public inline fun Message.possiblyTopicMessageOrNull(): PossiblyTopicMessage? = this as? + dev.inmo.tgbotapi.types.message.abstracts.PossiblyTopicMessage + +public inline fun Message.possiblyTopicMessageOrThrow(): PossiblyTopicMessage = this as + dev.inmo.tgbotapi.types.message.abstracts.PossiblyTopicMessage + +public inline fun Message.ifPossiblyTopicMessage(block: (PossiblyTopicMessage) -> T): T? = + possiblyTopicMessageOrNull() ?.let(block) + +public inline fun Message.privateContentMessageOrNull(): PrivateContentMessage? = + this as? + dev.inmo.tgbotapi.types.message.abstracts.PrivateContentMessage + +public inline fun Message.privateContentMessageOrThrow(): PrivateContentMessage = + this as + dev.inmo.tgbotapi.types.message.abstracts.PrivateContentMessage + +public inline fun + Message.ifPrivateContentMessage(block: (PrivateContentMessage) -> T): T? = + privateContentMessageOrNull() ?.let(block) + +public inline fun Message.publicContentMessageOrNull(): PublicContentMessage? = this + as? + dev.inmo.tgbotapi.types.message.abstracts.PublicContentMessage + +public inline fun Message.publicContentMessageOrThrow(): PublicContentMessage = this + as + dev.inmo.tgbotapi.types.message.abstracts.PublicContentMessage + +public inline fun + Message.ifPublicContentMessage(block: (PublicContentMessage) -> T): T? = + publicContentMessageOrNull() ?.let(block) + +public inline fun Message.signedMessageOrNull(): SignedMessage? = this as? + dev.inmo.tgbotapi.types.message.abstracts.SignedMessage + +public inline fun Message.signedMessageOrThrow(): SignedMessage = this as + dev.inmo.tgbotapi.types.message.abstracts.SignedMessage + +public inline fun Message.ifSignedMessage(block: (SignedMessage) -> T): T? = + signedMessageOrNull() ?.let(block) + +public inline fun Message.supergroupEventMessageOrNull(): SupergroupEventMessage? = + this as? + dev.inmo.tgbotapi.types.message.abstracts.SupergroupEventMessage + +public inline fun Message.supergroupEventMessageOrThrow(): SupergroupEventMessage = + this as + dev.inmo.tgbotapi.types.message.abstracts.SupergroupEventMessage + +public inline fun + Message.ifSupergroupEventMessage(block: (SupergroupEventMessage) -> T): T? = + supergroupEventMessageOrNull() ?.let(block) + public inline fun ResendableContent.messageContentOrNull(): MessageContent? = this as? dev.inmo.tgbotapi.types.message.content.MessageContent @@ -1543,6 +3245,129 @@ public inline fun ResendableContent.messageContentOrThrow(): MessageContent = th public inline fun ResendableContent.ifMessageContent(block: (MessageContent) -> T): T? = messageContentOrNull() ?.let(block) +public inline fun ResendableContent.mediaCollectionContentOrNull(): + MediaCollectionContent? = this as? + dev.inmo.tgbotapi.types.message.content.MediaCollectionContent + +public inline fun ResendableContent.mediaCollectionContentOrThrow(): + MediaCollectionContent = this as + dev.inmo.tgbotapi.types.message.content.MediaCollectionContent + +public inline fun + ResendableContent.ifMediaCollectionContent(block: (MediaCollectionContent) -> T): + T? = mediaCollectionContentOrNull() ?.let(block) + +public inline fun ResendableContent.textedContentOrNull(): TextedContent? = this as? + dev.inmo.tgbotapi.types.message.content.TextedContent + +public inline fun ResendableContent.textedContentOrThrow(): TextedContent = this as + dev.inmo.tgbotapi.types.message.content.TextedContent + +public inline fun ResendableContent.ifTextedContent(block: (TextedContent) -> T): T? = + textedContentOrNull() ?.let(block) + +public inline fun ResendableContent.mediaContentOrNull(): MediaContent? = this as? + dev.inmo.tgbotapi.types.message.content.MediaContent + +public inline fun ResendableContent.mediaContentOrThrow(): MediaContent = this as + dev.inmo.tgbotapi.types.message.content.MediaContent + +public inline fun ResendableContent.ifMediaContent(block: (MediaContent) -> T): T? = + mediaContentOrNull() ?.let(block) + +public inline fun ResendableContent.spoilerableMediaContentOrNull(): SpoilerableMediaContent? = this + as? dev.inmo.tgbotapi.types.message.content.SpoilerableMediaContent + +public inline fun ResendableContent.spoilerableMediaContentOrThrow(): SpoilerableMediaContent = this + as dev.inmo.tgbotapi.types.message.content.SpoilerableMediaContent + +public inline fun + ResendableContent.ifSpoilerableMediaContent(block: (SpoilerableMediaContent) -> T): T? = + spoilerableMediaContentOrNull() ?.let(block) + +public inline fun ResendableContent.audioMediaGroupPartContentOrNull(): AudioMediaGroupPartContent? + = this as? dev.inmo.tgbotapi.types.message.content.AudioMediaGroupPartContent + +public inline fun ResendableContent.audioMediaGroupPartContentOrThrow(): AudioMediaGroupPartContent + = this as dev.inmo.tgbotapi.types.message.content.AudioMediaGroupPartContent + +public inline fun + ResendableContent.ifAudioMediaGroupPartContent(block: (AudioMediaGroupPartContent) -> T): T? = + audioMediaGroupPartContentOrNull() ?.let(block) + +public inline fun ResendableContent.documentMediaGroupPartContentOrNull(): + DocumentMediaGroupPartContent? = this as? + dev.inmo.tgbotapi.types.message.content.DocumentMediaGroupPartContent + +public inline fun ResendableContent.documentMediaGroupPartContentOrThrow(): + DocumentMediaGroupPartContent = this as + dev.inmo.tgbotapi.types.message.content.DocumentMediaGroupPartContent + +public inline fun + ResendableContent.ifDocumentMediaGroupPartContent(block: (DocumentMediaGroupPartContent) -> T): + T? = documentMediaGroupPartContentOrNull() ?.let(block) + +public inline fun ResendableContent.textedMediaContentOrNull(): TextedMediaContent? = this as? + dev.inmo.tgbotapi.types.message.content.TextedMediaContent + +public inline fun ResendableContent.textedMediaContentOrThrow(): TextedMediaContent = this as + dev.inmo.tgbotapi.types.message.content.TextedMediaContent + +public inline fun ResendableContent.ifTextedMediaContent(block: (TextedMediaContent) -> T): T? = + textedMediaContentOrNull() ?.let(block) + +public inline fun ResendableContent.mediaGroupCollectionContentOrNull(): + MediaGroupCollectionContent? = this as? + dev.inmo.tgbotapi.types.message.content.MediaGroupCollectionContent + +public inline fun ResendableContent.mediaGroupCollectionContentOrThrow(): + MediaGroupCollectionContent = this as + dev.inmo.tgbotapi.types.message.content.MediaGroupCollectionContent + +public inline fun + ResendableContent.ifMediaGroupCollectionContent(block: (MediaGroupCollectionContent) -> T): + T? = mediaGroupCollectionContentOrNull() ?.let(block) + +public inline fun ResendableContent.mediaGroupPartContentOrNull(): MediaGroupPartContent? = this as? + dev.inmo.tgbotapi.types.message.content.MediaGroupPartContent + +public inline fun ResendableContent.mediaGroupPartContentOrThrow(): MediaGroupPartContent = this as + dev.inmo.tgbotapi.types.message.content.MediaGroupPartContent + +public inline fun + ResendableContent.ifMediaGroupPartContent(block: (MediaGroupPartContent) -> T): T? = + mediaGroupPartContentOrNull() ?.let(block) + +public inline fun ResendableContent.visualMediaGroupPartContentOrNull(): + VisualMediaGroupPartContent? = this as? + dev.inmo.tgbotapi.types.message.content.VisualMediaGroupPartContent + +public inline fun ResendableContent.visualMediaGroupPartContentOrThrow(): + VisualMediaGroupPartContent = this as + dev.inmo.tgbotapi.types.message.content.VisualMediaGroupPartContent + +public inline fun + ResendableContent.ifVisualMediaGroupPartContent(block: (VisualMediaGroupPartContent) -> T): T? = + visualMediaGroupPartContentOrNull() ?.let(block) + +public inline fun ResendableContent.animationContentOrNull(): AnimationContent? = this as? + dev.inmo.tgbotapi.types.message.content.AnimationContent + +public inline fun ResendableContent.animationContentOrThrow(): AnimationContent = this as + dev.inmo.tgbotapi.types.message.content.AnimationContent + +public inline fun ResendableContent.ifAnimationContent(block: (AnimationContent) -> T): T? = + animationContentOrNull() ?.let(block) + +public inline fun ResendableContent.audioContentOrNull(): AudioContent? = this as? + dev.inmo.tgbotapi.types.message.content.AudioContent + +public inline fun ResendableContent.audioContentOrThrow(): AudioContent = this as + dev.inmo.tgbotapi.types.message.content.AudioContent + +public inline fun ResendableContent.ifAudioContent(block: (AudioContent) -> T): T? = + audioContentOrNull() ?.let(block) + public inline fun ResendableContent.contactContentOrNull(): ContactContent? = this as? dev.inmo.tgbotapi.types.message.content.ContactContent @@ -1561,6 +3386,15 @@ public inline fun ResendableContent.diceContentOrThrow(): DiceContent = this as public inline fun ResendableContent.ifDiceContent(block: (DiceContent) -> T): T? = diceContentOrNull() ?.let(block) +public inline fun ResendableContent.documentContentOrNull(): DocumentContent? = this as? + dev.inmo.tgbotapi.types.message.content.DocumentContent + +public inline fun ResendableContent.documentContentOrThrow(): DocumentContent = this as + dev.inmo.tgbotapi.types.message.content.DocumentContent + +public inline fun ResendableContent.ifDocumentContent(block: (DocumentContent) -> T): T? = + documentContentOrNull() ?.let(block) + public inline fun ResendableContent.gameContentOrNull(): GameContent? = this as? dev.inmo.tgbotapi.types.message.content.GameContent @@ -1607,106 +3441,6 @@ public inline fun ResendableContent.ifStaticLocationContent(block: (StaticLocationContent) -> T): T? = staticLocationContentOrNull() ?.let(block) -public inline fun ResendableContent.mediaCollectionContentOrNull(): - MediaCollectionContent? = this as? - dev.inmo.tgbotapi.types.message.content.MediaCollectionContent - -public inline fun ResendableContent.mediaCollectionContentOrThrow(): - MediaCollectionContent = this as - dev.inmo.tgbotapi.types.message.content.MediaCollectionContent - -public inline fun - ResendableContent.ifMediaCollectionContent(block: (MediaCollectionContent) -> T): - T? = mediaCollectionContentOrNull() ?.let(block) - -public inline fun ResendableContent.photoContentOrNull(): PhotoContent? = this as? - dev.inmo.tgbotapi.types.message.content.PhotoContent - -public inline fun ResendableContent.photoContentOrThrow(): PhotoContent = this as - dev.inmo.tgbotapi.types.message.content.PhotoContent - -public inline fun ResendableContent.ifPhotoContent(block: (PhotoContent) -> T): T? = - photoContentOrNull() ?.let(block) - -public inline fun ResendableContent.mediaContentOrNull(): MediaContent? = this as? - dev.inmo.tgbotapi.types.message.content.MediaContent - -public inline fun ResendableContent.mediaContentOrThrow(): MediaContent = this as - dev.inmo.tgbotapi.types.message.content.MediaContent - -public inline fun ResendableContent.ifMediaContent(block: (MediaContent) -> T): T? = - mediaContentOrNull() ?.let(block) - -public inline fun ResendableContent.spoilerableMediaContentOrNull(): SpoilerableMediaContent? = this - as? dev.inmo.tgbotapi.types.message.content.SpoilerableMediaContent - -public inline fun ResendableContent.spoilerableMediaContentOrThrow(): SpoilerableMediaContent = this - as dev.inmo.tgbotapi.types.message.content.SpoilerableMediaContent - -public inline fun - ResendableContent.ifSpoilerableMediaContent(block: (SpoilerableMediaContent) -> T): T? = - spoilerableMediaContentOrNull() ?.let(block) - -public inline fun ResendableContent.animationContentOrNull(): AnimationContent? = this as? - dev.inmo.tgbotapi.types.message.content.AnimationContent - -public inline fun ResendableContent.animationContentOrThrow(): AnimationContent = this as - dev.inmo.tgbotapi.types.message.content.AnimationContent - -public inline fun ResendableContent.ifAnimationContent(block: (AnimationContent) -> T): T? = - animationContentOrNull() ?.let(block) - -public inline fun ResendableContent.visualMediaGroupPartContentOrNull(): - VisualMediaGroupPartContent? = this as? - dev.inmo.tgbotapi.types.message.content.VisualMediaGroupPartContent - -public inline fun ResendableContent.visualMediaGroupPartContentOrThrow(): - VisualMediaGroupPartContent = this as - dev.inmo.tgbotapi.types.message.content.VisualMediaGroupPartContent - -public inline fun - ResendableContent.ifVisualMediaGroupPartContent(block: (VisualMediaGroupPartContent) -> T): T? = - visualMediaGroupPartContentOrNull() ?.let(block) - -public inline fun ResendableContent.videoContentOrNull(): VideoContent? = this as? - dev.inmo.tgbotapi.types.message.content.VideoContent - -public inline fun ResendableContent.videoContentOrThrow(): VideoContent = this as - dev.inmo.tgbotapi.types.message.content.VideoContent - -public inline fun ResendableContent.ifVideoContent(block: (VideoContent) -> T): T? = - videoContentOrNull() ?.let(block) - -public inline fun ResendableContent.stickerContentOrNull(): StickerContent? = this as? - dev.inmo.tgbotapi.types.message.content.StickerContent - -public inline fun ResendableContent.stickerContentOrThrow(): StickerContent = this as - dev.inmo.tgbotapi.types.message.content.StickerContent - -public inline fun ResendableContent.ifStickerContent(block: (StickerContent) -> T): T? = - stickerContentOrNull() ?.let(block) - -public inline fun ResendableContent.textedMediaContentOrNull(): TextedMediaContent? = this as? - dev.inmo.tgbotapi.types.message.content.TextedMediaContent - -public inline fun ResendableContent.textedMediaContentOrThrow(): TextedMediaContent = this as - dev.inmo.tgbotapi.types.message.content.TextedMediaContent - -public inline fun ResendableContent.ifTextedMediaContent(block: (TextedMediaContent) -> T): T? = - textedMediaContentOrNull() ?.let(block) - -public inline fun ResendableContent.mediaGroupCollectionContentOrNull(): - MediaGroupCollectionContent? = this as? - dev.inmo.tgbotapi.types.message.content.MediaGroupCollectionContent - -public inline fun ResendableContent.mediaGroupCollectionContentOrThrow(): - MediaGroupCollectionContent = this as - dev.inmo.tgbotapi.types.message.content.MediaGroupCollectionContent - -public inline fun - ResendableContent.ifMediaGroupCollectionContent(block: (MediaGroupCollectionContent) -> T): - T? = mediaGroupCollectionContentOrNull() ?.let(block) - public inline fun ResendableContent.mediaGroupContentOrNull(): MediaGroupContent? = this as? dev.inmo.tgbotapi.types.message.content.MediaGroupContent @@ -1719,73 +3453,14 @@ public inline fun ResendableContent.ifMediaGroupContent(block: (MediaGroupContent) -> T): T? = mediaGroupContentOrNull() ?.let(block) -public inline fun ResendableContent.mediaGroupPartContentOrNull(): MediaGroupPartContent? = this as? - dev.inmo.tgbotapi.types.message.content.MediaGroupPartContent +public inline fun ResendableContent.photoContentOrNull(): PhotoContent? = this as? + dev.inmo.tgbotapi.types.message.content.PhotoContent -public inline fun ResendableContent.mediaGroupPartContentOrThrow(): MediaGroupPartContent = this as - dev.inmo.tgbotapi.types.message.content.MediaGroupPartContent +public inline fun ResendableContent.photoContentOrThrow(): PhotoContent = this as + dev.inmo.tgbotapi.types.message.content.PhotoContent -public inline fun - ResendableContent.ifMediaGroupPartContent(block: (MediaGroupPartContent) -> T): T? = - mediaGroupPartContentOrNull() ?.let(block) - -public inline fun ResendableContent.audioMediaGroupPartContentOrNull(): AudioMediaGroupPartContent? - = this as? dev.inmo.tgbotapi.types.message.content.AudioMediaGroupPartContent - -public inline fun ResendableContent.audioMediaGroupPartContentOrThrow(): AudioMediaGroupPartContent - = this as dev.inmo.tgbotapi.types.message.content.AudioMediaGroupPartContent - -public inline fun - ResendableContent.ifAudioMediaGroupPartContent(block: (AudioMediaGroupPartContent) -> T): T? = - audioMediaGroupPartContentOrNull() ?.let(block) - -public inline fun ResendableContent.audioContentOrNull(): AudioContent? = this as? - dev.inmo.tgbotapi.types.message.content.AudioContent - -public inline fun ResendableContent.audioContentOrThrow(): AudioContent = this as - dev.inmo.tgbotapi.types.message.content.AudioContent - -public inline fun ResendableContent.ifAudioContent(block: (AudioContent) -> T): T? = - audioContentOrNull() ?.let(block) - -public inline fun ResendableContent.documentMediaGroupPartContentOrNull(): - DocumentMediaGroupPartContent? = this as? - dev.inmo.tgbotapi.types.message.content.DocumentMediaGroupPartContent - -public inline fun ResendableContent.documentMediaGroupPartContentOrThrow(): - DocumentMediaGroupPartContent = this as - dev.inmo.tgbotapi.types.message.content.DocumentMediaGroupPartContent - -public inline fun - ResendableContent.ifDocumentMediaGroupPartContent(block: (DocumentMediaGroupPartContent) -> T): - T? = documentMediaGroupPartContentOrNull() ?.let(block) - -public inline fun ResendableContent.documentContentOrNull(): DocumentContent? = this as? - dev.inmo.tgbotapi.types.message.content.DocumentContent - -public inline fun ResendableContent.documentContentOrThrow(): DocumentContent = this as - dev.inmo.tgbotapi.types.message.content.DocumentContent - -public inline fun ResendableContent.ifDocumentContent(block: (DocumentContent) -> T): T? = - documentContentOrNull() ?.let(block) - -public inline fun ResendableContent.voiceContentOrNull(): VoiceContent? = this as? - dev.inmo.tgbotapi.types.message.content.VoiceContent - -public inline fun ResendableContent.voiceContentOrThrow(): VoiceContent = this as - dev.inmo.tgbotapi.types.message.content.VoiceContent - -public inline fun ResendableContent.ifVoiceContent(block: (VoiceContent) -> T): T? = - voiceContentOrNull() ?.let(block) - -public inline fun ResendableContent.videoNoteContentOrNull(): VideoNoteContent? = this as? - dev.inmo.tgbotapi.types.message.content.VideoNoteContent - -public inline fun ResendableContent.videoNoteContentOrThrow(): VideoNoteContent = this as - dev.inmo.tgbotapi.types.message.content.VideoNoteContent - -public inline fun ResendableContent.ifVideoNoteContent(block: (VideoNoteContent) -> T): T? = - videoNoteContentOrNull() ?.let(block) +public inline fun ResendableContent.ifPhotoContent(block: (PhotoContent) -> T): T? = + photoContentOrNull() ?.let(block) public inline fun ResendableContent.pollContentOrNull(): PollContent? = this as? dev.inmo.tgbotapi.types.message.content.PollContent @@ -1796,14 +3471,14 @@ public inline fun ResendableContent.pollContentOrThrow(): PollContent = this as public inline fun ResendableContent.ifPollContent(block: (PollContent) -> T): T? = pollContentOrNull() ?.let(block) -public inline fun ResendableContent.textedContentOrNull(): TextedContent? = this as? - dev.inmo.tgbotapi.types.message.content.TextedContent +public inline fun ResendableContent.stickerContentOrNull(): StickerContent? = this as? + dev.inmo.tgbotapi.types.message.content.StickerContent -public inline fun ResendableContent.textedContentOrThrow(): TextedContent = this as - dev.inmo.tgbotapi.types.message.content.TextedContent +public inline fun ResendableContent.stickerContentOrThrow(): StickerContent = this as + dev.inmo.tgbotapi.types.message.content.StickerContent -public inline fun ResendableContent.ifTextedContent(block: (TextedContent) -> T): T? = - textedContentOrNull() ?.let(block) +public inline fun ResendableContent.ifStickerContent(block: (StickerContent) -> T): T? = + stickerContentOrNull() ?.let(block) public inline fun ResendableContent.textContentOrNull(): TextContent? = this as? dev.inmo.tgbotapi.types.message.content.TextContent @@ -1823,32 +3498,32 @@ public inline fun ResendableContent.venueContentOrThrow(): VenueContent = this a public inline fun ResendableContent.ifVenueContent(block: (VenueContent) -> T): T? = venueContentOrNull() ?.let(block) -public inline fun TextSource.botCommandTextSourceOrNull(): BotCommandTextSource? = this as? - dev.inmo.tgbotapi.types.message.textsources.BotCommandTextSource +public inline fun ResendableContent.videoContentOrNull(): VideoContent? = this as? + dev.inmo.tgbotapi.types.message.content.VideoContent -public inline fun TextSource.botCommandTextSourceOrThrow(): BotCommandTextSource = this as - dev.inmo.tgbotapi.types.message.textsources.BotCommandTextSource +public inline fun ResendableContent.videoContentOrThrow(): VideoContent = this as + dev.inmo.tgbotapi.types.message.content.VideoContent -public inline fun TextSource.ifBotCommandTextSource(block: (BotCommandTextSource) -> T): T? = - botCommandTextSourceOrNull() ?.let(block) +public inline fun ResendableContent.ifVideoContent(block: (VideoContent) -> T): T? = + videoContentOrNull() ?.let(block) -public inline fun TextSource.codeTextSourceOrNull(): CodeTextSource? = this as? - dev.inmo.tgbotapi.types.message.textsources.CodeTextSource +public inline fun ResendableContent.videoNoteContentOrNull(): VideoNoteContent? = this as? + dev.inmo.tgbotapi.types.message.content.VideoNoteContent -public inline fun TextSource.codeTextSourceOrThrow(): CodeTextSource = this as - dev.inmo.tgbotapi.types.message.textsources.CodeTextSource +public inline fun ResendableContent.videoNoteContentOrThrow(): VideoNoteContent = this as + dev.inmo.tgbotapi.types.message.content.VideoNoteContent -public inline fun TextSource.ifCodeTextSource(block: (CodeTextSource) -> T): T? = - codeTextSourceOrNull() ?.let(block) +public inline fun ResendableContent.ifVideoNoteContent(block: (VideoNoteContent) -> T): T? = + videoNoteContentOrNull() ?.let(block) -public inline fun TextSource.multilevelTextSourceOrNull(): MultilevelTextSource? = this as? - dev.inmo.tgbotapi.types.message.textsources.MultilevelTextSource +public inline fun ResendableContent.voiceContentOrNull(): VoiceContent? = this as? + dev.inmo.tgbotapi.types.message.content.VoiceContent -public inline fun TextSource.multilevelTextSourceOrThrow(): MultilevelTextSource = this as - dev.inmo.tgbotapi.types.message.textsources.MultilevelTextSource +public inline fun ResendableContent.voiceContentOrThrow(): VoiceContent = this as + dev.inmo.tgbotapi.types.message.content.VoiceContent -public inline fun TextSource.ifMultilevelTextSource(block: (MultilevelTextSource) -> T): T? = - multilevelTextSourceOrNull() ?.let(block) +public inline fun ResendableContent.ifVoiceContent(block: (VoiceContent) -> T): T? = + voiceContentOrNull() ?.let(block) public inline fun TextSource.boldTextSourceOrNull(): BoldTextSource? = this as? dev.inmo.tgbotapi.types.message.textsources.BoldTextSource @@ -1859,6 +3534,15 @@ public inline fun TextSource.boldTextSourceOrThrow(): BoldTextSource = this as public inline fun TextSource.ifBoldTextSource(block: (BoldTextSource) -> T): T? = boldTextSourceOrNull() ?.let(block) +public inline fun TextSource.botCommandTextSourceOrNull(): BotCommandTextSource? = this as? + dev.inmo.tgbotapi.types.message.textsources.BotCommandTextSource + +public inline fun TextSource.botCommandTextSourceOrThrow(): BotCommandTextSource = this as + dev.inmo.tgbotapi.types.message.textsources.BotCommandTextSource + +public inline fun TextSource.ifBotCommandTextSource(block: (BotCommandTextSource) -> T): T? = + botCommandTextSourceOrNull() ?.let(block) + public inline fun TextSource.cashTagTextSourceOrNull(): CashTagTextSource? = this as? dev.inmo.tgbotapi.types.message.textsources.CashTagTextSource @@ -1868,6 +3552,15 @@ public inline fun TextSource.cashTagTextSourceOrThrow(): CashTagTextSource = thi public inline fun TextSource.ifCashTagTextSource(block: (CashTagTextSource) -> T): T? = cashTagTextSourceOrNull() ?.let(block) +public inline fun TextSource.codeTextSourceOrNull(): CodeTextSource? = this as? + dev.inmo.tgbotapi.types.message.textsources.CodeTextSource + +public inline fun TextSource.codeTextSourceOrThrow(): CodeTextSource = this as + dev.inmo.tgbotapi.types.message.textsources.CodeTextSource + +public inline fun TextSource.ifCodeTextSource(block: (CodeTextSource) -> T): T? = + codeTextSourceOrNull() ?.let(block) + public inline fun TextSource.customEmojiTextSourceOrNull(): CustomEmojiTextSource? = this as? dev.inmo.tgbotapi.types.message.textsources.CustomEmojiTextSource @@ -1922,42 +3615,6 @@ public inline fun TextSource.phoneNumberTextSourceOrThrow(): PhoneNumberTextSour public inline fun TextSource.ifPhoneNumberTextSource(block: (PhoneNumberTextSource) -> T): T? = phoneNumberTextSourceOrNull() ?.let(block) -public inline fun TextSource.spoilerTextSourceOrNull(): SpoilerTextSource? = this as? - dev.inmo.tgbotapi.types.message.textsources.SpoilerTextSource - -public inline fun TextSource.spoilerTextSourceOrThrow(): SpoilerTextSource = this as - dev.inmo.tgbotapi.types.message.textsources.SpoilerTextSource - -public inline fun TextSource.ifSpoilerTextSource(block: (SpoilerTextSource) -> T): T? = - spoilerTextSourceOrNull() ?.let(block) - -public inline fun TextSource.strikethroughTextSourceOrNull(): StrikethroughTextSource? = this as? - dev.inmo.tgbotapi.types.message.textsources.StrikethroughTextSource - -public inline fun TextSource.strikethroughTextSourceOrThrow(): StrikethroughTextSource = this as - dev.inmo.tgbotapi.types.message.textsources.StrikethroughTextSource - -public inline fun TextSource.ifStrikethroughTextSource(block: (StrikethroughTextSource) -> T): - T? = strikethroughTextSourceOrNull() ?.let(block) - -public inline fun TextSource.textMentionTextSourceOrNull(): TextMentionTextSource? = this as? - dev.inmo.tgbotapi.types.message.textsources.TextMentionTextSource - -public inline fun TextSource.textMentionTextSourceOrThrow(): TextMentionTextSource = this as - dev.inmo.tgbotapi.types.message.textsources.TextMentionTextSource - -public inline fun TextSource.ifTextMentionTextSource(block: (TextMentionTextSource) -> T): T? = - textMentionTextSourceOrNull() ?.let(block) - -public inline fun TextSource.underlineTextSourceOrNull(): UnderlineTextSource? = this as? - dev.inmo.tgbotapi.types.message.textsources.UnderlineTextSource - -public inline fun TextSource.underlineTextSourceOrThrow(): UnderlineTextSource = this as - dev.inmo.tgbotapi.types.message.textsources.UnderlineTextSource - -public inline fun TextSource.ifUnderlineTextSource(block: (UnderlineTextSource) -> T): T? = - underlineTextSourceOrNull() ?.let(block) - public inline fun TextSource.preTextSourceOrNull(): PreTextSource? = this as? dev.inmo.tgbotapi.types.message.textsources.PreTextSource @@ -1976,6 +3633,24 @@ public inline fun TextSource.regularTextSourceOrThrow(): RegularTextSource = thi public inline fun TextSource.ifRegularTextSource(block: (RegularTextSource) -> T): T? = regularTextSourceOrNull() ?.let(block) +public inline fun TextSource.spoilerTextSourceOrNull(): SpoilerTextSource? = this as? + dev.inmo.tgbotapi.types.message.textsources.SpoilerTextSource + +public inline fun TextSource.spoilerTextSourceOrThrow(): SpoilerTextSource = this as + dev.inmo.tgbotapi.types.message.textsources.SpoilerTextSource + +public inline fun TextSource.ifSpoilerTextSource(block: (SpoilerTextSource) -> T): T? = + spoilerTextSourceOrNull() ?.let(block) + +public inline fun TextSource.strikethroughTextSourceOrNull(): StrikethroughTextSource? = this as? + dev.inmo.tgbotapi.types.message.textsources.StrikethroughTextSource + +public inline fun TextSource.strikethroughTextSourceOrThrow(): StrikethroughTextSource = this as + dev.inmo.tgbotapi.types.message.textsources.StrikethroughTextSource + +public inline fun TextSource.ifStrikethroughTextSource(block: (StrikethroughTextSource) -> T): + T? = strikethroughTextSourceOrNull() ?.let(block) + public inline fun TextSource.textLinkTextSourceOrNull(): TextLinkTextSource? = this as? dev.inmo.tgbotapi.types.message.textsources.TextLinkTextSource @@ -1985,6 +3660,24 @@ public inline fun TextSource.textLinkTextSourceOrThrow(): TextLinkTextSource = t public inline fun TextSource.ifTextLinkTextSource(block: (TextLinkTextSource) -> T): T? = textLinkTextSourceOrNull() ?.let(block) +public inline fun TextSource.textMentionTextSourceOrNull(): TextMentionTextSource? = this as? + dev.inmo.tgbotapi.types.message.textsources.TextMentionTextSource + +public inline fun TextSource.textMentionTextSourceOrThrow(): TextMentionTextSource = this as + dev.inmo.tgbotapi.types.message.textsources.TextMentionTextSource + +public inline fun TextSource.ifTextMentionTextSource(block: (TextMentionTextSource) -> T): T? = + textMentionTextSourceOrNull() ?.let(block) + +public inline fun TextSource.multilevelTextSourceOrNull(): MultilevelTextSource? = this as? + dev.inmo.tgbotapi.types.message.textsources.MultilevelTextSource + +public inline fun TextSource.multilevelTextSourceOrThrow(): MultilevelTextSource = this as + dev.inmo.tgbotapi.types.message.textsources.MultilevelTextSource + +public inline fun TextSource.ifMultilevelTextSource(block: (MultilevelTextSource) -> T): T? = + multilevelTextSourceOrNull() ?.let(block) + public inline fun TextSource.uRLTextSourceOrNull(): URLTextSource? = this as? dev.inmo.tgbotapi.types.message.textsources.URLTextSource @@ -1994,6 +3687,38 @@ public inline fun TextSource.uRLTextSourceOrThrow(): URLTextSource = this as public inline fun TextSource.ifURLTextSource(block: (URLTextSource) -> T): T? = uRLTextSourceOrNull() ?.let(block) +public inline fun TextSource.underlineTextSourceOrNull(): UnderlineTextSource? = this as? + dev.inmo.tgbotapi.types.message.textsources.UnderlineTextSource + +public inline fun TextSource.underlineTextSourceOrThrow(): UnderlineTextSource = this as + dev.inmo.tgbotapi.types.message.textsources.UnderlineTextSource + +public inline fun TextSource.ifUnderlineTextSource(block: (UnderlineTextSource) -> T): T? = + underlineTextSourceOrNull() ?.let(block) + +public inline fun PassportElementError.unknownPassportElementErrorOrNull(): + UnknownPassportElementError? = this as? + dev.inmo.tgbotapi.types.passport.UnknownPassportElementError + +public inline fun PassportElementError.unknownPassportElementErrorOrThrow(): + UnknownPassportElementError = this as + dev.inmo.tgbotapi.types.passport.UnknownPassportElementError + +public inline fun + PassportElementError.ifUnknownPassportElementError(block: (UnknownPassportElementError) -> T): + T? = unknownPassportElementErrorOrNull() ?.let(block) + +public inline fun PassportElementError.passportSingleElementErrorOrNull(): + PassportSingleElementError? = this as? + dev.inmo.tgbotapi.types.passport.PassportSingleElementError + +public inline fun PassportElementError.passportSingleElementErrorOrThrow(): + PassportSingleElementError = this as dev.inmo.tgbotapi.types.passport.PassportSingleElementError + +public inline fun + PassportElementError.ifPassportSingleElementError(block: (PassportSingleElementError) -> T): T? + = passportSingleElementErrorOrNull() ?.let(block) + public inline fun PassportElementError.passportMultipleElementsErrorOrNull(): PassportMultipleElementsError? = this as? dev.inmo.tgbotapi.types.passport.PassportMultipleElementsError @@ -2006,6 +3731,16 @@ public inline fun PassportElementError.ifPassportMultipleElementsError(block: (PassportMultipleElementsError) -> T): T? = passportMultipleElementsErrorOrNull() ?.let(block) +public inline fun PassportElementError.passportElementFileErrorOrNull(): PassportElementFileError? = + this as? dev.inmo.tgbotapi.types.passport.PassportElementFileError + +public inline fun PassportElementError.passportElementFileErrorOrThrow(): PassportElementFileError = + this as dev.inmo.tgbotapi.types.passport.PassportElementFileError + +public inline fun + PassportElementError.ifPassportElementFileError(block: (PassportElementFileError) -> T): T? = + passportElementFileErrorOrNull() ?.let(block) + public inline fun PassportElementError.passportElementFilesErrorOrNull(): PassportElementFilesError? = this as? dev.inmo.tgbotapi.types.passport.PassportElementFilesError @@ -2016,39 +3751,6 @@ public inline fun PassportElementError.ifPassportElementFilesError(block: (PassportElementFilesError) -> T): T? = passportElementFilesErrorOrNull() ?.let(block) -public inline fun PassportElementError.passportElementErrorFilesOrNull(): PassportElementErrorFiles? - = this as? dev.inmo.tgbotapi.types.passport.PassportElementErrorFiles - -public inline fun PassportElementError.passportElementErrorFilesOrThrow(): PassportElementErrorFiles - = this as dev.inmo.tgbotapi.types.passport.PassportElementErrorFiles - -public inline fun - PassportElementError.ifPassportElementErrorFiles(block: (PassportElementErrorFiles) -> T): T? = - passportElementErrorFilesOrNull() ?.let(block) - -public inline fun PassportElementError.passportElementErrorTranslationFilesOrNull(): - PassportElementErrorTranslationFiles? = this as? - dev.inmo.tgbotapi.types.passport.PassportElementErrorTranslationFiles - -public inline fun PassportElementError.passportElementErrorTranslationFilesOrThrow(): - PassportElementErrorTranslationFiles = this as - dev.inmo.tgbotapi.types.passport.PassportElementErrorTranslationFiles - -public inline fun - PassportElementError.ifPassportElementErrorTranslationFiles(block: (PassportElementErrorTranslationFiles) -> T): - T? = passportElementErrorTranslationFilesOrNull() ?.let(block) - -public inline fun PassportElementError.passportSingleElementErrorOrNull(): - PassportSingleElementError? = this as? - dev.inmo.tgbotapi.types.passport.PassportSingleElementError - -public inline fun PassportElementError.passportSingleElementErrorOrThrow(): - PassportSingleElementError = this as dev.inmo.tgbotapi.types.passport.PassportSingleElementError - -public inline fun - PassportElementError.ifPassportSingleElementError(block: (PassportSingleElementError) -> T): T? - = passportSingleElementErrorOrNull() ?.let(block) - public inline fun PassportElementError.passportElementErrorDataFieldOrNull(): PassportElementErrorDataField? = this as? dev.inmo.tgbotapi.types.passport.PassportElementErrorDataField @@ -2061,26 +3763,6 @@ public inline fun PassportElementError.ifPassportElementErrorDataField(block: (PassportElementErrorDataField) -> T): T? = passportElementErrorDataFieldOrNull() ?.let(block) -public inline fun PassportElementError.passportElementFileErrorOrNull(): PassportElementFileError? = - this as? dev.inmo.tgbotapi.types.passport.PassportElementFileError - -public inline fun PassportElementError.passportElementFileErrorOrThrow(): PassportElementFileError = - this as dev.inmo.tgbotapi.types.passport.PassportElementFileError - -public inline fun - PassportElementError.ifPassportElementFileError(block: (PassportElementFileError) -> T): T? = - passportElementFileErrorOrNull() ?.let(block) - -public inline fun PassportElementError.passportElementErrorFileOrNull(): PassportElementErrorFile? = - this as? dev.inmo.tgbotapi.types.passport.PassportElementErrorFile - -public inline fun PassportElementError.passportElementErrorFileOrThrow(): PassportElementErrorFile = - this as dev.inmo.tgbotapi.types.passport.PassportElementErrorFile - -public inline fun - PassportElementError.ifPassportElementErrorFile(block: (PassportElementErrorFile) -> T): T? = - passportElementErrorFileOrNull() ?.let(block) - public inline fun PassportElementError.passportElementErrorFrontSideOrNull(): PassportElementErrorFrontSide? = this as? dev.inmo.tgbotapi.types.passport.PassportElementErrorFrontSide @@ -2116,6 +3798,26 @@ public inline fun PassportElementError.ifPassportElementErrorSelfie(block: (PassportElementErrorSelfie) -> T): T? = passportElementErrorSelfieOrNull() ?.let(block) +public inline fun PassportElementError.passportElementErrorFileOrNull(): PassportElementErrorFile? = + this as? dev.inmo.tgbotapi.types.passport.PassportElementErrorFile + +public inline fun PassportElementError.passportElementErrorFileOrThrow(): PassportElementErrorFile = + this as dev.inmo.tgbotapi.types.passport.PassportElementErrorFile + +public inline fun + PassportElementError.ifPassportElementErrorFile(block: (PassportElementErrorFile) -> T): T? = + passportElementErrorFileOrNull() ?.let(block) + +public inline fun PassportElementError.passportElementErrorFilesOrNull(): PassportElementErrorFiles? + = this as? dev.inmo.tgbotapi.types.passport.PassportElementErrorFiles + +public inline fun PassportElementError.passportElementErrorFilesOrThrow(): PassportElementErrorFiles + = this as dev.inmo.tgbotapi.types.passport.PassportElementErrorFiles + +public inline fun + PassportElementError.ifPassportElementErrorFiles(block: (PassportElementErrorFiles) -> T): T? = + passportElementErrorFilesOrNull() ?.let(block) + public inline fun PassportElementError.passportElementErrorTranslationFileOrNull(): PassportElementErrorTranslationFile? = this as? dev.inmo.tgbotapi.types.passport.PassportElementErrorTranslationFile @@ -2128,6 +3830,18 @@ public inline fun PassportElementError.ifPassportElementErrorTranslationFile(block: (PassportElementErrorTranslationFile) -> T): T? = passportElementErrorTranslationFileOrNull() ?.let(block) +public inline fun PassportElementError.passportElementErrorTranslationFilesOrNull(): + PassportElementErrorTranslationFiles? = this as? + dev.inmo.tgbotapi.types.passport.PassportElementErrorTranslationFiles + +public inline fun PassportElementError.passportElementErrorTranslationFilesOrThrow(): + PassportElementErrorTranslationFiles = this as + dev.inmo.tgbotapi.types.passport.PassportElementErrorTranslationFiles + +public inline fun + PassportElementError.ifPassportElementErrorTranslationFiles(block: (PassportElementErrorTranslationFiles) -> T): + T? = passportElementErrorTranslationFilesOrNull() ?.let(block) + public inline fun PassportElementError.passportElementErrorUnspecifiedOrNull(): PassportElementErrorUnspecified? = this as? dev.inmo.tgbotapi.types.passport.PassportElementErrorUnspecified @@ -2140,17 +3854,471 @@ public inline fun PassportElementError.ifPassportElementErrorUnspecified(block: (PassportElementErrorUnspecified) -> T): T? = passportElementErrorUnspecifiedOrNull() ?.let(block) -public inline fun PassportElementError.unknownPassportElementErrorOrNull(): - UnknownPassportElementError? = this as? - dev.inmo.tgbotapi.types.passport.UnknownPassportElementError +public inline fun SecureValue.addressSecureValueOrNull(): AddressSecureValue? = this as? + dev.inmo.tgbotapi.types.passport.decrypted.AddressSecureValue -public inline fun PassportElementError.unknownPassportElementErrorOrThrow(): - UnknownPassportElementError = this as - dev.inmo.tgbotapi.types.passport.UnknownPassportElementError +public inline fun SecureValue.addressSecureValueOrThrow(): AddressSecureValue = this as + dev.inmo.tgbotapi.types.passport.decrypted.AddressSecureValue + +public inline fun SecureValue.ifAddressSecureValue(block: (AddressSecureValue) -> T): T? = + addressSecureValueOrNull() ?.let(block) + +public inline fun SecureValue.identityWithReverseSideSecureValueOrNull(): + IdentityWithReverseSideSecureValue? = this as? + dev.inmo.tgbotapi.types.passport.decrypted.IdentityWithReverseSideSecureValue + +public inline fun SecureValue.identityWithReverseSideSecureValueOrThrow(): + IdentityWithReverseSideSecureValue = this as + dev.inmo.tgbotapi.types.passport.decrypted.IdentityWithReverseSideSecureValue public inline fun - PassportElementError.ifUnknownPassportElementError(block: (UnknownPassportElementError) -> T): - T? = unknownPassportElementErrorOrNull() ?.let(block) + SecureValue.ifIdentityWithReverseSideSecureValue(block: (IdentityWithReverseSideSecureValue) -> T): + T? = identityWithReverseSideSecureValueOrNull() ?.let(block) + +public inline fun SecureValue.driverLicenseSecureValueOrNull(): DriverLicenseSecureValue? = this as? + dev.inmo.tgbotapi.types.passport.decrypted.DriverLicenseSecureValue + +public inline fun SecureValue.driverLicenseSecureValueOrThrow(): DriverLicenseSecureValue = this as + dev.inmo.tgbotapi.types.passport.decrypted.DriverLicenseSecureValue + +public inline fun + SecureValue.ifDriverLicenseSecureValue(block: (DriverLicenseSecureValue) -> T): T? = + driverLicenseSecureValueOrNull() ?.let(block) + +public inline fun SecureValue.identityCardSecureValueOrNull(): IdentityCardSecureValue? = this as? + dev.inmo.tgbotapi.types.passport.decrypted.IdentityCardSecureValue + +public inline fun SecureValue.identityCardSecureValueOrThrow(): IdentityCardSecureValue = this as + dev.inmo.tgbotapi.types.passport.decrypted.IdentityCardSecureValue + +public inline fun SecureValue.ifIdentityCardSecureValue(block: (IdentityCardSecureValue) -> T): + T? = identityCardSecureValueOrNull() ?.let(block) + +public inline fun SecureValue.otherDocumentsSecureValueOrNull(): OtherDocumentsSecureValue? = this + as? dev.inmo.tgbotapi.types.passport.decrypted.OtherDocumentsSecureValue + +public inline fun SecureValue.otherDocumentsSecureValueOrThrow(): OtherDocumentsSecureValue = this + as dev.inmo.tgbotapi.types.passport.decrypted.OtherDocumentsSecureValue + +public inline fun + SecureValue.ifOtherDocumentsSecureValue(block: (OtherDocumentsSecureValue) -> T): T? = + otherDocumentsSecureValueOrNull() ?.let(block) + +public inline fun SecureValue.utilityBillSecureValueOrNull(): UtilityBillSecureValue? = this as? + dev.inmo.tgbotapi.types.passport.decrypted.UtilityBillSecureValue + +public inline fun SecureValue.utilityBillSecureValueOrThrow(): UtilityBillSecureValue = this as + dev.inmo.tgbotapi.types.passport.decrypted.UtilityBillSecureValue + +public inline fun SecureValue.ifUtilityBillSecureValue(block: (UtilityBillSecureValue) -> T): T? + = utilityBillSecureValueOrNull() ?.let(block) + +public inline fun SecureValue.bankStatementSecureValueOrNull(): BankStatementSecureValue? = this as? + dev.inmo.tgbotapi.types.passport.decrypted.BankStatementSecureValue + +public inline fun SecureValue.bankStatementSecureValueOrThrow(): BankStatementSecureValue = this as + dev.inmo.tgbotapi.types.passport.decrypted.BankStatementSecureValue + +public inline fun + SecureValue.ifBankStatementSecureValue(block: (BankStatementSecureValue) -> T): T? = + bankStatementSecureValueOrNull() ?.let(block) + +public inline fun SecureValue.rentalAgreementSecureValueOrNull(): RentalAgreementSecureValue? = this + as? dev.inmo.tgbotapi.types.passport.decrypted.RentalAgreementSecureValue + +public inline fun SecureValue.rentalAgreementSecureValueOrThrow(): RentalAgreementSecureValue = this + as dev.inmo.tgbotapi.types.passport.decrypted.RentalAgreementSecureValue + +public inline fun + SecureValue.ifRentalAgreementSecureValue(block: (RentalAgreementSecureValue) -> T): T? = + rentalAgreementSecureValueOrNull() ?.let(block) + +public inline fun SecureValue.passportRegistrationSecureValueOrNull(): + PassportRegistrationSecureValue? = this as? + dev.inmo.tgbotapi.types.passport.decrypted.PassportRegistrationSecureValue + +public inline fun SecureValue.passportRegistrationSecureValueOrThrow(): + PassportRegistrationSecureValue = this as + dev.inmo.tgbotapi.types.passport.decrypted.PassportRegistrationSecureValue + +public inline fun + SecureValue.ifPassportRegistrationSecureValue(block: (PassportRegistrationSecureValue) -> T): T? + = passportRegistrationSecureValueOrNull() ?.let(block) + +public inline fun SecureValue.temporalRegistrationSecureValueOrNull(): + TemporalRegistrationSecureValue? = this as? + dev.inmo.tgbotapi.types.passport.decrypted.TemporalRegistrationSecureValue + +public inline fun SecureValue.temporalRegistrationSecureValueOrThrow(): + TemporalRegistrationSecureValue = this as + dev.inmo.tgbotapi.types.passport.decrypted.TemporalRegistrationSecureValue + +public inline fun + SecureValue.ifTemporalRegistrationSecureValue(block: (TemporalRegistrationSecureValue) -> T): T? + = temporalRegistrationSecureValueOrNull() ?.let(block) + +public inline fun SecureValue.passportSecureValueOrNull(): PassportSecureValue? = this as? + dev.inmo.tgbotapi.types.passport.decrypted.PassportSecureValue + +public inline fun SecureValue.passportSecureValueOrThrow(): PassportSecureValue = this as + dev.inmo.tgbotapi.types.passport.decrypted.PassportSecureValue + +public inline fun SecureValue.ifPassportSecureValue(block: (PassportSecureValue) -> T): T? = + passportSecureValueOrNull() ?.let(block) + +public inline fun SecureValue.commonPassportSecureValueOrNull(): CommonPassportSecureValue? = this + as? dev.inmo.tgbotapi.types.passport.decrypted.CommonPassportSecureValue + +public inline fun SecureValue.commonPassportSecureValueOrThrow(): CommonPassportSecureValue = this + as dev.inmo.tgbotapi.types.passport.decrypted.CommonPassportSecureValue + +public inline fun + SecureValue.ifCommonPassportSecureValue(block: (CommonPassportSecureValue) -> T): T? = + commonPassportSecureValueOrNull() ?.let(block) + +public inline fun SecureValue.internalPassportSecureValueOrNull(): InternalPassportSecureValue? = + this as? dev.inmo.tgbotapi.types.passport.decrypted.InternalPassportSecureValue + +public inline fun SecureValue.internalPassportSecureValueOrThrow(): InternalPassportSecureValue = + this as dev.inmo.tgbotapi.types.passport.decrypted.InternalPassportSecureValue + +public inline fun + SecureValue.ifInternalPassportSecureValue(block: (InternalPassportSecureValue) -> T): T? = + internalPassportSecureValueOrNull() ?.let(block) + +public inline fun SecureValue.personalDetailsSecureValueOrNull(): PersonalDetailsSecureValue? = this + as? dev.inmo.tgbotapi.types.passport.decrypted.PersonalDetailsSecureValue + +public inline fun SecureValue.personalDetailsSecureValueOrThrow(): PersonalDetailsSecureValue = this + as dev.inmo.tgbotapi.types.passport.decrypted.PersonalDetailsSecureValue + +public inline fun + SecureValue.ifPersonalDetailsSecureValue(block: (PersonalDetailsSecureValue) -> T): T? = + personalDetailsSecureValueOrNull() ?.let(block) + +public inline fun SecureValue.secureValueIdentityOrNull(): SecureValueIdentity? = this as? + dev.inmo.tgbotapi.types.passport.decrypted.abstracts.SecureValueIdentity + +public inline fun SecureValue.secureValueIdentityOrThrow(): SecureValueIdentity = this as + dev.inmo.tgbotapi.types.passport.decrypted.abstracts.SecureValueIdentity + +public inline fun SecureValue.ifSecureValueIdentity(block: (SecureValueIdentity) -> T): T? = + secureValueIdentityOrNull() ?.let(block) + +public inline fun SecureValue.secureValueWithDataOrNull(): SecureValueWithData? = this as? + dev.inmo.tgbotapi.types.passport.decrypted.abstracts.SecureValueWithData + +public inline fun SecureValue.secureValueWithDataOrThrow(): SecureValueWithData = this as + dev.inmo.tgbotapi.types.passport.decrypted.abstracts.SecureValueWithData + +public inline fun SecureValue.ifSecureValueWithData(block: (SecureValueWithData) -> T): T? = + secureValueWithDataOrNull() ?.let(block) + +public inline fun SecureValue.secureValueWithFilesOrNull(): SecureValueWithFiles? = this as? + dev.inmo.tgbotapi.types.passport.decrypted.abstracts.SecureValueWithFiles + +public inline fun SecureValue.secureValueWithFilesOrThrow(): SecureValueWithFiles = this as + dev.inmo.tgbotapi.types.passport.decrypted.abstracts.SecureValueWithFiles + +public inline fun SecureValue.ifSecureValueWithFiles(block: (SecureValueWithFiles) -> T): T? = + secureValueWithFilesOrNull() ?.let(block) + +public inline fun SecureValue.secureValueWithReverseSideOrNull(): SecureValueWithReverseSide? = this + as? dev.inmo.tgbotapi.types.passport.decrypted.abstracts.SecureValueWithReverseSide + +public inline fun SecureValue.secureValueWithReverseSideOrThrow(): SecureValueWithReverseSide = this + as dev.inmo.tgbotapi.types.passport.decrypted.abstracts.SecureValueWithReverseSide + +public inline fun + SecureValue.ifSecureValueWithReverseSide(block: (SecureValueWithReverseSide) -> T): T? = + secureValueWithReverseSideOrNull() ?.let(block) + +public inline fun SecureValue.secureValueWithTranslationsOrNull(): SecureValueWithTranslations? = + this as? dev.inmo.tgbotapi.types.passport.decrypted.abstracts.SecureValueWithTranslations + +public inline fun SecureValue.secureValueWithTranslationsOrThrow(): SecureValueWithTranslations = + this as dev.inmo.tgbotapi.types.passport.decrypted.abstracts.SecureValueWithTranslations + +public inline fun + SecureValue.ifSecureValueWithTranslations(block: (SecureValueWithTranslations) -> T): T? = + secureValueWithTranslationsOrNull() ?.let(block) + +public inline fun EncryptedPassportElement.emailOrNull(): Email? = this as? + dev.inmo.tgbotapi.types.passport.encrypted.Email + +public inline fun EncryptedPassportElement.emailOrThrow(): Email = this as + dev.inmo.tgbotapi.types.passport.encrypted.Email + +public inline fun EncryptedPassportElement.ifEmail(block: (Email) -> T): T? = emailOrNull() + ?.let(block) + +public inline fun EncryptedPassportElement.encryptedAddressOrNull(): EncryptedAddress? = this as? + dev.inmo.tgbotapi.types.passport.encrypted.EncryptedAddress + +public inline fun EncryptedPassportElement.encryptedAddressOrThrow(): EncryptedAddress = this as + dev.inmo.tgbotapi.types.passport.encrypted.EncryptedAddress + +public inline fun EncryptedPassportElement.ifEncryptedAddress(block: (EncryptedAddress) -> T): + T? = encryptedAddressOrNull() ?.let(block) + +public inline + fun EncryptedPassportElement.encryptedPassportElementWithTranslatableFilesCollectionOrNull(): + EncryptedPassportElementWithTranslatableFilesCollection? = this as? + dev.inmo.tgbotapi.types.passport.encrypted.EncryptedPassportElementWithTranslatableFilesCollection + +public inline + fun EncryptedPassportElement.encryptedPassportElementWithTranslatableFilesCollectionOrThrow(): + EncryptedPassportElementWithTranslatableFilesCollection = this as + dev.inmo.tgbotapi.types.passport.encrypted.EncryptedPassportElementWithTranslatableFilesCollection + +public inline fun + EncryptedPassportElement.ifEncryptedPassportElementWithTranslatableFilesCollection(block: (EncryptedPassportElementWithTranslatableFilesCollection) -> T): + T? = encryptedPassportElementWithTranslatableFilesCollectionOrNull() ?.let(block) + +public inline fun EncryptedPassportElement.utilityBillOrNull(): UtilityBill? = this as? + dev.inmo.tgbotapi.types.passport.encrypted.UtilityBill + +public inline fun EncryptedPassportElement.utilityBillOrThrow(): UtilityBill = this as + dev.inmo.tgbotapi.types.passport.encrypted.UtilityBill + +public inline fun EncryptedPassportElement.ifUtilityBill(block: (UtilityBill) -> T): T? = + utilityBillOrNull() ?.let(block) + +public inline fun EncryptedPassportElement.bankStatementOrNull(): BankStatement? = this as? + dev.inmo.tgbotapi.types.passport.encrypted.BankStatement + +public inline fun EncryptedPassportElement.bankStatementOrThrow(): BankStatement = this as + dev.inmo.tgbotapi.types.passport.encrypted.BankStatement + +public inline fun EncryptedPassportElement.ifBankStatement(block: (BankStatement) -> T): T? = + bankStatementOrNull() ?.let(block) + +public inline fun EncryptedPassportElement.rentalAgreementOrNull(): RentalAgreement? = this as? + dev.inmo.tgbotapi.types.passport.encrypted.RentalAgreement + +public inline fun EncryptedPassportElement.rentalAgreementOrThrow(): RentalAgreement = this as + dev.inmo.tgbotapi.types.passport.encrypted.RentalAgreement + +public inline fun EncryptedPassportElement.ifRentalAgreement(block: (RentalAgreement) -> T): T? + = rentalAgreementOrNull() ?.let(block) + +public inline fun EncryptedPassportElement.passportRegistrationOrNull(): PassportRegistration? = + this as? dev.inmo.tgbotapi.types.passport.encrypted.PassportRegistration + +public inline fun EncryptedPassportElement.passportRegistrationOrThrow(): PassportRegistration = + this as dev.inmo.tgbotapi.types.passport.encrypted.PassportRegistration + +public inline fun + EncryptedPassportElement.ifPassportRegistration(block: (PassportRegistration) -> T): T? = + passportRegistrationOrNull() ?.let(block) + +public inline fun EncryptedPassportElement.temporaryRegistrationOrNull(): TemporaryRegistration? = + this as? dev.inmo.tgbotapi.types.passport.encrypted.TemporaryRegistration + +public inline fun EncryptedPassportElement.temporaryRegistrationOrThrow(): TemporaryRegistration = + this as dev.inmo.tgbotapi.types.passport.encrypted.TemporaryRegistration + +public inline fun + EncryptedPassportElement.ifTemporaryRegistration(block: (TemporaryRegistration) -> T): T? = + temporaryRegistrationOrNull() ?.let(block) + +public inline + fun EncryptedPassportElement.encryptedPassportElementWithTranslatableIDDocumentOrNull(): + EncryptedPassportElementWithTranslatableIDDocument? = this as? + dev.inmo.tgbotapi.types.passport.encrypted.EncryptedPassportElementWithTranslatableIDDocument + +public inline + fun EncryptedPassportElement.encryptedPassportElementWithTranslatableIDDocumentOrThrow(): + EncryptedPassportElementWithTranslatableIDDocument = this as + dev.inmo.tgbotapi.types.passport.encrypted.EncryptedPassportElementWithTranslatableIDDocument + +public inline fun + EncryptedPassportElement.ifEncryptedPassportElementWithTranslatableIDDocument(block: (EncryptedPassportElementWithTranslatableIDDocument) -> T): + T? = encryptedPassportElementWithTranslatableIDDocumentOrNull() ?.let(block) + +public inline fun EncryptedPassportElement.driverLicenseOrNull(): DriverLicense? = this as? + dev.inmo.tgbotapi.types.passport.encrypted.DriverLicense + +public inline fun EncryptedPassportElement.driverLicenseOrThrow(): DriverLicense = this as + dev.inmo.tgbotapi.types.passport.encrypted.DriverLicense + +public inline fun EncryptedPassportElement.ifDriverLicense(block: (DriverLicense) -> T): T? = + driverLicenseOrNull() ?.let(block) + +public inline fun EncryptedPassportElement.identityCardOrNull(): IdentityCard? = this as? + dev.inmo.tgbotapi.types.passport.encrypted.IdentityCard + +public inline fun EncryptedPassportElement.identityCardOrThrow(): IdentityCard = this as + dev.inmo.tgbotapi.types.passport.encrypted.IdentityCard + +public inline fun EncryptedPassportElement.ifIdentityCard(block: (IdentityCard) -> T): T? = + identityCardOrNull() ?.let(block) + +public inline fun EncryptedPassportElement.encryptedPersonalDetailsOrNull(): + EncryptedPersonalDetails? = this as? + dev.inmo.tgbotapi.types.passport.encrypted.EncryptedPersonalDetails + +public inline fun EncryptedPassportElement.encryptedPersonalDetailsOrThrow(): + EncryptedPersonalDetails = this as + dev.inmo.tgbotapi.types.passport.encrypted.EncryptedPersonalDetails + +public inline fun + EncryptedPassportElement.ifEncryptedPersonalDetails(block: (EncryptedPersonalDetails) -> T): T? + = encryptedPersonalDetailsOrNull() ?.let(block) + +public inline fun EncryptedPassportElement.passportOrNull(): Passport? = this as? + dev.inmo.tgbotapi.types.passport.encrypted.Passport + +public inline fun EncryptedPassportElement.passportOrThrow(): Passport = this as + dev.inmo.tgbotapi.types.passport.encrypted.Passport + +public inline fun EncryptedPassportElement.ifPassport(block: (Passport) -> T): T? = + passportOrNull() ?.let(block) + +public inline fun EncryptedPassportElement.commonPassportOrNull(): CommonPassport? = this as? + dev.inmo.tgbotapi.types.passport.encrypted.CommonPassport + +public inline fun EncryptedPassportElement.commonPassportOrThrow(): CommonPassport = this as + dev.inmo.tgbotapi.types.passport.encrypted.CommonPassport + +public inline fun EncryptedPassportElement.ifCommonPassport(block: (CommonPassport) -> T): T? = + commonPassportOrNull() ?.let(block) + +public inline fun EncryptedPassportElement.internalPassportOrNull(): InternalPassport? = this as? + dev.inmo.tgbotapi.types.passport.encrypted.InternalPassport + +public inline fun EncryptedPassportElement.internalPassportOrThrow(): InternalPassport = this as + dev.inmo.tgbotapi.types.passport.encrypted.InternalPassport + +public inline fun EncryptedPassportElement.ifInternalPassport(block: (InternalPassport) -> T): + T? = internalPassportOrNull() ?.let(block) + +public inline fun EncryptedPassportElement.phoneNumberOrNull(): PhoneNumber? = this as? + dev.inmo.tgbotapi.types.passport.encrypted.PhoneNumber + +public inline fun EncryptedPassportElement.phoneNumberOrThrow(): PhoneNumber = this as + dev.inmo.tgbotapi.types.passport.encrypted.PhoneNumber + +public inline fun EncryptedPassportElement.ifPhoneNumber(block: (PhoneNumber) -> T): T? = + phoneNumberOrNull() ?.let(block) + +public inline fun EncryptedPassportElement.unknownEncryptedPassportElementOrNull(): + UnknownEncryptedPassportElement? = this as? + dev.inmo.tgbotapi.types.passport.encrypted.abstracts.UnknownEncryptedPassportElement + +public inline fun EncryptedPassportElement.unknownEncryptedPassportElementOrThrow(): + UnknownEncryptedPassportElement = this as + dev.inmo.tgbotapi.types.passport.encrypted.abstracts.UnknownEncryptedPassportElement + +public inline fun + EncryptedPassportElement.ifUnknownEncryptedPassportElement(block: (UnknownEncryptedPassportElement) -> T): + T? = unknownEncryptedPassportElementOrNull() ?.let(block) + +public inline fun EncryptedPassportElement.encryptedPassportElementTranslatableOrNull(): + EncryptedPassportElementTranslatable? = this as? + dev.inmo.tgbotapi.types.passport.encrypted.abstracts.EncryptedPassportElementTranslatable + +public inline fun EncryptedPassportElement.encryptedPassportElementTranslatableOrThrow(): + EncryptedPassportElementTranslatable = this as + dev.inmo.tgbotapi.types.passport.encrypted.abstracts.EncryptedPassportElementTranslatable + +public inline fun + EncryptedPassportElement.ifEncryptedPassportElementTranslatable(block: (EncryptedPassportElementTranslatable) -> T): + T? = encryptedPassportElementTranslatableOrNull() ?.let(block) + +public inline fun EncryptedPassportElement.encryptedPassportElementWithDataOrNull(): + EncryptedPassportElementWithData? = this as? + dev.inmo.tgbotapi.types.passport.encrypted.abstracts.EncryptedPassportElementWithData + +public inline fun EncryptedPassportElement.encryptedPassportElementWithDataOrThrow(): + EncryptedPassportElementWithData = this as + dev.inmo.tgbotapi.types.passport.encrypted.abstracts.EncryptedPassportElementWithData + +public inline fun + EncryptedPassportElement.ifEncryptedPassportElementWithData(block: (EncryptedPassportElementWithData) -> T): + T? = encryptedPassportElementWithDataOrNull() ?.let(block) + +public inline fun EncryptedPassportElement.encryptedPassportElementWithEmailOrNull(): + EncryptedPassportElementWithEmail? = this as? + dev.inmo.tgbotapi.types.passport.encrypted.abstracts.EncryptedPassportElementWithEmail + +public inline fun EncryptedPassportElement.encryptedPassportElementWithEmailOrThrow(): + EncryptedPassportElementWithEmail = this as + dev.inmo.tgbotapi.types.passport.encrypted.abstracts.EncryptedPassportElementWithEmail + +public inline fun + EncryptedPassportElement.ifEncryptedPassportElementWithEmail(block: (EncryptedPassportElementWithEmail) -> T): + T? = encryptedPassportElementWithEmailOrNull() ?.let(block) + +public inline fun EncryptedPassportElement.encryptedPassportElementWithFilesCollectionOrNull(): + EncryptedPassportElementWithFilesCollection? = this as? + dev.inmo.tgbotapi.types.passport.encrypted.abstracts.EncryptedPassportElementWithFilesCollection + +public inline fun EncryptedPassportElement.encryptedPassportElementWithFilesCollectionOrThrow(): + EncryptedPassportElementWithFilesCollection = this as + dev.inmo.tgbotapi.types.passport.encrypted.abstracts.EncryptedPassportElementWithFilesCollection + +public inline fun + EncryptedPassportElement.ifEncryptedPassportElementWithFilesCollection(block: (EncryptedPassportElementWithFilesCollection) -> T): + T? = encryptedPassportElementWithFilesCollectionOrNull() ?.let(block) + +public inline fun EncryptedPassportElement.encryptedPassportElementWithFrontSideOrNull(): + EncryptedPassportElementWithFrontSide? = this as? + dev.inmo.tgbotapi.types.passport.encrypted.abstracts.EncryptedPassportElementWithFrontSide + +public inline fun EncryptedPassportElement.encryptedPassportElementWithFrontSideOrThrow(): + EncryptedPassportElementWithFrontSide = this as + dev.inmo.tgbotapi.types.passport.encrypted.abstracts.EncryptedPassportElementWithFrontSide + +public inline fun + EncryptedPassportElement.ifEncryptedPassportElementWithFrontSide(block: (EncryptedPassportElementWithFrontSide) -> T): + T? = encryptedPassportElementWithFrontSideOrNull() ?.let(block) + +public inline fun EncryptedPassportElement.encryptedPassportElementWithPhoneNumberOrNull(): + EncryptedPassportElementWithPhoneNumber? = this as? + dev.inmo.tgbotapi.types.passport.encrypted.abstracts.EncryptedPassportElementWithPhoneNumber + +public inline fun EncryptedPassportElement.encryptedPassportElementWithPhoneNumberOrThrow(): + EncryptedPassportElementWithPhoneNumber = this as + dev.inmo.tgbotapi.types.passport.encrypted.abstracts.EncryptedPassportElementWithPhoneNumber + +public inline fun + EncryptedPassportElement.ifEncryptedPassportElementWithPhoneNumber(block: (EncryptedPassportElementWithPhoneNumber) -> T): + T? = encryptedPassportElementWithPhoneNumberOrNull() ?.let(block) + +public inline fun EncryptedPassportElement.encryptedPassportElementWithReverseSideOrNull(): + EncryptedPassportElementWithReverseSide? = this as? + dev.inmo.tgbotapi.types.passport.encrypted.abstracts.EncryptedPassportElementWithReverseSide + +public inline fun EncryptedPassportElement.encryptedPassportElementWithReverseSideOrThrow(): + EncryptedPassportElementWithReverseSide = this as + dev.inmo.tgbotapi.types.passport.encrypted.abstracts.EncryptedPassportElementWithReverseSide + +public inline fun + EncryptedPassportElement.ifEncryptedPassportElementWithReverseSide(block: (EncryptedPassportElementWithReverseSide) -> T): + T? = encryptedPassportElementWithReverseSideOrNull() ?.let(block) + +public inline fun EncryptedPassportElement.encryptedPassportElementWithSelfieOrNull(): + EncryptedPassportElementWithSelfie? = this as? + dev.inmo.tgbotapi.types.passport.encrypted.abstracts.EncryptedPassportElementWithSelfie + +public inline fun EncryptedPassportElement.encryptedPassportElementWithSelfieOrThrow(): + EncryptedPassportElementWithSelfie = this as + dev.inmo.tgbotapi.types.passport.encrypted.abstracts.EncryptedPassportElementWithSelfie + +public inline fun + EncryptedPassportElement.ifEncryptedPassportElementWithSelfie(block: (EncryptedPassportElementWithSelfie) -> T): + T? = encryptedPassportElementWithSelfieOrNull() ?.let(block) + +public inline fun ScheduledCloseInfo.exactScheduledCloseInfoOrNull(): ExactScheduledCloseInfo? = + this as? dev.inmo.tgbotapi.types.polls.ExactScheduledCloseInfo + +public inline fun ScheduledCloseInfo.exactScheduledCloseInfoOrThrow(): ExactScheduledCloseInfo = + this as dev.inmo.tgbotapi.types.polls.ExactScheduledCloseInfo + +public inline fun + ScheduledCloseInfo.ifExactScheduledCloseInfo(block: (ExactScheduledCloseInfo) -> T): T? = + exactScheduledCloseInfoOrNull() ?.let(block) public inline fun ScheduledCloseInfo.approximateScheduledCloseInfoOrNull(): ApproximateScheduledCloseInfo? = this as? @@ -2164,16 +4332,6 @@ public inline fun ScheduledCloseInfo.ifApproximateScheduledCloseInfo(block: (ApproximateScheduledCloseInfo) -> T): T? = approximateScheduledCloseInfoOrNull() ?.let(block) -public inline fun ScheduledCloseInfo.exactScheduledCloseInfoOrNull(): ExactScheduledCloseInfo? = - this as? dev.inmo.tgbotapi.types.polls.ExactScheduledCloseInfo - -public inline fun ScheduledCloseInfo.exactScheduledCloseInfoOrThrow(): ExactScheduledCloseInfo = - this as dev.inmo.tgbotapi.types.polls.ExactScheduledCloseInfo - -public inline fun - ScheduledCloseInfo.ifExactScheduledCloseInfo(block: (ExactScheduledCloseInfo) -> T): T? = - exactScheduledCloseInfoOrNull() ?.let(block) - public inline fun Poll.multipleAnswersPollOrNull(): MultipleAnswersPoll? = this as? dev.inmo.tgbotapi.types.polls.MultipleAnswersPoll @@ -2183,6 +4341,15 @@ public inline fun Poll.multipleAnswersPollOrThrow(): MultipleAnswersPoll = this public inline fun Poll.ifMultipleAnswersPoll(block: (MultipleAnswersPoll) -> T): T? = multipleAnswersPollOrNull() ?.let(block) +public inline fun Poll.unknownPollTypeOrNull(): UnknownPollType? = this as? + dev.inmo.tgbotapi.types.polls.UnknownPollType + +public inline fun Poll.unknownPollTypeOrThrow(): UnknownPollType = this as + dev.inmo.tgbotapi.types.polls.UnknownPollType + +public inline fun Poll.ifUnknownPollType(block: (UnknownPollType) -> T): T? = + unknownPollTypeOrNull() ?.let(block) + public inline fun Poll.regularPollOrNull(): RegularPoll? = this as? dev.inmo.tgbotapi.types.polls.RegularPoll @@ -2198,14 +4365,14 @@ public inline fun Poll.quizPollOrThrow(): QuizPoll = this as dev.inmo.tgbotapi.t public inline fun Poll.ifQuizPoll(block: (QuizPoll) -> T): T? = quizPollOrNull() ?.let(block) -public inline fun Poll.unknownPollTypeOrNull(): UnknownPollType? = this as? - dev.inmo.tgbotapi.types.polls.UnknownPollType +public inline fun RequestResponse.chatSharedOrNull(): ChatShared? = this as? + dev.inmo.tgbotapi.types.request.ChatShared -public inline fun Poll.unknownPollTypeOrThrow(): UnknownPollType = this as - dev.inmo.tgbotapi.types.polls.UnknownPollType +public inline fun RequestResponse.chatSharedOrThrow(): ChatShared = this as + dev.inmo.tgbotapi.types.request.ChatShared -public inline fun Poll.ifUnknownPollType(block: (UnknownPollType) -> T): T? = - unknownPollTypeOrNull() ?.let(block) +public inline fun RequestResponse.ifChatShared(block: (ChatShared) -> T): T? = + chatSharedOrNull() ?.let(block) public inline fun RequestResponse.chatSharedRequestOrNull(): ChatSharedRequest? = this as? dev.inmo.tgbotapi.types.request.ChatSharedRequest @@ -2216,15 +4383,6 @@ public inline fun RequestResponse.chatSharedRequestOrThrow(): ChatSharedRequest public inline fun RequestResponse.ifChatSharedRequest(block: (ChatSharedRequest) -> T): T? = chatSharedRequestOrNull() ?.let(block) -public inline fun RequestResponse.chatSharedOrNull(): ChatShared? = this as? - dev.inmo.tgbotapi.types.request.ChatShared - -public inline fun RequestResponse.chatSharedOrThrow(): ChatShared = this as - dev.inmo.tgbotapi.types.request.ChatShared - -public inline fun RequestResponse.ifChatShared(block: (ChatShared) -> T): T? = - chatSharedOrNull() ?.let(block) - public inline fun RequestResponse.userSharedOrNull(): UserShared? = this as? dev.inmo.tgbotapi.types.request.UserShared @@ -2233,3 +4391,175 @@ public inline fun RequestResponse.userSharedOrThrow(): UserShared = this as public inline fun RequestResponse.ifUserShared(block: (UserShared) -> T): T? = userSharedOrNull() ?.let(block) + +public inline fun Update.callbackQueryUpdateOrNull(): CallbackQueryUpdate? = this as? + dev.inmo.tgbotapi.types.update.CallbackQueryUpdate + +public inline fun Update.callbackQueryUpdateOrThrow(): CallbackQueryUpdate = this as + dev.inmo.tgbotapi.types.update.CallbackQueryUpdate + +public inline fun Update.ifCallbackQueryUpdate(block: (CallbackQueryUpdate) -> T): T? = + callbackQueryUpdateOrNull() ?.let(block) + +public inline fun Update.channelPostUpdateOrNull(): ChannelPostUpdate? = this as? + dev.inmo.tgbotapi.types.update.ChannelPostUpdate + +public inline fun Update.channelPostUpdateOrThrow(): ChannelPostUpdate = this as + dev.inmo.tgbotapi.types.update.ChannelPostUpdate + +public inline fun Update.ifChannelPostUpdate(block: (ChannelPostUpdate) -> T): T? = + channelPostUpdateOrNull() ?.let(block) + +public inline fun Update.chatJoinRequestUpdateOrNull(): ChatJoinRequestUpdate? = this as? + dev.inmo.tgbotapi.types.update.ChatJoinRequestUpdate + +public inline fun Update.chatJoinRequestUpdateOrThrow(): ChatJoinRequestUpdate = this as + dev.inmo.tgbotapi.types.update.ChatJoinRequestUpdate + +public inline fun Update.ifChatJoinRequestUpdate(block: (ChatJoinRequestUpdate) -> T): T? = + chatJoinRequestUpdateOrNull() ?.let(block) + +public inline fun Update.chosenInlineResultUpdateOrNull(): ChosenInlineResultUpdate? = this as? + dev.inmo.tgbotapi.types.update.ChosenInlineResultUpdate + +public inline fun Update.chosenInlineResultUpdateOrThrow(): ChosenInlineResultUpdate = this as + dev.inmo.tgbotapi.types.update.ChosenInlineResultUpdate + +public inline fun Update.ifChosenInlineResultUpdate(block: (ChosenInlineResultUpdate) -> T): T? + = chosenInlineResultUpdateOrNull() ?.let(block) + +public inline fun Update.commonChatMemberUpdatedUpdateOrNull(): CommonChatMemberUpdatedUpdate? = + this as? dev.inmo.tgbotapi.types.update.CommonChatMemberUpdatedUpdate + +public inline fun Update.commonChatMemberUpdatedUpdateOrThrow(): CommonChatMemberUpdatedUpdate = + this as dev.inmo.tgbotapi.types.update.CommonChatMemberUpdatedUpdate + +public inline fun + Update.ifCommonChatMemberUpdatedUpdate(block: (CommonChatMemberUpdatedUpdate) -> T): T? = + commonChatMemberUpdatedUpdateOrNull() ?.let(block) + +public inline fun Update.editChannelPostUpdateOrNull(): EditChannelPostUpdate? = this as? + dev.inmo.tgbotapi.types.update.EditChannelPostUpdate + +public inline fun Update.editChannelPostUpdateOrThrow(): EditChannelPostUpdate = this as + dev.inmo.tgbotapi.types.update.EditChannelPostUpdate + +public inline fun Update.ifEditChannelPostUpdate(block: (EditChannelPostUpdate) -> T): T? = + editChannelPostUpdateOrNull() ?.let(block) + +public inline fun Update.editMessageUpdateOrNull(): EditMessageUpdate? = this as? + dev.inmo.tgbotapi.types.update.EditMessageUpdate + +public inline fun Update.editMessageUpdateOrThrow(): EditMessageUpdate = this as + dev.inmo.tgbotapi.types.update.EditMessageUpdate + +public inline fun Update.ifEditMessageUpdate(block: (EditMessageUpdate) -> T): T? = + editMessageUpdateOrNull() ?.let(block) + +public inline fun Update.inlineQueryUpdateOrNull(): InlineQueryUpdate? = this as? + dev.inmo.tgbotapi.types.update.InlineQueryUpdate + +public inline fun Update.inlineQueryUpdateOrThrow(): InlineQueryUpdate = this as + dev.inmo.tgbotapi.types.update.InlineQueryUpdate + +public inline fun Update.ifInlineQueryUpdate(block: (InlineQueryUpdate) -> T): T? = + inlineQueryUpdateOrNull() ?.let(block) + +public inline fun Update.messageUpdateOrNull(): MessageUpdate? = this as? + dev.inmo.tgbotapi.types.update.MessageUpdate + +public inline fun Update.messageUpdateOrThrow(): MessageUpdate = this as + dev.inmo.tgbotapi.types.update.MessageUpdate + +public inline fun Update.ifMessageUpdate(block: (MessageUpdate) -> T): T? = + messageUpdateOrNull() ?.let(block) + +public inline fun Update.myChatMemberUpdatedUpdateOrNull(): MyChatMemberUpdatedUpdate? = this as? + dev.inmo.tgbotapi.types.update.MyChatMemberUpdatedUpdate + +public inline fun Update.myChatMemberUpdatedUpdateOrThrow(): MyChatMemberUpdatedUpdate = this as + dev.inmo.tgbotapi.types.update.MyChatMemberUpdatedUpdate + +public inline fun Update.ifMyChatMemberUpdatedUpdate(block: (MyChatMemberUpdatedUpdate) -> T): + T? = myChatMemberUpdatedUpdateOrNull() ?.let(block) + +public inline fun Update.pollAnswerUpdateOrNull(): PollAnswerUpdate? = this as? + dev.inmo.tgbotapi.types.update.PollAnswerUpdate + +public inline fun Update.pollAnswerUpdateOrThrow(): PollAnswerUpdate = this as + dev.inmo.tgbotapi.types.update.PollAnswerUpdate + +public inline fun Update.ifPollAnswerUpdate(block: (PollAnswerUpdate) -> T): T? = + pollAnswerUpdateOrNull() ?.let(block) + +public inline fun Update.pollUpdateOrNull(): PollUpdate? = this as? + dev.inmo.tgbotapi.types.update.PollUpdate + +public inline fun Update.pollUpdateOrThrow(): PollUpdate = this as + dev.inmo.tgbotapi.types.update.PollUpdate + +public inline fun Update.ifPollUpdate(block: (PollUpdate) -> T): T? = pollUpdateOrNull() + ?.let(block) + +public inline fun Update.preCheckoutQueryUpdateOrNull(): PreCheckoutQueryUpdate? = this as? + dev.inmo.tgbotapi.types.update.PreCheckoutQueryUpdate + +public inline fun Update.preCheckoutQueryUpdateOrThrow(): PreCheckoutQueryUpdate = this as + dev.inmo.tgbotapi.types.update.PreCheckoutQueryUpdate + +public inline fun Update.ifPreCheckoutQueryUpdate(block: (PreCheckoutQueryUpdate) -> T): T? = + preCheckoutQueryUpdateOrNull() ?.let(block) + +public inline fun Update.shippingQueryUpdateOrNull(): ShippingQueryUpdate? = this as? + dev.inmo.tgbotapi.types.update.ShippingQueryUpdate + +public inline fun Update.shippingQueryUpdateOrThrow(): ShippingQueryUpdate = this as + dev.inmo.tgbotapi.types.update.ShippingQueryUpdate + +public inline fun Update.ifShippingQueryUpdate(block: (ShippingQueryUpdate) -> T): T? = + shippingQueryUpdateOrNull() ?.let(block) + +public inline fun Update.baseEditMessageUpdateOrNull(): BaseEditMessageUpdate? = this as? + dev.inmo.tgbotapi.types.update.abstracts.BaseEditMessageUpdate + +public inline fun Update.baseEditMessageUpdateOrThrow(): BaseEditMessageUpdate = this as + dev.inmo.tgbotapi.types.update.abstracts.BaseEditMessageUpdate + +public inline fun Update.ifBaseEditMessageUpdate(block: (BaseEditMessageUpdate) -> T): T? = + baseEditMessageUpdateOrNull() ?.let(block) + +public inline fun Update.baseMessageUpdateOrNull(): BaseMessageUpdate? = this as? + dev.inmo.tgbotapi.types.update.abstracts.BaseMessageUpdate + +public inline fun Update.baseMessageUpdateOrThrow(): BaseMessageUpdate = this as + dev.inmo.tgbotapi.types.update.abstracts.BaseMessageUpdate + +public inline fun Update.ifBaseMessageUpdate(block: (BaseMessageUpdate) -> T): T? = + baseMessageUpdateOrNull() ?.let(block) + +public inline fun Update.baseSentMessageUpdateOrNull(): BaseSentMessageUpdate? = this as? + dev.inmo.tgbotapi.types.update.abstracts.BaseSentMessageUpdate + +public inline fun Update.baseSentMessageUpdateOrThrow(): BaseSentMessageUpdate = this as + dev.inmo.tgbotapi.types.update.abstracts.BaseSentMessageUpdate + +public inline fun Update.ifBaseSentMessageUpdate(block: (BaseSentMessageUpdate) -> T): T? = + baseSentMessageUpdateOrNull() ?.let(block) + +public inline fun Update.chatMemberUpdatedUpdateOrNull(): ChatMemberUpdatedUpdate? = this as? + dev.inmo.tgbotapi.types.update.abstracts.ChatMemberUpdatedUpdate + +public inline fun Update.chatMemberUpdatedUpdateOrThrow(): ChatMemberUpdatedUpdate = this as + dev.inmo.tgbotapi.types.update.abstracts.ChatMemberUpdatedUpdate + +public inline fun Update.ifChatMemberUpdatedUpdate(block: (ChatMemberUpdatedUpdate) -> T): T? = + chatMemberUpdatedUpdateOrNull() ?.let(block) + +public inline fun Update.unknownUpdateOrNull(): UnknownUpdate? = this as? + dev.inmo.tgbotapi.types.update.abstracts.UnknownUpdate + +public inline fun Update.unknownUpdateOrThrow(): UnknownUpdate = this as + dev.inmo.tgbotapi.types.update.abstracts.UnknownUpdate + +public inline fun Update.ifUnknownUpdate(block: (UnknownUpdate) -> T): T? = + unknownUpdateOrNull() ?.let(block)