From f10cfdbe1e07108e36c75c99d2f397b74f6c9393 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 20 Feb 2026 17:05:51 +0600 Subject: [PATCH] add support of getChatGifts and getUserGifts --- tgbotapi.api/api/tgbotapi.api.api | 14 + .../extensions/api/gifts/GetChatGifts.kt | 82 +++ .../extensions/api/gifts/GetUserGifts.kt | 74 ++ tgbotapi.core/api/tgbotapi.core.api | 52 +- .../tgbotapi/requests/gifts/GetChatGifts.kt | 25 +- .../tgbotapi/requests/gifts/GetUserGifts.kt | 19 +- .../dev/inmo/tgbotapi/types/gifts/Gift.kt | 12 +- .../extensions/utils/ClassCastsNew.kt | 630 ------------------ 8 files changed, 258 insertions(+), 650 deletions(-) create mode 100644 tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/gifts/GetChatGifts.kt create mode 100644 tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/gifts/GetUserGifts.kt diff --git a/tgbotapi.api/api/tgbotapi.api.api b/tgbotapi.api/api/tgbotapi.api.api index 3c0a442b92..a737ee7fcb 100644 --- a/tgbotapi.api/api/tgbotapi.api.api +++ b/tgbotapi.api/api/tgbotapi.api.api @@ -1197,6 +1197,20 @@ public final class dev/inmo/tgbotapi/extensions/api/gifts/GetAvailableGiftsKt { public static final fun getAvailableGifts (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; } +public final class dev/inmo/tgbotapi/extensions/api/gifts/GetChatGiftsKt { + public static final fun getChatGifts (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/ChatIdentifier;ZZZZZZZZLjava/lang/String;Ljava/lang/Integer;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun getChatGifts$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/ChatIdentifier;ZZZZZZZZLjava/lang/String;Ljava/lang/Integer;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static final fun getChatGiftsFlow (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/ChatIdentifier;ZZZZZZZZLjava/lang/String;Ljava/lang/Integer;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow; + public static synthetic fun getChatGiftsFlow$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/ChatIdentifier;ZZZZZZZZLjava/lang/String;Ljava/lang/Integer;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow; +} + +public final class dev/inmo/tgbotapi/extensions/api/gifts/GetUserGiftsKt { + public static final fun getUserGifts (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/IdChatIdentifier;ZZZZZZLjava/lang/String;Ljava/lang/Integer;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun getUserGifts$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/IdChatIdentifier;ZZZZZZLjava/lang/String;Ljava/lang/Integer;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static final fun getUserGiftsFlow (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/IdChatIdentifier;ZZZZZZLjava/lang/String;Ljava/lang/Integer;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow; + public static synthetic fun getUserGiftsFlow$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/IdChatIdentifier;ZZZZZZLjava/lang/String;Ljava/lang/Integer;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow; +} + public final class dev/inmo/tgbotapi/extensions/api/gifts/GiftPremiumSubscriptionKt { public static final fun giftPremiumSubscription (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/IdChatIdentifier;IILdev/inmo/tgbotapi/types/message/textsources/TextSource;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static final fun giftPremiumSubscription (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/IdChatIdentifier;IILjava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/gifts/GetChatGifts.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/gifts/GetChatGifts.kt new file mode 100644 index 0000000000..dc1189bbb7 --- /dev/null +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/gifts/GetChatGifts.kt @@ -0,0 +1,82 @@ +package dev.inmo.tgbotapi.extensions.api.gifts + +import dev.inmo.tgbotapi.bot.TelegramBot +import dev.inmo.tgbotapi.requests.gifts.GetChatGifts +import dev.inmo.tgbotapi.types.ChatIdentifier +import dev.inmo.tgbotapi.types.OwnedGifts +import dev.inmo.tgbotapi.types.gifts.GiftSentOrReceived +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.flow + +public suspend fun TelegramBot.getChatGifts( + chatId: ChatIdentifier, + excludeUnsaved: Boolean = false, + excludeSaved: Boolean = false, + excludeUnlimited: Boolean = false, + excludeLimitedUpgradable: Boolean = false, + excludeLimitedNonUpgradable: Boolean = false, + excludeFromBlockchain: Boolean = false, + excludeUnique: Boolean = false, + sortByPrice: Boolean = false, + offset: String? = null, + limit: Int? = null +): OwnedGifts = execute( + GetChatGifts( + chatId, + excludeUnsaved, + excludeSaved, + excludeUnlimited, + excludeLimitedUpgradable, + excludeLimitedNonUpgradable, + excludeFromBlockchain, + excludeUnique, + sortByPrice, + offset, + limit + ) +) + +public fun TelegramBot.getChatGiftsFlow( + chatId: ChatIdentifier, + excludeUnsaved: Boolean = false, + excludeSaved: Boolean = false, + excludeUnlimited: Boolean = false, + excludeLimitedUpgradable: Boolean = false, + excludeLimitedNonUpgradable: Boolean = false, + excludeFromBlockchain: Boolean = false, + excludeUnique: Boolean = false, + sortByPrice: Boolean = false, + initialOffset: String? = null, + limit: Int? = null, + onErrorContinueChecker: suspend (Throwable?) -> Boolean = { false } +): Flow> = flow { + var currentOffset = initialOffset + do { + val response = runCatching { + getChatGifts( + chatId, + excludeUnsaved, + excludeSaved, + excludeUnlimited, + excludeLimitedUpgradable, + excludeLimitedNonUpgradable, + excludeFromBlockchain, + excludeUnique, + sortByPrice, + currentOffset, + limit + ) + } + if (response.isSuccess) { + val result = response.getOrThrow() + emit(result) + currentOffset = result.nextOffset + } else { + if (onErrorContinueChecker(response.exceptionOrNull())) { + continue + } else { + break + } + } + } while (currentOffset != null) +} diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/gifts/GetUserGifts.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/gifts/GetUserGifts.kt new file mode 100644 index 0000000000..14a420ecba --- /dev/null +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/gifts/GetUserGifts.kt @@ -0,0 +1,74 @@ +package dev.inmo.tgbotapi.extensions.api.gifts + +import dev.inmo.tgbotapi.bot.TelegramBot +import dev.inmo.tgbotapi.requests.gifts.GetUserGifts +import dev.inmo.tgbotapi.types.OwnedGifts +import dev.inmo.tgbotapi.types.UserId +import dev.inmo.tgbotapi.types.gifts.GiftSentOrReceived +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.flow + +public suspend fun TelegramBot.getUserGifts( + userId: UserId, + excludeUnlimited: Boolean = false, + excludeLimitedUpgradable: Boolean = false, + excludeLimitedNonUpgradable: Boolean = false, + excludeFromBlockchain: Boolean = false, + excludeUnique: Boolean = false, + sortByPrice: Boolean = false, + offset: String? = null, + limit: Int? = null +): OwnedGifts = execute( + GetUserGifts( + userId, + excludeUnlimited, + excludeLimitedUpgradable, + excludeLimitedNonUpgradable, + excludeFromBlockchain, + excludeUnique, + sortByPrice, + offset, + limit + ) +) + +public fun TelegramBot.getUserGiftsFlow( + userId: UserId, + excludeUnlimited: Boolean = false, + excludeLimitedUpgradable: Boolean = false, + excludeLimitedNonUpgradable: Boolean = false, + excludeFromBlockchain: Boolean = false, + excludeUnique: Boolean = false, + sortByPrice: Boolean = false, + initialOffset: String? = null, + limit: Int? = null, + onErrorContinueChecker: suspend (Throwable?) -> Boolean = { false } +): Flow> = flow { + var currentOffset = initialOffset + do { + val response = runCatching { + getUserGifts( + userId, + excludeUnlimited, + excludeLimitedUpgradable, + excludeLimitedNonUpgradable, + excludeFromBlockchain, + excludeUnique, + sortByPrice, + currentOffset, + limit + ) + } + if (response.isSuccess) { + val result = response.getOrThrow() + emit(result) + currentOffset = result.nextOffset + } else { + if (onErrorContinueChecker(response.exceptionOrNull())) { + continue + } else { + break + } + } + } while (currentOffset != null) +} diff --git a/tgbotapi.core/api/tgbotapi.core.api b/tgbotapi.core/api/tgbotapi.core.api index fc24a296e4..83ea9faa6f 100644 --- a/tgbotapi.core/api/tgbotapi.core.api +++ b/tgbotapi.core/api/tgbotapi.core.api @@ -5454,19 +5454,35 @@ public final class dev/inmo/tgbotapi/requests/gifts/GetAvailableGifts : dev/inmo public final class dev/inmo/tgbotapi/requests/gifts/GetChatGifts : dev/inmo/tgbotapi/abstracts/types/ChatRequest, dev/inmo/tgbotapi/requests/abstracts/SimpleRequest { public static final field Companion Ldev/inmo/tgbotapi/requests/gifts/GetChatGifts$Companion; - public fun (Ldev/inmo/tgbotapi/types/ChatIdentifier;Ljava/lang/String;Ljava/lang/Integer;)V - public synthetic fun (Ldev/inmo/tgbotapi/types/ChatIdentifier;Ljava/lang/String;Ljava/lang/Integer;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (Ldev/inmo/tgbotapi/types/ChatIdentifier;ZZZZZZZZLjava/lang/String;Ljava/lang/Integer;)V + public synthetic fun (Ldev/inmo/tgbotapi/types/ChatIdentifier;ZZZZZZZZLjava/lang/String;Ljava/lang/Integer;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()Ldev/inmo/tgbotapi/types/ChatIdentifier; - public final fun component2 ()Ljava/lang/String; - public final fun component3 ()Ljava/lang/Integer; - public final fun copy (Ldev/inmo/tgbotapi/types/ChatIdentifier;Ljava/lang/String;Ljava/lang/Integer;)Ldev/inmo/tgbotapi/requests/gifts/GetChatGifts; - public static synthetic fun copy$default (Ldev/inmo/tgbotapi/requests/gifts/GetChatGifts;Ldev/inmo/tgbotapi/types/ChatIdentifier;Ljava/lang/String;Ljava/lang/Integer;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/gifts/GetChatGifts; + public final fun component10 ()Ljava/lang/String; + public final fun component11 ()Ljava/lang/Integer; + public final fun component2 ()Z + public final fun component3 ()Z + public final fun component4 ()Z + public final fun component5 ()Z + public final fun component6 ()Z + public final fun component7 ()Z + public final fun component8 ()Z + public final fun component9 ()Z + public final fun copy (Ldev/inmo/tgbotapi/types/ChatIdentifier;ZZZZZZZZLjava/lang/String;Ljava/lang/Integer;)Ldev/inmo/tgbotapi/requests/gifts/GetChatGifts; + public static synthetic fun copy$default (Ldev/inmo/tgbotapi/requests/gifts/GetChatGifts;Ldev/inmo/tgbotapi/types/ChatIdentifier;ZZZZZZZZLjava/lang/String;Ljava/lang/Integer;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/gifts/GetChatGifts; public fun equals (Ljava/lang/Object;)Z public fun getChatId ()Ldev/inmo/tgbotapi/types/ChatIdentifier; + public final fun getExcludeFromBlockchain ()Z + public final fun getExcludeLimitedNonUpgradable ()Z + public final fun getExcludeLimitedUpgradable ()Z + public final fun getExcludeSaved ()Z + public final fun getExcludeUnique ()Z + public final fun getExcludeUnlimited ()Z + public final fun getExcludeUnsaved ()Z public final fun getLimit ()Ljava/lang/Integer; public final fun getOffset ()Ljava/lang/String; public fun getRequestSerializer ()Lkotlinx/serialization/SerializationStrategy; public fun getResultDeserializer ()Lkotlinx/serialization/DeserializationStrategy; + public final fun getSortByPrice ()Z public fun hashCode ()I public fun method ()Ljava/lang/String; public fun toString ()Ljava/lang/String; @@ -5490,18 +5506,30 @@ public final class dev/inmo/tgbotapi/requests/gifts/GetChatGifts$Companion { public final class dev/inmo/tgbotapi/requests/gifts/GetUserGifts : dev/inmo/tgbotapi/requests/abstracts/SimpleRequest { public static final field Companion Ldev/inmo/tgbotapi/requests/gifts/GetUserGifts$Companion; - public fun (Ldev/inmo/tgbotapi/types/IdChatIdentifier;Ljava/lang/String;Ljava/lang/Integer;)V - public synthetic fun (Ldev/inmo/tgbotapi/types/IdChatIdentifier;Ljava/lang/String;Ljava/lang/Integer;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (Ldev/inmo/tgbotapi/types/IdChatIdentifier;ZZZZZZLjava/lang/String;Ljava/lang/Integer;)V + public synthetic fun (Ldev/inmo/tgbotapi/types/IdChatIdentifier;ZZZZZZLjava/lang/String;Ljava/lang/Integer;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()Ldev/inmo/tgbotapi/types/IdChatIdentifier; - public final fun component2 ()Ljava/lang/String; - public final fun component3 ()Ljava/lang/Integer; - public final fun copy (Ldev/inmo/tgbotapi/types/IdChatIdentifier;Ljava/lang/String;Ljava/lang/Integer;)Ldev/inmo/tgbotapi/requests/gifts/GetUserGifts; - public static synthetic fun copy$default (Ldev/inmo/tgbotapi/requests/gifts/GetUserGifts;Ldev/inmo/tgbotapi/types/IdChatIdentifier;Ljava/lang/String;Ljava/lang/Integer;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/gifts/GetUserGifts; + public final fun component2 ()Z + public final fun component3 ()Z + public final fun component4 ()Z + public final fun component5 ()Z + public final fun component6 ()Z + public final fun component7 ()Z + public final fun component8 ()Ljava/lang/String; + public final fun component9 ()Ljava/lang/Integer; + public final fun copy (Ldev/inmo/tgbotapi/types/IdChatIdentifier;ZZZZZZLjava/lang/String;Ljava/lang/Integer;)Ldev/inmo/tgbotapi/requests/gifts/GetUserGifts; + public static synthetic fun copy$default (Ldev/inmo/tgbotapi/requests/gifts/GetUserGifts;Ldev/inmo/tgbotapi/types/IdChatIdentifier;ZZZZZZLjava/lang/String;Ljava/lang/Integer;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/gifts/GetUserGifts; public fun equals (Ljava/lang/Object;)Z + public final fun getExcludeFromBlockchain ()Z + public final fun getExcludeLimitedNonUpgradable ()Z + public final fun getExcludeLimitedUpgradable ()Z + public final fun getExcludeUnique ()Z + public final fun getExcludeUnlimited ()Z public final fun getLimit ()Ljava/lang/Integer; public final fun getOffset ()Ljava/lang/String; public fun getRequestSerializer ()Lkotlinx/serialization/SerializationStrategy; public fun getResultDeserializer ()Lkotlinx/serialization/DeserializationStrategy; + public final fun getSortByPrice ()Z public final fun getUserId ()Ldev/inmo/tgbotapi/types/IdChatIdentifier; public fun hashCode ()I public fun method ()Ljava/lang/String; diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/gifts/GetChatGifts.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/gifts/GetChatGifts.kt index a30d2260cf..334e0221a1 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/gifts/GetChatGifts.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/gifts/GetChatGifts.kt @@ -6,6 +6,14 @@ import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.OwnedGifts import dev.inmo.tgbotapi.types.chatIdField +import dev.inmo.tgbotapi.types.excludeUnsavedField +import dev.inmo.tgbotapi.types.excludeSavedField +import dev.inmo.tgbotapi.types.excludeUnlimitedField +import dev.inmo.tgbotapi.types.excludeLimitedUpgradableField +import dev.inmo.tgbotapi.types.excludeLimitedNonUpgradableField +import dev.inmo.tgbotapi.types.excludeFromBlockchainField +import dev.inmo.tgbotapi.types.excludeUniqueField +import dev.inmo.tgbotapi.types.sortByPriceField import dev.inmo.tgbotapi.types.gifts.GiftSentOrReceived import dev.inmo.tgbotapi.types.limitField import dev.inmo.tgbotapi.types.offsetField @@ -14,11 +22,26 @@ import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable import kotlinx.serialization.SerializationStrategy -// TODO::Fix @Serializable data class GetChatGifts( @SerialName(chatIdField) override val chatId: ChatIdentifier, + @SerialName(excludeUnsavedField) + val excludeUnsaved: Boolean = false, + @SerialName(excludeSavedField) + val excludeSaved: Boolean = false, + @SerialName(excludeUnlimitedField) + val excludeUnlimited: Boolean = false, + @SerialName(excludeLimitedUpgradableField) + val excludeLimitedUpgradable: Boolean = false, + @SerialName(excludeLimitedNonUpgradableField) + val excludeLimitedNonUpgradable: Boolean = false, + @SerialName(excludeFromBlockchainField) + val excludeFromBlockchain: Boolean = false, + @SerialName(excludeUniqueField) + val excludeUnique: Boolean = false, + @SerialName(sortByPriceField) + val sortByPrice: Boolean = false, @SerialName(offsetField) val offset: String? = null, @SerialName(limitField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/gifts/GetUserGifts.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/gifts/GetUserGifts.kt index f04b4e3630..45dc2437e8 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/gifts/GetUserGifts.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/gifts/GetUserGifts.kt @@ -4,6 +4,12 @@ import dev.inmo.micro_utils.common.Warning import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest import dev.inmo.tgbotapi.types.OwnedGifts import dev.inmo.tgbotapi.types.UserId +import dev.inmo.tgbotapi.types.excludeUnlimitedField +import dev.inmo.tgbotapi.types.excludeLimitedUpgradableField +import dev.inmo.tgbotapi.types.excludeLimitedNonUpgradableField +import dev.inmo.tgbotapi.types.excludeFromBlockchainField +import dev.inmo.tgbotapi.types.excludeUniqueField +import dev.inmo.tgbotapi.types.sortByPriceField import dev.inmo.tgbotapi.types.gifts.GiftSentOrReceived import dev.inmo.tgbotapi.types.limitField import dev.inmo.tgbotapi.types.offsetField @@ -13,12 +19,23 @@ import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable import kotlinx.serialization.SerializationStrategy -// TODO::Fix @Serializable data class GetUserGifts( @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userIdField) val userId: UserId, + @SerialName(excludeUnlimitedField) + val excludeUnlimited: Boolean = false, + @SerialName(excludeLimitedUpgradableField) + val excludeLimitedUpgradable: Boolean = false, + @SerialName(excludeLimitedNonUpgradableField) + val excludeLimitedNonUpgradable: Boolean = false, + @SerialName(excludeFromBlockchainField) + val excludeFromBlockchain: Boolean = false, + @SerialName(excludeUniqueField) + val excludeUnique: Boolean = false, + @SerialName(sortByPriceField) + val sortByPrice: Boolean = false, @SerialName(offsetField) val offset: String? = null, @SerialName(limitField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/gifts/Gift.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/gifts/Gift.kt index 2a11211535..89952de8fe 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/gifts/Gift.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/gifts/Gift.kt @@ -30,7 +30,7 @@ sealed interface Gift { val personalRemainingCount: Int? val isPremium: Boolean val hasColors: Boolean - val background: dev.inmo.tgbotapi.types.gifts.GiftBackground? + val background: GiftBackground? val uniqueGiftVariantCount: Int? /** @@ -57,7 +57,7 @@ sealed interface Gift { @SerialName(hasColorsField) override val hasColors: Boolean = false, @SerialName(backgroundField) - override val background: dev.inmo.tgbotapi.types.gifts.GiftBackground? = null, + override val background: GiftBackground? = null, @SerialName(uniqueGiftVariantCountField) override val uniqueGiftVariantCount: Int? = null, ) : Regular { @@ -95,7 +95,7 @@ sealed interface Gift { @SerialName(hasColorsField) override val hasColors: Boolean = false, @SerialName(backgroundField) - override val background: dev.inmo.tgbotapi.types.gifts.GiftBackground? = null, + override val background: GiftBackground? = null, @SerialName(uniqueGiftVariantCountField) override val uniqueGiftVariantCount: Int? = null, ) : Regular @@ -115,7 +115,7 @@ sealed interface Gift { val personal_remaining_count: Int? = null, val is_premium: Boolean = false, val has_colors: Boolean = false, - val background: dev.inmo.tgbotapi.types.gifts.GiftBackground? = null, + val background: GiftBackground? = null, val unique_gift_variant_count: Int? = null, ) @@ -225,7 +225,7 @@ sealed interface Gift { val personal_remaining_count: Int? = null, val is_premium: Boolean = false, val has_colors: Boolean = false, - val background: dev.inmo.tgbotapi.types.gifts.GiftBackground? = null, + val background: GiftBackground? = null, val unique_gift_variant_count: Int? = null, // unique gift fields val base_name: String? = null, @@ -235,7 +235,7 @@ sealed interface Gift { val symbol: UniqueGiftSymbol? = null, val backdrop: UniqueGiftBackdrop? = null, val is_from_blockchain: Boolean = false, - val colors: dev.inmo.tgbotapi.types.gifts.unique.UniqueGiftColors? = null, + val colors: UniqueGiftColors? = null, val publisher_chat: PreviewChat? = null, ) 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 cd48bbf82c..77c001681d 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 @@ -29,7 +29,6 @@ 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.DirectMessagesConfigurationChanged import dev.inmo.tgbotapi.types.IdChatIdentifier import dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.BaseChosenInlineResult import dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.ChosenInlineResult @@ -82,7 +81,6 @@ import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputVenueMessa 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.PaidMessagePriceChanged import dev.inmo.tgbotapi.types.PrimaryInviteLink import dev.inmo.tgbotapi.types.ReplyInfo import dev.inmo.tgbotapi.types.SecondaryChatInviteLink @@ -126,7 +124,6 @@ import dev.inmo.tgbotapi.types.chat.BusinessChat import dev.inmo.tgbotapi.types.chat.ChannelChat import dev.inmo.tgbotapi.types.chat.ChannelDirectMessagesChat import dev.inmo.tgbotapi.types.chat.Chat -import dev.inmo.tgbotapi.types.chat.ChatBackground import dev.inmo.tgbotapi.types.chat.ChatJoinRequest import dev.inmo.tgbotapi.types.chat.ChatMessageReactionUpdated import dev.inmo.tgbotapi.types.chat.CommonBot @@ -184,8 +181,6 @@ import dev.inmo.tgbotapi.types.chat.member.RestrictedChatMember import dev.inmo.tgbotapi.types.chat.member.RestrictedMemberChatMember import dev.inmo.tgbotapi.types.chat.member.SpecialRightsChatMember import dev.inmo.tgbotapi.types.chat.member.SubscriptionMemberChatMember -import dev.inmo.tgbotapi.types.checklists.ChecklistTasksAdded -import dev.inmo.tgbotapi.types.checklists.ChecklistTasksDone import dev.inmo.tgbotapi.types.dice.BasketballDiceAnimationType import dev.inmo.tgbotapi.types.dice.BowlingDiceAnimationType import dev.inmo.tgbotapi.types.dice.CubeDiceAnimationType @@ -230,9 +225,6 @@ import dev.inmo.tgbotapi.types.files.VideoNoteFile import dev.inmo.tgbotapi.types.files.VideoQuality import dev.inmo.tgbotapi.types.files.VideoSticker import dev.inmo.tgbotapi.types.files.VoiceFile -import dev.inmo.tgbotapi.types.gifts.GiftSentOrReceived -import dev.inmo.tgbotapi.types.giveaway.GiveawayCreated -import dev.inmo.tgbotapi.types.giveaway.GiveawayPrivateResults import dev.inmo.tgbotapi.types.location.LiveLocation import dev.inmo.tgbotapi.types.location.Location import dev.inmo.tgbotapi.types.location.StaticLocation @@ -260,50 +252,14 @@ import dev.inmo.tgbotapi.types.media.VisualTelegramPaidMedia import dev.inmo.tgbotapi.types.media.WithCustomStartTelegramMedia import dev.inmo.tgbotapi.types.media.WithCustomizableCaptionTelegramMedia import dev.inmo.tgbotapi.types.message.ChannelEventMessage -import dev.inmo.tgbotapi.types.message.ChatEvents.ChannelChatCreated -import dev.inmo.tgbotapi.types.message.ChatEvents.ChatBoostAdded -import dev.inmo.tgbotapi.types.message.ChatEvents.ChatOwnerChanged -import dev.inmo.tgbotapi.types.message.ChatEvents.ChatOwnerLeft -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.ChannelDirectMessagesEvent 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.PrivateForumEvent -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.suggested.SuggestedPostApprovalFailed -import dev.inmo.tgbotapi.types.message.ChatEvents.suggested.SuggestedPostApproved -import dev.inmo.tgbotapi.types.message.ChatEvents.suggested.SuggestedPostDeclined -import dev.inmo.tgbotapi.types.message.ChatEvents.suggested.SuggestedPostPaid -import dev.inmo.tgbotapi.types.message.ChatEvents.suggested.SuggestedPostRefunded -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.CommonChannelDirectMessagesEventMessage import dev.inmo.tgbotapi.types.message.CommonGroupEventMessage import dev.inmo.tgbotapi.types.message.CommonSupergroupEventMessage @@ -394,8 +350,6 @@ import dev.inmo.tgbotapi.types.message.content.VisualMediaGroupPartContent import dev.inmo.tgbotapi.types.message.content.VoiceContent import dev.inmo.tgbotapi.types.message.content.WithCustomizedCaptionMediaContent import dev.inmo.tgbotapi.types.message.payments.PaidMediaPurchased -import dev.inmo.tgbotapi.types.message.payments.RefundedPaymentEvent -import dev.inmo.tgbotapi.types.message.payments.SuccessfulPaymentEvent import dev.inmo.tgbotapi.types.message.textsources.BlockquoteTextSource import dev.inmo.tgbotapi.types.message.textsources.BoldTextSource import dev.inmo.tgbotapi.types.message.textsources.BotCommandTextSource @@ -433,26 +387,6 @@ 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 @@ -2343,456 +2277,6 @@ public inline fun ForwardInfo.fromSupergroupOrThrow(): ForwardInfo.PublicChat.Fr public inline fun ForwardInfo.ifFromSupergroup(block: (ForwardInfo.PublicChat.FromSupergroup) -> T): T? = fromSupergroupOrNull() ?.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.usersSharedOrNull(): UsersShared? = this as? dev.inmo.tgbotapi.types.request.UsersShared - -public inline fun ChatEvent.usersSharedOrThrow(): UsersShared = this as dev.inmo.tgbotapi.types.request.UsersShared - -public inline fun ChatEvent.ifUsersShared(block: (UsersShared) -> T): T? = usersSharedOrNull() ?.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.chatBackgroundOrNull(): ChatBackground? = this as? dev.inmo.tgbotapi.types.chat.ChatBackground - -public inline fun ChatEvent.chatBackgroundOrThrow(): ChatBackground = this as dev.inmo.tgbotapi.types.chat.ChatBackground - -public inline fun ChatEvent.ifChatBackground(block: (ChatBackground) -> T): T? = chatBackgroundOrNull() ?.let(block) - -public inline fun ChatEvent.checklistTasksAddedOrNull(): ChecklistTasksAdded? = this as? dev.inmo.tgbotapi.types.checklists.ChecklistTasksAdded - -public inline fun ChatEvent.checklistTasksAddedOrThrow(): ChecklistTasksAdded = this as dev.inmo.tgbotapi.types.checklists.ChecklistTasksAdded - -public inline fun ChatEvent.ifChecklistTasksAdded(block: (ChecklistTasksAdded) -> T): T? = checklistTasksAddedOrNull() ?.let(block) - -public inline fun ChatEvent.checklistTasksDoneOrNull(): ChecklistTasksDone? = this as? dev.inmo.tgbotapi.types.checklists.ChecklistTasksDone - -public inline fun ChatEvent.checklistTasksDoneOrThrow(): ChecklistTasksDone = this as dev.inmo.tgbotapi.types.checklists.ChecklistTasksDone - -public inline fun ChatEvent.ifChecklistTasksDone(block: (ChecklistTasksDone) -> T): T? = checklistTasksDoneOrNull() ?.let(block) - -public inline fun ChatEvent.paidMessagePriceChangedOrNull(): PaidMessagePriceChanged? = this as? dev.inmo.tgbotapi.types.PaidMessagePriceChanged - -public inline fun ChatEvent.paidMessagePriceChangedOrThrow(): PaidMessagePriceChanged = this as dev.inmo.tgbotapi.types.PaidMessagePriceChanged - -public inline fun ChatEvent.ifPaidMessagePriceChanged(block: (PaidMessagePriceChanged) -> T): T? = paidMessagePriceChangedOrNull() ?.let(block) - -public inline fun ChatEvent.giftSentOrReceivedOrNull(): GiftSentOrReceived? = this as? dev.inmo.tgbotapi.types.gifts.GiftSentOrReceived - -public inline fun ChatEvent.giftSentOrReceivedOrThrow(): GiftSentOrReceived = this as dev.inmo.tgbotapi.types.gifts.GiftSentOrReceived - -public inline fun ChatEvent.ifGiftSentOrReceived(block: (GiftSentOrReceived) -> T): T? = giftSentOrReceivedOrNull() ?.let(block) - -public inline fun ChatEvent.giftSentOrReceivedReceivedInBusinessAccountOrNull(): GiftSentOrReceived.ReceivedInBusinessAccount? = this as? dev.inmo.tgbotapi.types.gifts.GiftSentOrReceived.ReceivedInBusinessAccount - -public inline fun ChatEvent.giftSentOrReceivedReceivedInBusinessAccountOrThrow(): GiftSentOrReceived.ReceivedInBusinessAccount = this as dev.inmo.tgbotapi.types.gifts.GiftSentOrReceived.ReceivedInBusinessAccount - -public inline fun ChatEvent.ifGiftSentOrReceivedReceivedInBusinessAccount(block: (GiftSentOrReceived.ReceivedInBusinessAccount) -> T): T? = giftSentOrReceivedReceivedInBusinessAccountOrNull() ?.let(block) - -public inline fun ChatEvent.giftSentOrReceivedRegularOrNull(): GiftSentOrReceived.Regular? = this as? dev.inmo.tgbotapi.types.gifts.GiftSentOrReceived.Regular - -public inline fun ChatEvent.giftSentOrReceivedRegularOrThrow(): GiftSentOrReceived.Regular = this as dev.inmo.tgbotapi.types.gifts.GiftSentOrReceived.Regular - -public inline fun ChatEvent.ifGiftSentOrReceivedRegular(block: (GiftSentOrReceived.Regular) -> T): T? = giftSentOrReceivedRegularOrNull() ?.let(block) - -public inline fun ChatEvent.giftSentOrReceivedUniqueOrNull(): GiftSentOrReceived.Unique? = this as? dev.inmo.tgbotapi.types.gifts.GiftSentOrReceived.Unique - -public inline fun ChatEvent.giftSentOrReceivedUniqueOrThrow(): GiftSentOrReceived.Unique = this as dev.inmo.tgbotapi.types.gifts.GiftSentOrReceived.Unique - -public inline fun ChatEvent.ifGiftSentOrReceivedUnique(block: (GiftSentOrReceived.Unique) -> T): T? = giftSentOrReceivedUniqueOrNull() ?.let(block) - -public inline fun ChatEvent.giftSentOrReceivedRegularCommonOrNull(): GiftSentOrReceived.Regular.Common? = this as? dev.inmo.tgbotapi.types.gifts.GiftSentOrReceived.Regular.Common - -public inline fun ChatEvent.giftSentOrReceivedRegularCommonOrThrow(): GiftSentOrReceived.Regular.Common = this as dev.inmo.tgbotapi.types.gifts.GiftSentOrReceived.Regular.Common - -public inline fun ChatEvent.ifGiftSentOrReceivedRegularCommon(block: (GiftSentOrReceived.Regular.Common) -> T): T? = giftSentOrReceivedRegularCommonOrNull() ?.let(block) - -public inline fun ChatEvent.giftSentOrReceivedRegularReceivedInBusinessAccountOrNull(): GiftSentOrReceived.Regular.ReceivedInBusinessAccount? = this as? dev.inmo.tgbotapi.types.gifts.GiftSentOrReceived.Regular.ReceivedInBusinessAccount - -public inline fun ChatEvent.giftSentOrReceivedRegularReceivedInBusinessAccountOrThrow(): GiftSentOrReceived.Regular.ReceivedInBusinessAccount = this as dev.inmo.tgbotapi.types.gifts.GiftSentOrReceived.Regular.ReceivedInBusinessAccount - -public inline fun ChatEvent.ifGiftSentOrReceivedRegularReceivedInBusinessAccount(block: (GiftSentOrReceived.Regular.ReceivedInBusinessAccount) -> T): T? = giftSentOrReceivedRegularReceivedInBusinessAccountOrNull() ?.let(block) - -public inline fun ChatEvent.giftSentOrReceivedUniqueCommonOrNull(): GiftSentOrReceived.Unique.Common? = this as? dev.inmo.tgbotapi.types.gifts.GiftSentOrReceived.Unique.Common - -public inline fun ChatEvent.giftSentOrReceivedUniqueCommonOrThrow(): GiftSentOrReceived.Unique.Common = this as dev.inmo.tgbotapi.types.gifts.GiftSentOrReceived.Unique.Common - -public inline fun ChatEvent.ifGiftSentOrReceivedUniqueCommon(block: (GiftSentOrReceived.Unique.Common) -> T): T? = giftSentOrReceivedUniqueCommonOrNull() ?.let(block) - -public inline fun ChatEvent.giftSentOrReceivedUniqueReceivedInBusinessAccountOrNull(): GiftSentOrReceived.Unique.ReceivedInBusinessAccount? = this as? dev.inmo.tgbotapi.types.gifts.GiftSentOrReceived.Unique.ReceivedInBusinessAccount - -public inline fun ChatEvent.giftSentOrReceivedUniqueReceivedInBusinessAccountOrThrow(): GiftSentOrReceived.Unique.ReceivedInBusinessAccount = this as dev.inmo.tgbotapi.types.gifts.GiftSentOrReceived.Unique.ReceivedInBusinessAccount - -public inline fun ChatEvent.ifGiftSentOrReceivedUniqueReceivedInBusinessAccount(block: (GiftSentOrReceived.Unique.ReceivedInBusinessAccount) -> T): T? = giftSentOrReceivedUniqueReceivedInBusinessAccountOrNull() ?.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.refundedPaymentEventOrNull(): RefundedPaymentEvent? = this as? dev.inmo.tgbotapi.types.message.payments.RefundedPaymentEvent - -public inline fun ChatEvent.refundedPaymentEventOrThrow(): RefundedPaymentEvent = this as dev.inmo.tgbotapi.types.message.payments.RefundedPaymentEvent - -public inline fun ChatEvent.ifRefundedPaymentEvent(block: (RefundedPaymentEvent) -> T): T? = refundedPaymentEventOrNull() ?.let(block) - -public inline fun ChatEvent.suggestedPostApprovedOrNull(): SuggestedPostApproved? = this as? dev.inmo.tgbotapi.types.message.ChatEvents.suggested.SuggestedPostApproved - -public inline fun ChatEvent.suggestedPostApprovedOrThrow(): SuggestedPostApproved = this as dev.inmo.tgbotapi.types.message.ChatEvents.suggested.SuggestedPostApproved - -public inline fun ChatEvent.ifSuggestedPostApproved(block: (SuggestedPostApproved) -> T): T? = suggestedPostApprovedOrNull() ?.let(block) - -public inline fun ChatEvent.suggestedPostApprovalFailedOrNull(): SuggestedPostApprovalFailed? = this as? dev.inmo.tgbotapi.types.message.ChatEvents.suggested.SuggestedPostApprovalFailed - -public inline fun ChatEvent.suggestedPostApprovalFailedOrThrow(): SuggestedPostApprovalFailed = this as dev.inmo.tgbotapi.types.message.ChatEvents.suggested.SuggestedPostApprovalFailed - -public inline fun ChatEvent.ifSuggestedPostApprovalFailed(block: (SuggestedPostApprovalFailed) -> T): T? = suggestedPostApprovalFailedOrNull() ?.let(block) - -public inline fun ChatEvent.suggestedPostDeclinedOrNull(): SuggestedPostDeclined? = this as? dev.inmo.tgbotapi.types.message.ChatEvents.suggested.SuggestedPostDeclined - -public inline fun ChatEvent.suggestedPostDeclinedOrThrow(): SuggestedPostDeclined = this as dev.inmo.tgbotapi.types.message.ChatEvents.suggested.SuggestedPostDeclined - -public inline fun ChatEvent.ifSuggestedPostDeclined(block: (SuggestedPostDeclined) -> T): T? = suggestedPostDeclinedOrNull() ?.let(block) - -public inline fun ChatEvent.suggestedPostPaidOrNull(): SuggestedPostPaid? = this as? dev.inmo.tgbotapi.types.message.ChatEvents.suggested.SuggestedPostPaid - -public inline fun ChatEvent.suggestedPostPaidOrThrow(): SuggestedPostPaid = this as dev.inmo.tgbotapi.types.message.ChatEvents.suggested.SuggestedPostPaid - -public inline fun ChatEvent.ifSuggestedPostPaid(block: (SuggestedPostPaid) -> T): T? = suggestedPostPaidOrNull() ?.let(block) - -public inline fun ChatEvent.suggestedPostPaidXTROrNull(): SuggestedPostPaid.XTR? = this as? dev.inmo.tgbotapi.types.message.ChatEvents.suggested.SuggestedPostPaid.XTR - -public inline fun ChatEvent.suggestedPostPaidXTROrThrow(): SuggestedPostPaid.XTR = this as dev.inmo.tgbotapi.types.message.ChatEvents.suggested.SuggestedPostPaid.XTR - -public inline fun ChatEvent.ifSuggestedPostPaidXTR(block: (SuggestedPostPaid.XTR) -> T): T? = suggestedPostPaidXTROrNull() ?.let(block) - -public inline fun ChatEvent.suggestedPostPaidTONOrNull(): SuggestedPostPaid.TON? = this as? dev.inmo.tgbotapi.types.message.ChatEvents.suggested.SuggestedPostPaid.TON - -public inline fun ChatEvent.suggestedPostPaidTONOrThrow(): SuggestedPostPaid.TON = this as dev.inmo.tgbotapi.types.message.ChatEvents.suggested.SuggestedPostPaid.TON - -public inline fun ChatEvent.ifSuggestedPostPaidTON(block: (SuggestedPostPaid.TON) -> T): T? = suggestedPostPaidTONOrNull() ?.let(block) - -public inline fun ChatEvent.suggestedPostPaidOtherOrNull(): SuggestedPostPaid.Other? = this as? dev.inmo.tgbotapi.types.message.ChatEvents.suggested.SuggestedPostPaid.Other - -public inline fun ChatEvent.suggestedPostPaidOtherOrThrow(): SuggestedPostPaid.Other = this as dev.inmo.tgbotapi.types.message.ChatEvents.suggested.SuggestedPostPaid.Other - -public inline fun ChatEvent.ifSuggestedPostPaidOther(block: (SuggestedPostPaid.Other) -> T): T? = suggestedPostPaidOtherOrNull() ?.let(block) - -public inline fun ChatEvent.suggestedPostRefundedOrNull(): SuggestedPostRefunded? = this as? dev.inmo.tgbotapi.types.message.ChatEvents.suggested.SuggestedPostRefunded - -public inline fun ChatEvent.suggestedPostRefundedOrThrow(): SuggestedPostRefunded = this as dev.inmo.tgbotapi.types.message.ChatEvents.suggested.SuggestedPostRefunded - -public inline fun ChatEvent.ifSuggestedPostRefunded(block: (SuggestedPostRefunded) -> T): T? = suggestedPostRefundedOrNull() ?.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.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.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.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.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.privateForumEventOrNull(): PrivateForumEvent? = this as? dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.PrivateForumEvent - -public inline fun ChatEvent.privateForumEventOrThrow(): PrivateForumEvent = this as dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.PrivateForumEvent - -public inline fun ChatEvent.ifPrivateForumEvent(block: (PrivateForumEvent) -> T): T? = privateForumEventOrNull() ?.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.channelDirectMessagesEventOrNull(): ChannelDirectMessagesEvent? = this as? dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.ChannelDirectMessagesEvent - -public inline fun ChatEvent.channelDirectMessagesEventOrThrow(): ChannelDirectMessagesEvent = this as dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.ChannelDirectMessagesEvent - -public inline fun ChatEvent.ifChannelDirectMessagesEvent(block: (ChannelDirectMessagesEvent) -> T): T? = channelDirectMessagesEventOrNull() ?.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.chatOwnerLeftOrNull(): ChatOwnerLeft? = this as? dev.inmo.tgbotapi.types.message.ChatEvents.ChatOwnerLeft - -public inline fun ChatEvent.chatOwnerLeftOrThrow(): ChatOwnerLeft = this as dev.inmo.tgbotapi.types.message.ChatEvents.ChatOwnerLeft - -public inline fun ChatEvent.ifChatOwnerLeft(block: (ChatOwnerLeft) -> T): T? = chatOwnerLeftOrNull() ?.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.chatBoostAddedOrNull(): ChatBoostAdded? = this as? dev.inmo.tgbotapi.types.message.ChatEvents.ChatBoostAdded - -public inline fun ChatEvent.chatBoostAddedOrThrow(): ChatBoostAdded = this as dev.inmo.tgbotapi.types.message.ChatEvents.ChatBoostAdded - -public inline fun ChatEvent.ifChatBoostAdded(block: (ChatBoostAdded) -> T): T? = chatBoostAddedOrNull() ?.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.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.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.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.chatOwnerChangedOrNull(): ChatOwnerChanged? = this as? dev.inmo.tgbotapi.types.message.ChatEvents.ChatOwnerChanged - -public inline fun ChatEvent.chatOwnerChangedOrThrow(): ChatOwnerChanged = this as dev.inmo.tgbotapi.types.message.ChatEvents.ChatOwnerChanged - -public inline fun ChatEvent.ifChatOwnerChanged(block: (ChatOwnerChanged) -> T): T? = chatOwnerChangedOrNull() ?.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.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.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.writeAccessAllowedOtherOrNull(): WriteAccessAllowed.Other? = this as? dev.inmo.tgbotapi.types.message.ChatEvents.forum.WriteAccessAllowed.Other - -public inline fun ChatEvent.writeAccessAllowedOtherOrThrow(): WriteAccessAllowed.Other = this as dev.inmo.tgbotapi.types.message.ChatEvents.forum.WriteAccessAllowed.Other - -public inline fun ChatEvent.ifWriteAccessAllowedOther(block: (WriteAccessAllowed.Other) -> T): T? = writeAccessAllowedOtherOrNull() ?.let(block) - -public inline fun ChatEvent.writeAccessAllowedFromWebAppLinkOrNull(): WriteAccessAllowed.FromWebAppLink? = this as? dev.inmo.tgbotapi.types.message.ChatEvents.forum.WriteAccessAllowed.FromWebAppLink - -public inline fun ChatEvent.writeAccessAllowedFromWebAppLinkOrThrow(): WriteAccessAllowed.FromWebAppLink = this as dev.inmo.tgbotapi.types.message.ChatEvents.forum.WriteAccessAllowed.FromWebAppLink - -public inline fun ChatEvent.ifWriteAccessAllowedFromWebAppLink(block: (WriteAccessAllowed.FromWebAppLink) -> T): T? = writeAccessAllowedFromWebAppLinkOrNull() ?.let(block) - -public inline fun ChatEvent.writeAccessAllowedFromRequestOrNull(): WriteAccessAllowed.FromRequest? = this as? dev.inmo.tgbotapi.types.message.ChatEvents.forum.WriteAccessAllowed.FromRequest - -public inline fun ChatEvent.writeAccessAllowedFromRequestOrThrow(): WriteAccessAllowed.FromRequest = this as dev.inmo.tgbotapi.types.message.ChatEvents.forum.WriteAccessAllowed.FromRequest - -public inline fun ChatEvent.ifWriteAccessAllowedFromRequest(block: (WriteAccessAllowed.FromRequest) -> T): T? = writeAccessAllowedFromRequestOrNull() ?.let(block) - -public inline fun ChatEvent.writeAccessAllowedFromAttachmentMenuOrNull(): WriteAccessAllowed.FromAttachmentMenu? = this as? dev.inmo.tgbotapi.types.message.ChatEvents.forum.WriteAccessAllowed.FromAttachmentMenu - -public inline fun ChatEvent.writeAccessAllowedFromAttachmentMenuOrThrow(): WriteAccessAllowed.FromAttachmentMenu = this as dev.inmo.tgbotapi.types.message.ChatEvents.forum.WriteAccessAllowed.FromAttachmentMenu - -public inline fun ChatEvent.ifWriteAccessAllowedFromAttachmentMenu(block: (WriteAccessAllowed.FromAttachmentMenu) -> T): T? = writeAccessAllowedFromAttachmentMenuOrNull() ?.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.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.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.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.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.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.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.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.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.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.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.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.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.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.giveawayPrivateResultsOrNull(): GiveawayPrivateResults? = this as? dev.inmo.tgbotapi.types.giveaway.GiveawayPrivateResults - -public inline fun ChatEvent.giveawayPrivateResultsOrThrow(): GiveawayPrivateResults = this as dev.inmo.tgbotapi.types.giveaway.GiveawayPrivateResults - -public inline fun ChatEvent.ifGiveawayPrivateResults(block: (GiveawayPrivateResults) -> T): T? = giveawayPrivateResultsOrNull() ?.let(block) - -public inline fun ChatEvent.giveawayCreatedOrNull(): GiveawayCreated? = this as? dev.inmo.tgbotapi.types.giveaway.GiveawayCreated - -public inline fun ChatEvent.giveawayCreatedOrThrow(): GiveawayCreated = this as dev.inmo.tgbotapi.types.giveaway.GiveawayCreated - -public inline fun ChatEvent.ifGiveawayCreated(block: (GiveawayCreated) -> T): T? = giveawayCreatedOrNull() ?.let(block) - -public inline fun ChatEvent.giveawayCreatedStarsOrNull(): GiveawayCreated.Stars? = this as? dev.inmo.tgbotapi.types.giveaway.GiveawayCreated.Stars - -public inline fun ChatEvent.giveawayCreatedStarsOrThrow(): GiveawayCreated.Stars = this as dev.inmo.tgbotapi.types.giveaway.GiveawayCreated.Stars - -public inline fun ChatEvent.ifGiveawayCreatedStars(block: (GiveawayCreated.Stars) -> T): T? = giveawayCreatedStarsOrNull() ?.let(block) - -public inline fun ChatEvent.giveawayCreatedCompanionOrNull(): GiveawayCreated.Companion? = this as? dev.inmo.tgbotapi.types.giveaway.GiveawayCreated.Companion - -public inline fun ChatEvent.giveawayCreatedCompanionOrThrow(): GiveawayCreated.Companion = this as dev.inmo.tgbotapi.types.giveaway.GiveawayCreated.Companion - -public inline fun ChatEvent.ifGiveawayCreatedCompanion(block: (GiveawayCreated.Companion) -> T): T? = giveawayCreatedCompanionOrNull() ?.let(block) - -public inline fun ChatEvent.directMessagesConfigurationChangedOrNull(): DirectMessagesConfigurationChanged? = this as? dev.inmo.tgbotapi.types.DirectMessagesConfigurationChanged - -public inline fun ChatEvent.directMessagesConfigurationChangedOrThrow(): DirectMessagesConfigurationChanged = this as dev.inmo.tgbotapi.types.DirectMessagesConfigurationChanged - -public inline fun ChatEvent.ifDirectMessagesConfigurationChanged(block: (DirectMessagesConfigurationChanged) -> T): T? = directMessagesConfigurationChangedOrNull() ?.let(block) - -public inline fun ChatEvent.directMessagesConfigurationChangedDisabledOrNull(): DirectMessagesConfigurationChanged.Disabled? = this as? dev.inmo.tgbotapi.types.DirectMessagesConfigurationChanged.Disabled - -public inline fun ChatEvent.directMessagesConfigurationChangedDisabledOrThrow(): DirectMessagesConfigurationChanged.Disabled = this as dev.inmo.tgbotapi.types.DirectMessagesConfigurationChanged.Disabled - -public inline fun ChatEvent.ifDirectMessagesConfigurationChangedDisabled(block: (DirectMessagesConfigurationChanged.Disabled) -> T): T? = directMessagesConfigurationChangedDisabledOrNull() ?.let(block) - -public inline fun ChatEvent.directMessagesConfigurationChangedFreeOrNull(): DirectMessagesConfigurationChanged.Free? = this as? dev.inmo.tgbotapi.types.DirectMessagesConfigurationChanged.Free - -public inline fun ChatEvent.directMessagesConfigurationChangedFreeOrThrow(): DirectMessagesConfigurationChanged.Free = this as dev.inmo.tgbotapi.types.DirectMessagesConfigurationChanged.Free - -public inline fun ChatEvent.ifDirectMessagesConfigurationChangedFree(block: (DirectMessagesConfigurationChanged.Free) -> T): T? = directMessagesConfigurationChangedFreeOrNull() ?.let(block) - -public inline fun ChatEvent.directMessagesConfigurationChangedPaidOrNull(): DirectMessagesConfigurationChanged.Paid? = this as? dev.inmo.tgbotapi.types.DirectMessagesConfigurationChanged.Paid - -public inline fun ChatEvent.directMessagesConfigurationChangedPaidOrThrow(): DirectMessagesConfigurationChanged.Paid = this as dev.inmo.tgbotapi.types.DirectMessagesConfigurationChanged.Paid - -public inline fun ChatEvent.ifDirectMessagesConfigurationChangedPaid(block: (DirectMessagesConfigurationChanged.Paid) -> T): T? = directMessagesConfigurationChangedPaidOrNull() ?.let(block) - public inline fun TextSource.mentionTextSourceOrNull(): MentionTextSource? = this as? dev.inmo.tgbotapi.types.message.textsources.MentionTextSource public inline fun TextSource.mentionTextSourceOrThrow(): MentionTextSource = this as dev.inmo.tgbotapi.types.message.textsources.MentionTextSource @@ -3171,120 +2655,6 @@ public inline fun ChatIdentifier.usernameOrThrow(): Username = this as dev.inmo. public inline fun ChatIdentifier.ifUsername(block: (Username) -> T): T? = usernameOrNull() ?.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.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.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.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 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.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.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.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.addressSecureValueOrNull(): AddressSecureValue? = this as? dev.inmo.tgbotapi.types.passport.decrypted.AddressSecureValue - -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 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 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