1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2025-09-03 15:19:30 +00:00

update classcasts

This commit is contained in:
2025-04-21 12:16:17 +06:00
parent 92cd2a3def
commit c610f4eab2
19 changed files with 1484 additions and 454 deletions

View File

@@ -57,6 +57,7 @@ microutils-serialization-mapper = { module = "dev.inmo:micro_utils.serialization
microutils-languageCodes = { module = "dev.inmo:micro_utils.language_codes", version.ref = "microutils" }
microutils-ktor-common = { module = "dev.inmo:micro_utils.ktor.common", version.ref = "microutils" }
microutils-fsm-common = { module = "dev.inmo:micro_utils.fsm.common", version.ref = "microutils" }
microutils-ksp-generator = { module = "dev.inmo:micro_utils.ksp.generator", version.ref = "microutils" }
microutils-ksp-sealed = { module = "dev.inmo:micro_utils.ksp.sealed", version.ref = "microutils" }
microutils-ksp-sealed-generator = { module = "dev.inmo:micro_utils.ksp.sealed.generator", version.ref = "microutils" }
microutils-ksp-variations = { module = "dev.inmo:micro_utils.ksp.variations", version.ref = "microutils" }

View File

@@ -1140,12 +1140,12 @@ public final class dev/inmo/tgbotapi/extensions/api/gifts/GetAvailableGiftsKt {
}
public final class dev/inmo/tgbotapi/extensions/api/gifts/SendGiftGeneratedVariationKt {
public static final fun sendGift (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/User;Ldev/inmo/tgbotapi/types/gifts/Gift;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun sendGift (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/User;Ldev/inmo/tgbotapi/types/gifts/Gift;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun sendGift (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/User;Ldev/inmo/tgbotapi/types/gifts/Gift$Regular;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun sendGift (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/User;Ldev/inmo/tgbotapi/types/gifts/Gift$Regular;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun sendGift-0SDnvgk (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/User;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun sendGift-GROm3fU (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/User;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun sendGift-VjR9mJc (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLdev/inmo/tgbotapi/types/gifts/Gift;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun sendGift-ySMgKnk (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLdev/inmo/tgbotapi/types/gifts/Gift;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun sendGift-VjR9mJc (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLdev/inmo/tgbotapi/types/gifts/Gift$Regular;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun sendGift-ySMgKnk (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLdev/inmo/tgbotapi/types/gifts/Gift$Regular;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
public final class dev/inmo/tgbotapi/extensions/api/gifts/SendGiftKt {
@@ -1160,10 +1160,10 @@ public final class dev/inmo/tgbotapi/extensions/api/gifts/SendGiftKt {
}
public final class dev/inmo/tgbotapi/extensions/api/gifts/SendGiftToChatGeneratedVariationKt {
public static final fun sendGiftToChat (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/types/gifts/Gift;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun sendGiftToChat (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/types/gifts/Gift;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun sendGiftToChat (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/PublicChat;Ldev/inmo/tgbotapi/types/gifts/Gift;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun sendGiftToChat (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/PublicChat;Ldev/inmo/tgbotapi/types/gifts/Gift;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun sendGiftToChat (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/types/gifts/Gift$Regular;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun sendGiftToChat (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/types/gifts/Gift$Regular;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun sendGiftToChat (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/PublicChat;Ldev/inmo/tgbotapi/types/gifts/Gift$Regular;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun sendGiftToChat (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/PublicChat;Ldev/inmo/tgbotapi/types/gifts/Gift$Regular;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun sendGiftToChat-0SDnvgk (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/PublicChat;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun sendGiftToChat-GROm3fU (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/PublicChat;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}

View File

@@ -666,12 +666,16 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/W
public static synthetic fun waitPublicChatEvents$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitRefundedPaymentEvents (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitRefundedPaymentEvents$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitRegularGiftSentOrReceived (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitRegularGiftSentOrReceived$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitSuccessfulPaymentEvents (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitSuccessfulPaymentEvents$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitSupergroupChatCreatedEvents (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitSupergroupChatCreatedEvents$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitSupergroupEvents (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitSupergroupEvents$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitUniqueGiftSentOrReceived (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitUniqueGiftSentOrReceived$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitUserLoggedInEvents (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitUserLoggedInEvents$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitUserShared (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
@@ -757,12 +761,16 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/W
public static synthetic fun waitPublicChatEventsMessages$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitRefundedPaymentEventsMessages (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitRefundedPaymentEventsMessages$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitRegularGiftSentOrReceivedMessages (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitRegularGiftSentOrReceivedMessages$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitSuccessfulPaymentEventsMessages (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitSuccessfulPaymentEventsMessages$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitSupergroupChatCreatedEventsMessages (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitSupergroupChatCreatedEventsMessages$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitSupergroupEventsMessages (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitSupergroupEventsMessages$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitUniqueGiftSentOrReceivedMessages (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitUniqueGiftSentOrReceivedMessages$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitUserLoggedInEventsMessages (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun waitUserLoggedInEventsMessages$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun waitUserSharedEventsMessages (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
@@ -1364,12 +1372,16 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handl
public static synthetic fun onPublicChatEvent$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun onRefundedPayment (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun onRefundedPayment$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun onRegularGiftSentOrReceived (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun onRegularGiftSentOrReceived$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun onSuccessfulPayment (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun onSuccessfulPayment$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun onSupergroupChatCreated (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun onSupergroupChatCreated$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun onSupergroupEvent (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun onSupergroupEvent$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun onUniqueGiftSentOrReceived (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun onUniqueGiftSentOrReceived$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun onUserLoggedIn (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun onUserLoggedIn$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun onUserShared (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;

View File

@@ -7,9 +7,9 @@ import dev.inmo.tgbotapi.extensions.utils.*
import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.types.PaidMessagePriceChanged
import dev.inmo.tgbotapi.types.chat.ChatBackground
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.giveaway.GiveawayPublicResults
import dev.inmo.tgbotapi.types.message.ChatEvents.*
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.*
import dev.inmo.tgbotapi.types.message.ChatEvents.forum.ForumTopicClosed
@@ -254,3 +254,13 @@ suspend fun BehaviourContext.waitPaidMessagePriceChanged(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEvents<PaidMessagePriceChanged>(initRequest, errorFactory)
suspend fun BehaviourContext.waitRegularGiftSentOrReceived(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEvents<GiftSentOrReceived.Regular>(initRequest, errorFactory)
suspend fun BehaviourContext.waitUniqueGiftSentOrReceived(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEvents<GiftSentOrReceived.Unique>(initRequest, errorFactory)

View File

@@ -7,6 +7,7 @@ import dev.inmo.tgbotapi.extensions.utils.*
import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.types.PaidMessagePriceChanged
import dev.inmo.tgbotapi.types.chat.ChatBackground
import dev.inmo.tgbotapi.types.gifts.GiftSentOrReceived
import dev.inmo.tgbotapi.types.message.ChatEvents.*
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.*
import dev.inmo.tgbotapi.types.message.ChatEvents.forum.ForumTopicClosed
@@ -230,3 +231,13 @@ suspend fun BehaviourContext.waitPaidMessagePriceChangedMessages(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEventsMessages<PaidMessagePriceChanged>(initRequest, errorFactory)
suspend fun BehaviourContext.waitRegularGiftSentOrReceivedMessages(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEventsMessages<GiftSentOrReceived.Regular>(initRequest, errorFactory)
suspend fun BehaviourContext.waitUniqueGiftSentOrReceivedMessages(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEventsMessages<GiftSentOrReceived.Unique>(initRequest, errorFactory)

View File

@@ -12,9 +12,9 @@ import dev.inmo.tgbotapi.extensions.utils.baseSentMessageUpdateOrNull
import dev.inmo.tgbotapi.extensions.utils.chatEventMessageOrNull
import dev.inmo.tgbotapi.types.PaidMessagePriceChanged
import dev.inmo.tgbotapi.types.chat.ChatBackground
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.giveaway.GiveawayPublicResults
import dev.inmo.tgbotapi.types.message.ChatEvents.*
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.*
import dev.inmo.tgbotapi.types.message.ChatEvents.forum.ForumTopicClosed
@@ -1068,3 +1068,47 @@ suspend fun <BC : BehaviourContext> BC.onPaidMessagePriceChanged(
additionalSubcontextInitialAction: CustomBehaviourContextAndTwoTypesReceiver<BC, Unit, Update, ChatEventMessage<PaidMessagePriceChanged>>? = null,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<PaidMessagePriceChanged>>
) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, additionalSubcontextInitialAction, scenarioReceiver)
/**
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
* this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage].
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own.
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times]
* to combinate several filters
* @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream".
* [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for
* "stream"
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
* data
*/
suspend fun <BC : BehaviourContext> BC.onRegularGiftSentOrReceived(
initialFilter: SimpleFilter<ChatEventMessage<GiftSentOrReceived.Regular>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<GiftSentOrReceived.Regular>, Update>? = MessageFilterByChat,
markerFactory: MarkerFactory<in ChatEventMessage<GiftSentOrReceived.Regular>, Any>? = ByChatMessageMarkerFactory,
additionalSubcontextInitialAction: CustomBehaviourContextAndTwoTypesReceiver<BC, Unit, Update, ChatEventMessage<GiftSentOrReceived.Regular>>? = null,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<GiftSentOrReceived.Regular>>
) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, additionalSubcontextInitialAction, scenarioReceiver)
/**
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
* this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage].
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own.
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times]
* to combinate several filters
* @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream".
* [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for
* "stream"
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
* data
*/
suspend fun <BC : BehaviourContext> BC.onUniqueGiftSentOrReceived(
initialFilter: SimpleFilter<ChatEventMessage<GiftSentOrReceived.Unique>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<GiftSentOrReceived.Unique>, Update>? = MessageFilterByChat,
markerFactory: MarkerFactory<in ChatEventMessage<GiftSentOrReceived.Unique>, Any>? = ByChatMessageMarkerFactory,
additionalSubcontextInitialAction: CustomBehaviourContextAndTwoTypesReceiver<BC, Unit, Update, ChatEventMessage<GiftSentOrReceived.Unique>>? = null,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<GiftSentOrReceived.Unique>>
) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, additionalSubcontextInitialAction, scenarioReceiver)

File diff suppressed because it is too large Load Diff

View File

@@ -78,6 +78,6 @@ dependencies {
ksp {
arg("cctargetPackage", "dev.inmo.tgbotapi.extensions.utils")
arg("ccoutputFileName", "ClassCastsNew")
arg("ccoutputFolder", project(":tgbotapi.utils").file("src/commonMain/kotlin").absolutePath)
arg("ccoutputFileName", "ClassCastsNew.kt")
arg("ccoutputFolder", project(":tgbotapi.utils").file("src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils").absolutePath)
}

View File

@@ -1,72 +0,0 @@
package dev.inmo.tgbotapi.types.gifts
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.message.RawMessageEntities
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlin.jvm.JvmName
@Serializable
sealed interface GiftInfo {
val ownedGiftId: GiftId?
val gift: Gift
@Serializable
data class Regular(
@SerialName(giftField)
override val gift: Gift.Regular,
@SerialName(ownedGiftIdField)
override val ownedGiftId: GiftId? = null,
@SerialName(convertStarCountField)
val convertStarCount: Int? = null,
@SerialName(prepaidUpgradeStarCountField)
val prepaidUpgradeStarCount: Int? = null,
@SerialName(canBeUpgradedField)
val canBeUpgraded: Boolean = false,
@SerialName(textField)
val text: String? = null,
@SerialName(entitiesField)
val entities: RawMessageEntities = emptyList(),
@SerialName(isPrivateField)
val isPrivate: Boolean = false
) : GiftInfo {
companion object {
@JvmName("PublicConstructor")
operator fun invoke(
gift: Gift.Regular,
ownedGiftId: GiftId? = null,
convertStarCount: Int? = null,
prepaidUpgradeStarCount: Int? = null,
canBeUpgraded: Boolean = false,
text: String? = null,
textSources: TextSourcesList = emptyList(),
position: Int,
isPrivate: Boolean = false
) = Regular(
gift,
ownedGiftId,
convertStarCount,
prepaidUpgradeStarCount,
canBeUpgraded,
text,
textSources.toRawMessageEntities(position),
isPrivate
)
}
}
@Serializable
data class Unique(
@SerialName(giftField)
override val gift: Gift.Unique,
@SerialName(originField)
val origin: String? = null,
@SerialName(ownedGiftIdField)
override val ownedGiftId: GiftId? = null,
@SerialName(transferStarCountField)
val transferStarCount: Int? = null
): GiftInfo
}

View File

@@ -0,0 +1,286 @@
package dev.inmo.tgbotapi.types.gifts
import dev.inmo.tgbotapi.abstracts.TextedInput
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.CommonEvent
import dev.inmo.tgbotapi.types.message.RawMessageEntities
import dev.inmo.tgbotapi.types.message.asTextSources
import dev.inmo.tgbotapi.types.message.textsources.TextSource
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
import kotlinx.serialization.KSerializer
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder
import kotlin.jvm.JvmName
/**
* Represent Telegram Bots API abstraction [GiftInfo](https://core.telegram.org/bots/api#giftinfo) and
* [UniqueGiftInfo](https://core.telegram.org/bots/api#uniquegiftinfo)
*
* @see ReceivedInBusinessAccount
* @see Regular.Common
* @see Regular.ReceivedInBusinessAccount
* @see Unique.Common
* @see Unique.ReceivedInBusinessAccount
*/
@Serializable
sealed interface GiftSentOrReceived : CommonEvent {
val ownedGiftId: GiftId?
val gift: Gift
@Serializable
sealed interface ReceivedInBusinessAccount : GiftSentOrReceived {
override val ownedGiftId: GiftId
}
@Serializable(Regular.Companion::class)
sealed interface Regular : GiftSentOrReceived, TextedInput {
override val gift: Gift.Regular
val convertStarCount: Int?
val prepaidUpgradeStarCount: Int?
val canBeUpgraded: Boolean
val isPrivate: Boolean
@Serializable
data class Common(
@SerialName(giftField)
override val gift: Gift.Regular,
@SerialName(convertStarCountField)
override val convertStarCount: Int? = null,
@SerialName(prepaidUpgradeStarCountField)
override val prepaidUpgradeStarCount: Int? = null,
@SerialName(canBeUpgradedField)
override val canBeUpgraded: Boolean = false,
@SerialName(textField)
override val text: String? = null,
@SerialName(entitiesField)
private val entities: RawMessageEntities? = null,
@SerialName(isPrivateField)
override val isPrivate: Boolean = false
) : Regular {
override val textSources: List<TextSource> by lazy {
entities ?.asTextSources(text ?: return@lazy emptyList()) ?: emptyList()
}
override val ownedGiftId: GiftId?
get() = null
}
@Serializable
data class ReceivedInBusinessAccount(
@SerialName(giftField)
override val gift: Gift.Regular,
@SerialName(ownedGiftIdField)
override val ownedGiftId: GiftId,
@SerialName(convertStarCountField)
override val convertStarCount: Int? = null,
@SerialName(prepaidUpgradeStarCountField)
override val prepaidUpgradeStarCount: Int? = null,
@SerialName(canBeUpgradedField)
override val canBeUpgraded: Boolean = false,
@SerialName(textField)
override val text: String? = null,
@SerialName(entitiesField)
private val entities: RawMessageEntities? = null,
@SerialName(isPrivateField)
override val isPrivate: Boolean = false
) : Regular, GiftSentOrReceived.ReceivedInBusinessAccount {
override val textSources: List<TextSource> by lazy {
entities ?.asTextSources(text ?: return@lazy emptyList()) ?: emptyList()
}
}
companion object : KSerializer<GiftSentOrReceived.Regular> {
@Serializable
private data class Surrogate(
@SerialName(giftField)
val gift: Gift.Regular,
@SerialName(ownedGiftIdField)
val ownedGiftId: GiftId? = null,
@SerialName(convertStarCountField)
val convertStarCount: Int? = null,
@SerialName(prepaidUpgradeStarCountField)
val prepaidUpgradeStarCount: Int? = null,
@SerialName(canBeUpgradedField)
val canBeUpgraded: Boolean = false,
@SerialName(textField)
val text: String? = null,
@SerialName(entitiesField)
val entities: RawMessageEntities? = null,
@SerialName(isPrivateField)
val isPrivate: Boolean = false
)
override val descriptor: SerialDescriptor
get() = Surrogate.serializer().descriptor
override fun serialize(encoder: Encoder, value: Regular) {
when (value) {
is Common -> Common.serializer().serialize(encoder, value)
is ReceivedInBusinessAccount -> ReceivedInBusinessAccount.serializer().serialize(encoder, value)
}
}
override fun deserialize(decoder: Decoder): Regular {
val surrogate = Surrogate.serializer().deserialize(decoder)
return when {
surrogate.ownedGiftId == null -> {
Common(
gift = surrogate.gift,
convertStarCount = surrogate.convertStarCount,
prepaidUpgradeStarCount = surrogate.prepaidUpgradeStarCount,
canBeUpgraded = surrogate.canBeUpgraded,
text = surrogate.text,
entities = surrogate.entities,
isPrivate = surrogate.isPrivate
)
}
else -> {
ReceivedInBusinessAccount(
gift = surrogate.gift,
ownedGiftId = surrogate.ownedGiftId,
convertStarCount = surrogate.convertStarCount,
prepaidUpgradeStarCount = surrogate.prepaidUpgradeStarCount,
canBeUpgraded = surrogate.canBeUpgraded,
text = surrogate.text,
entities = surrogate.entities,
isPrivate = surrogate.isPrivate
)
}
}
}
@JvmName("PublicConstructor")
operator fun invoke(
gift: Gift.Regular,
ownedGiftId: GiftId? = null,
convertStarCount: Int? = null,
prepaidUpgradeStarCount: Int? = null,
canBeUpgraded: Boolean = false,
text: String? = null,
textSources: TextSourcesList = emptyList(),
position: Int,
isPrivate: Boolean = false
) = ownedGiftId ?.let {
ReceivedInBusinessAccount(
gift,
ownedGiftId,
convertStarCount,
prepaidUpgradeStarCount,
canBeUpgraded,
text,
textSources.toRawMessageEntities(position),
isPrivate
)
} ?: Common(
gift,
convertStarCount,
prepaidUpgradeStarCount,
canBeUpgraded,
text,
textSources.toRawMessageEntities(position),
isPrivate
)
}
}
@Serializable(Unique.Companion::class)
sealed interface Unique : GiftSentOrReceived {
override val gift: Gift.Unique
val origin: String?
val transferStarCount: Int?
@Serializable
data class Common(
@SerialName(giftField)
override val gift: Gift.Unique,
@SerialName(originField)
override val origin: String? = null,
@SerialName(transferStarCountField)
override val transferStarCount: Int? = null
) : Unique {
override val ownedGiftId: GiftId?
get() = null
}
@Serializable
data class ReceivedInBusinessAccount(
@SerialName(giftField)
override val gift: Gift.Unique,
@SerialName(ownedGiftIdField)
override val ownedGiftId: GiftId,
@SerialName(originField)
override val origin: String? = null,
@SerialName(transferStarCountField)
override val transferStarCount: Int? = null
) : Unique, GiftSentOrReceived.ReceivedInBusinessAccount
companion object : KSerializer<GiftSentOrReceived.Unique> {
@Serializable
private data class Surrogate(
@SerialName(giftField)
val gift: Gift.Unique,
@SerialName(ownedGiftIdField)
val ownedGiftId: GiftId? = null,
@SerialName(originField)
val origin: String? = null,
@SerialName(transferStarCountField)
val transferStarCount: Int? = null
)
override val descriptor: SerialDescriptor
get() = Surrogate.serializer().descriptor
override fun serialize(encoder: Encoder, value: Unique) {
when (value) {
is Common -> Common.serializer().serialize(encoder, value)
is ReceivedInBusinessAccount -> ReceivedInBusinessAccount.serializer().serialize(encoder, value)
}
}
override fun deserialize(decoder: Decoder): Unique {
val surrogate = Surrogate.serializer().deserialize(decoder)
return when {
surrogate.ownedGiftId == null -> {
Common(
gift = surrogate.gift,
origin = surrogate.origin,
transferStarCount = surrogate.transferStarCount
)
}
else -> {
ReceivedInBusinessAccount(
gift = surrogate.gift,
ownedGiftId = surrogate.ownedGiftId,
origin = surrogate.origin,
transferStarCount = surrogate.transferStarCount
)
}
}
}
@JvmName("PublicConstructor")
operator fun invoke(
gift: Gift.Unique,
origin: String? = null,
ownedGiftId: GiftId? = null,
transferStarCount: Int? = null
) = ownedGiftId ?.let {
ReceivedInBusinessAccount(
gift,
ownedGiftId,
origin,
transferStarCount,
)
} ?: Common(
gift,
origin,
transferStarCount,
)
}
}
}

View File

@@ -20,6 +20,7 @@ sealed interface ForwardInfo {
override val from: User
) : ForwardInfo, FromUser
@ClassCastsIncluded.ExcludeSubName
sealed interface PublicChat : ForwardInfo {
val chat: dev.inmo.tgbotapi.types.chat.PublicChat

View File

@@ -10,7 +10,7 @@ import dev.inmo.tgbotapi.types.dice.Dice
import dev.inmo.tgbotapi.types.files.*
import dev.inmo.tgbotapi.types.files.Sticker
import dev.inmo.tgbotapi.types.games.RawGame
import dev.inmo.tgbotapi.types.gifts.GiftInfo
import dev.inmo.tgbotapi.types.gifts.GiftSentOrReceived
import dev.inmo.tgbotapi.types.giveaway.*
import dev.inmo.tgbotapi.types.message.content.GiveawayContent
import dev.inmo.tgbotapi.types.location.Location
@@ -166,7 +166,8 @@ internal data class RawMessage(
private val giveaway_completed: GiveawayPrivateResults? = null,
// Gifts
private val gift: GiftInfo? = null,
private val gift: GiftSentOrReceived.Regular? = null,
private val unique_gift: GiftSentOrReceived.Unique? = null,
) {
private val checkedFrom = from ?.takeIf { !it.isFakeTelegramUser() }
private val content: MessageContent? by lazy {
@@ -290,6 +291,8 @@ internal data class RawMessage(
boost_added != null -> boost_added
chat_background_set != null -> chat_background_set
paid_message_price_changed != null -> paid_message_price_changed
gift != null -> gift
unique_gift != null -> unique_gift
else -> null
}
}

View File

@@ -1,5 +1,8 @@
package dev.inmo.tgbotapi.utils
import dev.inmo.micro_utils.common.Either
import dev.inmo.micro_utils.common.EitherFirst
import dev.inmo.micro_utils.common.EitherSecond
import kotlinx.serialization.KSerializer
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.json.JsonDecoder
@@ -13,3 +16,18 @@ fun <T> Decoder.deserializeWithRaw(serializer: KSerializer<T>): Pair<T, JsonElem
serializer.deserialize(this) to null
}
}
fun <T> Decoder.deserializeEitherWithRaw(serializer: KSerializer<T>): Either<Pair<T?, JsonElement>, Pair<T, JsonElement?>> {
return if (this is JsonDecoder) {
val json = decodeJsonElement()
EitherFirst(
runCatching {
this.json.decodeFromJsonElement(serializer, json)
}.getOrNull() to json
)
} else {
EitherSecond(
serializer.deserialize(this) to null
)
}
}

View File

@@ -5,7 +5,12 @@ import dev.inmo.tgbotapi.utils.RiskFeature
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.SOURCE)
@RiskFeature("It is internal API in tgbotapi.core and should not be used outside")
annotation class ClassCastsIncluded(val typesRegex: String = "", val excludeRegex: String = "")
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 ExcludeSubName
}
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.SOURCE)

View File

@@ -9,5 +9,6 @@ repositories {
dependencies {
implementation libs.kotlin.poet
implementation libs.ksp
implementation libs.microutils.ksp.generator
implementation project(":tgbotapi.core")
}

View File

@@ -1,9 +1,13 @@
package dev.inmo.tgbotapi.ksp.processor
import com.google.devtools.ksp.KspExperimental
import com.google.devtools.ksp.getAnnotationsByType
import com.google.devtools.ksp.isAnnotationPresent
import com.google.devtools.ksp.symbol.*
import com.squareup.kotlinpoet.*
import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.parameterizedBy
import com.squareup.kotlinpoet.ksp.*
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
private fun FileSpec.Builder.addTopLevelImport(className: ClassName) {
className.topLevelClassName().let {
@@ -27,6 +31,24 @@ private fun FileSpec.Builder.createTypeDefinition(ksClassDeclaration: KSClassDec
}
}
@OptIn(KspExperimental::class)
private fun KSClassDeclaration.buildPrefix(sourceDeclaration: KSClassDeclaration): String {
val ownName = if (isAnnotationPresent(ClassCastsIncluded.ExcludeSubName::class)) {
""
} else {
simpleName.asString()
}
when (val parentDeclaration = parentDeclaration) {
is KSClassDeclaration -> if (parentDeclaration === sourceDeclaration) {
return ownName
} else {
return "${parentDeclaration.buildPrefix(sourceDeclaration)}$ownName"
}
}
return ownName
}
@OptIn(KspExperimental::class)
fun FileSpec.Builder.fill(
sourceKSClassDeclaration: KSClassDeclaration,
subtypesMap: Map<KSClassDeclaration, Set<KSClassDeclaration>>,
@@ -40,8 +62,10 @@ fun FileSpec.Builder.fill(
val sourceClassName = sourceKSClassDeclaration.toClassName()
val targetClassClassName = targetClassDeclaration.toClassName()
val targetClassTypeDefinition = createTypeDefinition(targetClassDeclaration)
val simpleName = targetClassDeclaration.simpleName.asString()
val withFirstLowerCase = simpleName.replaceFirstChar { it.lowercase() }
// val simpleName = targetClassDeclaration.simpleName.asString()
// val additionalPrefix = targetClassDeclaration.buildPrefix()
val resultPrefix = targetClassDeclaration.buildPrefix(sourceKSClassDeclaration)
val withFirstLowerCase = resultPrefix.replaceFirstChar { it.lowercase() }
val castedOrNullName = "${withFirstLowerCase}OrNull"
addTopLevelImport(targetClassClassName)
@@ -68,7 +92,7 @@ fun FileSpec.Builder.fill(
}.build()
)
addFunction(
FunSpec.builder("if$simpleName").apply {
FunSpec.builder("if$resultPrefix").apply {
val genericType = TypeVariableName("T", null)
addTypeVariable(genericType)
receiver(sourceClassName)

View File

@@ -1,22 +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.*
import com.google.devtools.ksp.processing.*
import com.google.devtools.ksp.symbol.KSAnnotated
import com.google.devtools.ksp.symbol.KSClassDeclaration
import com.google.devtools.ksp.symbol.*
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.micro_ksp.generator.resolveSubclasses
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.ChatEvent
import dev.inmo.tgbotapi.utils.RiskFeature
import dev.inmo.tgbotapi.utils.internal.ClassCastsExcluded
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
import java.io.File
import java.io.InputStream
import java.io.OutputStreamWriter
import java.io.StringWriter
class TelegramBotAPISymbolProcessor(
private val codeGenerator: CodeGenerator,
@@ -37,7 +36,14 @@ class TelegramBotAPISymbolProcessor(
val classesSubtypes = mutableMapOf<KSClassDeclaration, MutableSet<KSClassDeclaration>>()
resolver.getAllFiles().forEach {
it.declarations.forEach { potentialSubtype ->
val declarationsToAnalyze = mutableSetOf<KSDeclaration>()
declarationsToAnalyze.addAll(it.declarations)
val analyzed = mutableSetOf<KSDeclaration>()
while (declarationsToAnalyze.isNotEmpty()) {
val potentialSubtype = declarationsToAnalyze.first()
declarationsToAnalyze.remove(potentialSubtype)
if (analyzed.add(potentialSubtype)) {
if (
potentialSubtype is KSClassDeclaration
&& potentialSubtype.isAnnotationPresent(ClassCastsExcluded::class).not()
@@ -57,6 +63,12 @@ class TelegramBotAPISymbolProcessor(
}
}
}
when (potentialSubtype) {
is KSFile -> declarationsToAnalyze.addAll(potentialSubtype.declarations)
is KSClassDeclaration ->declarationsToAnalyze.addAll(potentialSubtype.declarations)
is KSFunctionDeclaration -> declarationsToAnalyze.addAll(potentialSubtype.declarations)
}
}
}
}
fun fillWithSealeds(source: KSClassDeclaration, current: KSClassDeclaration = source) {
@@ -98,15 +110,21 @@ class TelegramBotAPISymbolProcessor(
)
}
}.build()
runCatching {
outputFolder ?.also {
File(it).apply {
File(it, outputFile).apply {
val text = StringWriter().use {
fileSpec.writeTo(it)
it.toString()
}
if (exists() == false || readText() != text) {
delete()
runCatching { mkdirs() }
fileSpec.writeTo(this)
runCatching { parentFile.mkdirs() }
createNewFile()
writeText(text)
}
}
} ?: fileSpec.writeTo(codeGenerator, false)
}
return emptyList()
}

View File

@@ -1447,6 +1447,8 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun generalForumTopicUnhiddenOrThrow (Ldev/inmo/tgbotapi/types/message/ChatEvents/abstracts/ChatEvent;)Ldev/inmo/tgbotapi/types/message/ChatEvents/forum/GeneralForumTopicUnhidden;
public static final fun giftCodeOrNull (Ldev/inmo/tgbotapi/types/boosts/ChatBoostSource;)Ldev/inmo/tgbotapi/types/boosts/ChatBoostSource$GiftCode;
public static final fun giftCodeOrThrow (Ldev/inmo/tgbotapi/types/boosts/ChatBoostSource;)Ldev/inmo/tgbotapi/types/boosts/ChatBoostSource$GiftCode;
public static final fun giftSentOrReceivedOrNull (Ldev/inmo/tgbotapi/types/message/ChatEvents/abstracts/ChatEvent;)Ldev/inmo/tgbotapi/types/gifts/GiftSentOrReceived;
public static final fun giftSentOrReceivedOrThrow (Ldev/inmo/tgbotapi/types/message/ChatEvents/abstracts/ChatEvent;)Ldev/inmo/tgbotapi/types/gifts/GiftSentOrReceived;
public static final fun giveawayContentOrNull (Ldev/inmo/tgbotapi/types/message/content/ResendableContent;)Ldev/inmo/tgbotapi/types/message/content/GiveawayContent;
public static final fun giveawayContentOrThrow (Ldev/inmo/tgbotapi/types/message/content/ResendableContent;)Ldev/inmo/tgbotapi/types/message/content/GiveawayContent;
public static final fun giveawayCreatedOrNull (Ldev/inmo/tgbotapi/types/message/ChatEvents/abstracts/ChatEvent;)Ldev/inmo/tgbotapi/types/giveaway/GiveawayCreated;
@@ -1676,6 +1678,7 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun ifGeneralForumTopicHidden (Ldev/inmo/tgbotapi/types/message/ChatEvents/abstracts/ChatEvent;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifGeneralForumTopicUnhidden (Ldev/inmo/tgbotapi/types/message/ChatEvents/abstracts/ChatEvent;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifGiftCode (Ldev/inmo/tgbotapi/types/boosts/ChatBoostSource;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifGiftSentOrReceived (Ldev/inmo/tgbotapi/types/message/ChatEvents/abstracts/ChatEvent;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifGiveaway (Ldev/inmo/tgbotapi/types/boosts/ChatBoostSource;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifGiveawayContent (Ldev/inmo/tgbotapi/types/message/content/ResendableContent;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifGiveawayCreated (Ldev/inmo/tgbotapi/types/message/ChatEvents/abstracts/ChatEvent;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;

View File

@@ -216,6 +216,7 @@ import dev.inmo.tgbotapi.types.files.VideoFile
import dev.inmo.tgbotapi.types.files.VideoNoteFile
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
@@ -827,6 +828,15 @@ public inline fun <T>
OptionallyWithUser.ifCommonSupergroupEventMessage(block: (CommonSupergroupEventMessage<SupergroupEvent>) -> T):
T? = commonSupergroupEventMessageOrNull() ?.let(block)
public inline fun OptionallyWithUser.forwardInfoByUserOrNull(): ForwardInfo.ByUser? = this as?
dev.inmo.tgbotapi.types.message.ForwardInfo.ByUser
public inline fun OptionallyWithUser.forwardInfoByUserOrThrow(): ForwardInfo.ByUser = this as
dev.inmo.tgbotapi.types.message.ForwardInfo.ByUser
public inline fun <T> OptionallyWithUser.ifForwardInfoByUser(block: (ForwardInfo.ByUser) -> T): T? =
forwardInfoByUserOrNull() ?.let(block)
public inline fun OptionallyWithUser.passportMessageOrNull(): PassportMessage? = this as?
dev.inmo.tgbotapi.types.message.PassportMessage
@@ -975,6 +985,24 @@ public inline fun OptionallyWithUser.pollAnswerOrThrow(): PollAnswer = this as
public inline fun <T> OptionallyWithUser.ifPollAnswer(block: (PollAnswer) -> T): T? =
pollAnswerOrNull() ?.let(block)
public inline fun OptionallyWithUser.pollAnswerPublicOrNull(): PollAnswer.Public? = this as?
dev.inmo.tgbotapi.types.polls.PollAnswer.Public
public inline fun OptionallyWithUser.pollAnswerPublicOrThrow(): PollAnswer.Public = this as
dev.inmo.tgbotapi.types.polls.PollAnswer.Public
public inline fun <T> OptionallyWithUser.ifPollAnswerPublic(block: (PollAnswer.Public) -> T): T? =
pollAnswerPublicOrNull() ?.let(block)
public inline fun OptionallyWithUser.pollAnswerAnonymousOrNull(): PollAnswer.Anonymous? = this as?
dev.inmo.tgbotapi.types.polls.PollAnswer.Anonymous
public inline fun OptionallyWithUser.pollAnswerAnonymousOrThrow(): PollAnswer.Anonymous = this as
dev.inmo.tgbotapi.types.polls.PollAnswer.Anonymous
public inline fun <T> OptionallyWithUser.ifPollAnswerAnonymous(block: (PollAnswer.Anonymous) -> T):
T? = pollAnswerAnonymousOrNull() ?.let(block)
public inline fun OptionallyWithUser.abstractMessageCallbackQueryOrNull():
AbstractMessageCallbackQuery? = this as?
dev.inmo.tgbotapi.types.queries.callback.AbstractMessageCallbackQuery
@@ -1128,6 +1156,16 @@ public inline fun <T>
OptionallyWithUser.ifMessageGameShortNameCallbackQuery(block: (MessageGameShortNameCallbackQuery) -> T):
T? = messageGameShortNameCallbackQueryOrNull() ?.let(block)
public inline fun InlineQueryResultsButton.webAppOrNull(): InlineQueryResultsButton.WebApp? = this
as? dev.inmo.tgbotapi.requests.answers.InlineQueryResultsButton.WebApp
public inline fun InlineQueryResultsButton.webAppOrThrow(): InlineQueryResultsButton.WebApp = this
as dev.inmo.tgbotapi.requests.answers.InlineQueryResultsButton.WebApp
public inline fun <T>
InlineQueryResultsButton.ifWebApp(block: (InlineQueryResultsButton.WebApp) -> T): T? =
webAppOrNull() ?.let(block)
public inline fun InlineQueryResultsButton.startOrNull(): InlineQueryResultsButton.Start? = this as?
dev.inmo.tgbotapi.requests.answers.InlineQueryResultsButton.Start
@@ -1148,16 +1186,6 @@ public inline fun <T>
InlineQueryResultsButton.ifUnknown(block: (InlineQueryResultsButton.Unknown) -> T): T? =
unknownOrNull() ?.let(block)
public inline fun InlineQueryResultsButton.webAppOrNull(): InlineQueryResultsButton.WebApp? = this
as? dev.inmo.tgbotapi.requests.answers.InlineQueryResultsButton.WebApp
public inline fun InlineQueryResultsButton.webAppOrThrow(): InlineQueryResultsButton.WebApp = this
as dev.inmo.tgbotapi.requests.answers.InlineQueryResultsButton.WebApp
public inline fun <T>
InlineQueryResultsButton.ifWebApp(block: (InlineQueryResultsButton.WebApp) -> T): T? =
webAppOrNull() ?.let(block)
public inline fun InputSticker.maskOrNull(): InputSticker.Mask? = this as?
dev.inmo.tgbotapi.requests.stickers.InputSticker.Mask
@@ -1176,24 +1204,45 @@ public inline fun InputSticker.withKeywordsOrThrow(): InputSticker.WithKeywords
public inline fun <T> InputSticker.ifWithKeywords(block: (InputSticker.WithKeywords) -> T): T? =
withKeywordsOrNull() ?.let(block)
public inline fun InputSticker.customEmojiOrNull(): InputSticker.WithKeywords.CustomEmoji? = this
as? dev.inmo.tgbotapi.requests.stickers.InputSticker.WithKeywords.CustomEmoji
public inline fun InputSticker.withKeywordsRegularOrNull(): InputSticker.WithKeywords.Regular? =
this as? dev.inmo.tgbotapi.requests.stickers.InputSticker.WithKeywords.Regular
public inline fun InputSticker.customEmojiOrThrow(): InputSticker.WithKeywords.CustomEmoji = this as
public inline fun InputSticker.withKeywordsRegularOrThrow(): InputSticker.WithKeywords.Regular =
this as dev.inmo.tgbotapi.requests.stickers.InputSticker.WithKeywords.Regular
public inline fun <T>
InputSticker.ifWithKeywordsRegular(block: (InputSticker.WithKeywords.Regular) -> T): T? =
withKeywordsRegularOrNull() ?.let(block)
public inline fun InputSticker.withKeywordsCustomEmojiOrNull():
InputSticker.WithKeywords.CustomEmoji? = this as?
dev.inmo.tgbotapi.requests.stickers.InputSticker.WithKeywords.CustomEmoji
public inline fun InputSticker.withKeywordsCustomEmojiOrThrow():
InputSticker.WithKeywords.CustomEmoji = this as
dev.inmo.tgbotapi.requests.stickers.InputSticker.WithKeywords.CustomEmoji
public inline fun <T>
InputSticker.ifCustomEmoji(block: (InputSticker.WithKeywords.CustomEmoji) -> T): T? =
customEmojiOrNull() ?.let(block)
InputSticker.ifWithKeywordsCustomEmoji(block: (InputSticker.WithKeywords.CustomEmoji) -> T): T?
= withKeywordsCustomEmojiOrNull() ?.let(block)
public inline fun InputSticker.regularOrNull(): InputSticker.WithKeywords.Regular? = this as?
dev.inmo.tgbotapi.requests.stickers.InputSticker.WithKeywords.Regular
public inline fun BackgroundFill.solidOrNull(): BackgroundFill.Solid? = this as?
dev.inmo.tgbotapi.types.BackgroundFill.Solid
public inline fun InputSticker.regularOrThrow(): InputSticker.WithKeywords.Regular = this as
dev.inmo.tgbotapi.requests.stickers.InputSticker.WithKeywords.Regular
public inline fun BackgroundFill.solidOrThrow(): BackgroundFill.Solid = this as
dev.inmo.tgbotapi.types.BackgroundFill.Solid
public inline fun <T> InputSticker.ifRegular(block: (InputSticker.WithKeywords.Regular) -> T): T? =
regularOrNull() ?.let(block)
public inline fun <T> BackgroundFill.ifSolid(block: (BackgroundFill.Solid) -> T): T? = solidOrNull()
?.let(block)
public inline fun BackgroundFill.gradientOrNull(): BackgroundFill.Gradient? = this as?
dev.inmo.tgbotapi.types.BackgroundFill.Gradient
public inline fun BackgroundFill.gradientOrThrow(): BackgroundFill.Gradient = this as
dev.inmo.tgbotapi.types.BackgroundFill.Gradient
public inline fun <T> BackgroundFill.ifGradient(block: (BackgroundFill.Gradient) -> T): T? =
gradientOrNull() ?.let(block)
public inline fun BackgroundFill.freeformGradientOrNull(): BackgroundFill.FreeformGradient? = this
as? dev.inmo.tgbotapi.types.BackgroundFill.FreeformGradient
@@ -1205,24 +1254,6 @@ public inline fun <T>
BackgroundFill.ifFreeformGradient(block: (BackgroundFill.FreeformGradient) -> T): T? =
freeformGradientOrNull() ?.let(block)
public inline fun BackgroundFill.gradientOrNull(): BackgroundFill.Gradient? = this as?
dev.inmo.tgbotapi.types.BackgroundFill.Gradient
public inline fun BackgroundFill.gradientOrThrow(): BackgroundFill.Gradient = this as
dev.inmo.tgbotapi.types.BackgroundFill.Gradient
public inline fun <T> BackgroundFill.ifGradient(block: (BackgroundFill.Gradient) -> T): T? =
gradientOrNull() ?.let(block)
public inline fun BackgroundFill.solidOrNull(): BackgroundFill.Solid? = this as?
dev.inmo.tgbotapi.types.BackgroundFill.Solid
public inline fun BackgroundFill.solidOrThrow(): BackgroundFill.Solid = this as
dev.inmo.tgbotapi.types.BackgroundFill.Solid
public inline fun <T> BackgroundFill.ifSolid(block: (BackgroundFill.Solid) -> T): T? = solidOrNull()
?.let(block)
public inline fun BackgroundFill.unknownOrNull(): BackgroundFill.Unknown? = this as?
dev.inmo.tgbotapi.types.BackgroundFill.Unknown
@@ -1232,14 +1263,14 @@ public inline fun BackgroundFill.unknownOrThrow(): BackgroundFill.Unknown = this
public inline fun <T> BackgroundFill.ifUnknown(block: (BackgroundFill.Unknown) -> T): T? =
unknownOrNull() ?.let(block)
public inline fun BackgroundType.chatThemeOrNull(): BackgroundType.ChatTheme? = this as?
dev.inmo.tgbotapi.types.BackgroundType.ChatTheme
public inline fun BackgroundType.movableOrNull(): BackgroundType.Movable? = this as?
dev.inmo.tgbotapi.types.BackgroundType.Movable
public inline fun BackgroundType.chatThemeOrThrow(): BackgroundType.ChatTheme = this as
dev.inmo.tgbotapi.types.BackgroundType.ChatTheme
public inline fun BackgroundType.movableOrThrow(): BackgroundType.Movable = this as
dev.inmo.tgbotapi.types.BackgroundType.Movable
public inline fun <T> BackgroundType.ifChatTheme(block: (BackgroundType.ChatTheme) -> T): T? =
chatThemeOrNull() ?.let(block)
public inline fun <T> BackgroundType.ifMovable(block: (BackgroundType.Movable) -> T): T? =
movableOrNull() ?.let(block)
public inline fun BackgroundType.dimmableOrNull(): BackgroundType.Dimmable? = this as?
dev.inmo.tgbotapi.types.BackgroundType.Dimmable
@@ -1250,6 +1281,24 @@ public inline fun BackgroundType.dimmableOrThrow(): BackgroundType.Dimmable = th
public inline fun <T> BackgroundType.ifDimmable(block: (BackgroundType.Dimmable) -> T): T? =
dimmableOrNull() ?.let(block)
public inline fun BackgroundType.fillableOrNull(): BackgroundType.Fillable? = this as?
dev.inmo.tgbotapi.types.BackgroundType.Fillable
public inline fun BackgroundType.fillableOrThrow(): BackgroundType.Fillable = this as
dev.inmo.tgbotapi.types.BackgroundType.Fillable
public inline fun <T> BackgroundType.ifFillable(block: (BackgroundType.Fillable) -> T): T? =
fillableOrNull() ?.let(block)
public inline fun BackgroundType.withDocumentOrNull(): BackgroundType.WithDocument? = this as?
dev.inmo.tgbotapi.types.BackgroundType.WithDocument
public inline fun BackgroundType.withDocumentOrThrow(): BackgroundType.WithDocument = this as
dev.inmo.tgbotapi.types.BackgroundType.WithDocument
public inline fun <T> BackgroundType.ifWithDocument(block: (BackgroundType.WithDocument) -> T): T? =
withDocumentOrNull() ?.let(block)
public inline fun BackgroundType.fillOrNull(): BackgroundType.Fill? = this as?
dev.inmo.tgbotapi.types.BackgroundType.Fill
@@ -1268,15 +1317,6 @@ public inline fun BackgroundType.wallpaperOrThrow(): BackgroundType.Wallpaper =
public inline fun <T> BackgroundType.ifWallpaper(block: (BackgroundType.Wallpaper) -> T): T? =
wallpaperOrNull() ?.let(block)
public inline fun BackgroundType.fillableOrNull(): BackgroundType.Fillable? = this as?
dev.inmo.tgbotapi.types.BackgroundType.Fillable
public inline fun BackgroundType.fillableOrThrow(): BackgroundType.Fillable = this as
dev.inmo.tgbotapi.types.BackgroundType.Fillable
public inline fun <T> BackgroundType.ifFillable(block: (BackgroundType.Fillable) -> T): T? =
fillableOrNull() ?.let(block)
public inline fun BackgroundType.patternOrNull(): BackgroundType.Pattern? = this as?
dev.inmo.tgbotapi.types.BackgroundType.Pattern
@@ -1286,14 +1326,14 @@ public inline fun BackgroundType.patternOrThrow(): BackgroundType.Pattern = this
public inline fun <T> BackgroundType.ifPattern(block: (BackgroundType.Pattern) -> T): T? =
patternOrNull() ?.let(block)
public inline fun BackgroundType.movableOrNull(): BackgroundType.Movable? = this as?
dev.inmo.tgbotapi.types.BackgroundType.Movable
public inline fun BackgroundType.chatThemeOrNull(): BackgroundType.ChatTheme? = this as?
dev.inmo.tgbotapi.types.BackgroundType.ChatTheme
public inline fun BackgroundType.movableOrThrow(): BackgroundType.Movable = this as
dev.inmo.tgbotapi.types.BackgroundType.Movable
public inline fun BackgroundType.chatThemeOrThrow(): BackgroundType.ChatTheme = this as
dev.inmo.tgbotapi.types.BackgroundType.ChatTheme
public inline fun <T> BackgroundType.ifMovable(block: (BackgroundType.Movable) -> T): T? =
movableOrNull() ?.let(block)
public inline fun <T> BackgroundType.ifChatTheme(block: (BackgroundType.ChatTheme) -> T): T? =
chatThemeOrNull() ?.let(block)
public inline fun BackgroundType.unknownOrNull(): BackgroundType.Unknown? = this as?
dev.inmo.tgbotapi.types.BackgroundType.Unknown
@@ -1304,15 +1344,6 @@ public inline fun BackgroundType.unknownOrThrow(): BackgroundType.Unknown = this
public inline fun <T> BackgroundType.ifUnknown(block: (BackgroundType.Unknown) -> T): T? =
unknownOrNull() ?.let(block)
public inline fun BackgroundType.withDocumentOrNull(): BackgroundType.WithDocument? = this as?
dev.inmo.tgbotapi.types.BackgroundType.WithDocument
public inline fun BackgroundType.withDocumentOrThrow(): BackgroundType.WithDocument = this as
dev.inmo.tgbotapi.types.BackgroundType.WithDocument
public inline fun <T> BackgroundType.ifWithDocument(block: (BackgroundType.WithDocument) -> T): T? =
withDocumentOrNull() ?.let(block)
public inline fun ChatIdentifier.idChatIdentifierOrNull(): IdChatIdentifier? = this as?
dev.inmo.tgbotapi.types.IdChatIdentifier
@@ -1846,51 +1877,6 @@ public inline fun <T>
InputMessageContent.ifInputVenueMessageContent(block: (InputVenueMessageContent) -> T): T? =
inputVenueMessageContentOrNull() ?.let(block)
public inline fun ReplyInfo.externalOrNull(): ReplyInfo.External? = this as?
dev.inmo.tgbotapi.types.ReplyInfo.External
public inline fun ReplyInfo.externalOrThrow(): ReplyInfo.External = this as
dev.inmo.tgbotapi.types.ReplyInfo.External
public inline fun <T> ReplyInfo.ifExternal(block: (ReplyInfo.External) -> T): T? = externalOrNull()
?.let(block)
public inline fun ReplyInfo.contentOrNull(): ReplyInfo.External.Content? = this as?
dev.inmo.tgbotapi.types.ReplyInfo.External.Content
public inline fun ReplyInfo.contentOrThrow(): ReplyInfo.External.Content = this as
dev.inmo.tgbotapi.types.ReplyInfo.External.Content
public inline fun <T> ReplyInfo.ifContent(block: (ReplyInfo.External.Content) -> T): T? =
contentOrNull() ?.let(block)
public inline fun ReplyInfo.mediaOrNull(): ReplyInfo.External.Content.Media? = this as?
dev.inmo.tgbotapi.types.ReplyInfo.External.Content.Media
public inline fun ReplyInfo.mediaOrThrow(): ReplyInfo.External.Content.Media = this as
dev.inmo.tgbotapi.types.ReplyInfo.External.Content.Media
public inline fun <T> ReplyInfo.ifMedia(block: (ReplyInfo.External.Content.Media) -> T): T? =
mediaOrNull() ?.let(block)
public inline fun ReplyInfo.simpleOrNull(): ReplyInfo.External.Content.Simple? = this as?
dev.inmo.tgbotapi.types.ReplyInfo.External.Content.Simple
public inline fun ReplyInfo.simpleOrThrow(): ReplyInfo.External.Content.Simple = this as
dev.inmo.tgbotapi.types.ReplyInfo.External.Content.Simple
public inline fun <T> ReplyInfo.ifSimple(block: (ReplyInfo.External.Content.Simple) -> T): T? =
simpleOrNull() ?.let(block)
public inline fun ReplyInfo.textOrNull(): ReplyInfo.External.Text? = this as?
dev.inmo.tgbotapi.types.ReplyInfo.External.Text
public inline fun ReplyInfo.textOrThrow(): ReplyInfo.External.Text = this as
dev.inmo.tgbotapi.types.ReplyInfo.External.Text
public inline fun <T> ReplyInfo.ifText(block: (ReplyInfo.External.Text) -> T): T? = textOrNull()
?.let(block)
public inline fun ReplyInfo.internalOrNull(): ReplyInfo.Internal? = this as?
dev.inmo.tgbotapi.types.ReplyInfo.Internal
@@ -1909,6 +1895,53 @@ public inline fun ReplyInfo.toStoryOrThrow(): ReplyInfo.ToStory = this as
public inline fun <T> ReplyInfo.ifToStory(block: (ReplyInfo.ToStory) -> T): T? = toStoryOrNull()
?.let(block)
public inline fun ReplyInfo.externalOrNull(): ReplyInfo.External? = this as?
dev.inmo.tgbotapi.types.ReplyInfo.External
public inline fun ReplyInfo.externalOrThrow(): ReplyInfo.External = this as
dev.inmo.tgbotapi.types.ReplyInfo.External
public inline fun <T> ReplyInfo.ifExternal(block: (ReplyInfo.External) -> T): T? = externalOrNull()
?.let(block)
public inline fun ReplyInfo.externalTextOrNull(): ReplyInfo.External.Text? = this as?
dev.inmo.tgbotapi.types.ReplyInfo.External.Text
public inline fun ReplyInfo.externalTextOrThrow(): ReplyInfo.External.Text = this as
dev.inmo.tgbotapi.types.ReplyInfo.External.Text
public inline fun <T> ReplyInfo.ifExternalText(block: (ReplyInfo.External.Text) -> T): T? =
externalTextOrNull() ?.let(block)
public inline fun ReplyInfo.externalContentOrNull(): ReplyInfo.External.Content? = this as?
dev.inmo.tgbotapi.types.ReplyInfo.External.Content
public inline fun ReplyInfo.externalContentOrThrow(): ReplyInfo.External.Content = this as
dev.inmo.tgbotapi.types.ReplyInfo.External.Content
public inline fun <T> ReplyInfo.ifExternalContent(block: (ReplyInfo.External.Content) -> T): T? =
externalContentOrNull() ?.let(block)
public inline fun ReplyInfo.externalContentSimpleOrNull(): ReplyInfo.External.Content.Simple? = this
as? dev.inmo.tgbotapi.types.ReplyInfo.External.Content.Simple
public inline fun ReplyInfo.externalContentSimpleOrThrow(): ReplyInfo.External.Content.Simple = this
as dev.inmo.tgbotapi.types.ReplyInfo.External.Content.Simple
public inline fun <T>
ReplyInfo.ifExternalContentSimple(block: (ReplyInfo.External.Content.Simple) -> T): T? =
externalContentSimpleOrNull() ?.let(block)
public inline fun ReplyInfo.externalContentMediaOrNull(): ReplyInfo.External.Content.Media? = this
as? dev.inmo.tgbotapi.types.ReplyInfo.External.Content.Media
public inline fun ReplyInfo.externalContentMediaOrThrow(): ReplyInfo.External.Content.Media = this
as dev.inmo.tgbotapi.types.ReplyInfo.External.Content.Media
public inline fun <T>
ReplyInfo.ifExternalContentMedia(block: (ReplyInfo.External.Content.Media) -> T): T? =
externalContentMediaOrNull() ?.let(block)
public inline fun BotAction.typingActionOrNull(): TypingAction? = this as?
dev.inmo.tgbotapi.types.actions.TypingAction
@@ -2026,24 +2059,6 @@ public inline fun ChatBoostSource.byUserOrThrow(): ChatBoostSource.ByUser = this
public inline fun <T> ChatBoostSource.ifByUser(block: (ChatBoostSource.ByUser) -> T): T? =
byUserOrNull() ?.let(block)
public inline fun ChatBoostSource.giftCodeOrNull(): ChatBoostSource.GiftCode? = this as?
dev.inmo.tgbotapi.types.boosts.ChatBoostSource.GiftCode
public inline fun ChatBoostSource.giftCodeOrThrow(): ChatBoostSource.GiftCode = this as
dev.inmo.tgbotapi.types.boosts.ChatBoostSource.GiftCode
public inline fun <T> ChatBoostSource.ifGiftCode(block: (ChatBoostSource.GiftCode) -> T): T? =
giftCodeOrNull() ?.let(block)
public inline fun ChatBoostSource.claimedOrNull(): ChatBoostSource.Giveaway.Claimed? = this as?
dev.inmo.tgbotapi.types.boosts.ChatBoostSource.Giveaway.Claimed
public inline fun ChatBoostSource.claimedOrThrow(): ChatBoostSource.Giveaway.Claimed = this as
dev.inmo.tgbotapi.types.boosts.ChatBoostSource.Giveaway.Claimed
public inline fun <T> ChatBoostSource.ifClaimed(block: (ChatBoostSource.Giveaway.Claimed) -> T): T?
= claimedOrNull() ?.let(block)
public inline fun ChatBoostSource.premiumOrNull(): ChatBoostSource.Premium? = this as?
dev.inmo.tgbotapi.types.boosts.ChatBoostSource.Premium
@@ -2053,6 +2068,15 @@ public inline fun ChatBoostSource.premiumOrThrow(): ChatBoostSource.Premium = th
public inline fun <T> ChatBoostSource.ifPremium(block: (ChatBoostSource.Premium) -> T): T? =
premiumOrNull() ?.let(block)
public inline fun ChatBoostSource.giftCodeOrNull(): ChatBoostSource.GiftCode? = this as?
dev.inmo.tgbotapi.types.boosts.ChatBoostSource.GiftCode
public inline fun ChatBoostSource.giftCodeOrThrow(): ChatBoostSource.GiftCode = this as
dev.inmo.tgbotapi.types.boosts.ChatBoostSource.GiftCode
public inline fun <T> ChatBoostSource.ifGiftCode(block: (ChatBoostSource.GiftCode) -> T): T? =
giftCodeOrNull() ?.let(block)
public inline fun ChatBoostSource.giveawayOrNull(): ChatBoostSource.Giveaway? = this as?
dev.inmo.tgbotapi.types.boosts.ChatBoostSource.Giveaway
@@ -2062,24 +2086,6 @@ public inline fun ChatBoostSource.giveawayOrThrow(): ChatBoostSource.Giveaway =
public inline fun <T> ChatBoostSource.ifGiveaway(block: (ChatBoostSource.Giveaway) -> T): T? =
giveawayOrNull() ?.let(block)
public inline fun ChatBoostSource.createdOrNull(): ChatBoostSource.Giveaway.Created? = this as?
dev.inmo.tgbotapi.types.boosts.ChatBoostSource.Giveaway.Created
public inline fun ChatBoostSource.createdOrThrow(): ChatBoostSource.Giveaway.Created = this as
dev.inmo.tgbotapi.types.boosts.ChatBoostSource.Giveaway.Created
public inline fun <T> ChatBoostSource.ifCreated(block: (ChatBoostSource.Giveaway.Created) -> T): T?
= createdOrNull() ?.let(block)
public inline fun ChatBoostSource.unclaimedOrNull(): ChatBoostSource.Giveaway.Unclaimed? = this as?
dev.inmo.tgbotapi.types.boosts.ChatBoostSource.Giveaway.Unclaimed
public inline fun ChatBoostSource.unclaimedOrThrow(): ChatBoostSource.Giveaway.Unclaimed = this as
dev.inmo.tgbotapi.types.boosts.ChatBoostSource.Giveaway.Unclaimed
public inline fun <T> ChatBoostSource.ifUnclaimed(block: (ChatBoostSource.Giveaway.Unclaimed) -> T):
T? = unclaimedOrNull() ?.let(block)
public inline fun ChatBoostSource.unknownOrNull(): ChatBoostSource.Unknown? = this as?
dev.inmo.tgbotapi.types.boosts.ChatBoostSource.Unknown
@@ -2089,14 +2095,35 @@ public inline fun ChatBoostSource.unknownOrThrow(): ChatBoostSource.Unknown = th
public inline fun <T> ChatBoostSource.ifUnknown(block: (ChatBoostSource.Unknown) -> T): T? =
unknownOrNull() ?.let(block)
public inline fun BusinessConnection.disabledOrNull(): BusinessConnection.Disabled? = this as?
dev.inmo.tgbotapi.types.business_connection.BusinessConnection.Disabled
public inline fun ChatBoostSource.giveawayCreatedOrNull(): ChatBoostSource.Giveaway.Created? = this
as? dev.inmo.tgbotapi.types.boosts.ChatBoostSource.Giveaway.Created
public inline fun BusinessConnection.disabledOrThrow(): BusinessConnection.Disabled = this as
dev.inmo.tgbotapi.types.business_connection.BusinessConnection.Disabled
public inline fun ChatBoostSource.giveawayCreatedOrThrow(): ChatBoostSource.Giveaway.Created = this
as dev.inmo.tgbotapi.types.boosts.ChatBoostSource.Giveaway.Created
public inline fun <T> BusinessConnection.ifDisabled(block: (BusinessConnection.Disabled) -> T): T? =
disabledOrNull() ?.let(block)
public inline fun <T>
ChatBoostSource.ifGiveawayCreated(block: (ChatBoostSource.Giveaway.Created) -> T): T? =
giveawayCreatedOrNull() ?.let(block)
public inline fun ChatBoostSource.giveawayClaimedOrNull(): ChatBoostSource.Giveaway.Claimed? = this
as? dev.inmo.tgbotapi.types.boosts.ChatBoostSource.Giveaway.Claimed
public inline fun ChatBoostSource.giveawayClaimedOrThrow(): ChatBoostSource.Giveaway.Claimed = this
as dev.inmo.tgbotapi.types.boosts.ChatBoostSource.Giveaway.Claimed
public inline fun <T>
ChatBoostSource.ifGiveawayClaimed(block: (ChatBoostSource.Giveaway.Claimed) -> T): T? =
giveawayClaimedOrNull() ?.let(block)
public inline fun ChatBoostSource.giveawayUnclaimedOrNull(): ChatBoostSource.Giveaway.Unclaimed? =
this as? dev.inmo.tgbotapi.types.boosts.ChatBoostSource.Giveaway.Unclaimed
public inline fun ChatBoostSource.giveawayUnclaimedOrThrow(): ChatBoostSource.Giveaway.Unclaimed =
this as dev.inmo.tgbotapi.types.boosts.ChatBoostSource.Giveaway.Unclaimed
public inline fun <T>
ChatBoostSource.ifGiveawayUnclaimed(block: (ChatBoostSource.Giveaway.Unclaimed) -> T): T? =
giveawayUnclaimedOrNull() ?.let(block)
public inline fun BusinessConnection.enabledOrNull(): BusinessConnection.Enabled? = this as?
dev.inmo.tgbotapi.types.business_connection.BusinessConnection.Enabled
@@ -2107,6 +2134,15 @@ public inline fun BusinessConnection.enabledOrThrow(): BusinessConnection.Enable
public inline fun <T> BusinessConnection.ifEnabled(block: (BusinessConnection.Enabled) -> T): T? =
enabledOrNull() ?.let(block)
public inline fun BusinessConnection.disabledOrNull(): BusinessConnection.Disabled? = this as?
dev.inmo.tgbotapi.types.business_connection.BusinessConnection.Disabled
public inline fun BusinessConnection.disabledOrThrow(): BusinessConnection.Disabled = this as
dev.inmo.tgbotapi.types.business_connection.BusinessConnection.Disabled
public inline fun <T> BusinessConnection.ifDisabled(block: (BusinessConnection.Disabled) -> T): T? =
disabledOrNull() ?.let(block)
public inline fun InlineKeyboardButton.unknownInlineKeyboardButtonOrNull():
UnknownInlineKeyboardButton? = this as?
dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.UnknownInlineKeyboardButton
@@ -2242,16 +2278,6 @@ public inline fun <T>
KeyboardButtonRequestUsers.ifAny(block: (KeyboardButtonRequestUsers.Any) -> T): T? = anyOrNull()
?.let(block)
public inline fun KeyboardButtonRequestUsers.botOrNull(): KeyboardButtonRequestUsers.Bot? = this as?
dev.inmo.tgbotapi.types.buttons.KeyboardButtonRequestUsers.Bot
public inline fun KeyboardButtonRequestUsers.botOrThrow(): KeyboardButtonRequestUsers.Bot = this as
dev.inmo.tgbotapi.types.buttons.KeyboardButtonRequestUsers.Bot
public inline fun <T>
KeyboardButtonRequestUsers.ifBot(block: (KeyboardButtonRequestUsers.Bot) -> T): T? = botOrNull()
?.let(block)
public inline fun KeyboardButtonRequestUsers.commonOrNull(): KeyboardButtonRequestUsers.Common? =
this as? dev.inmo.tgbotapi.types.buttons.KeyboardButtonRequestUsers.Common
@@ -2262,6 +2288,16 @@ public inline fun <T>
KeyboardButtonRequestUsers.ifCommon(block: (KeyboardButtonRequestUsers.Common) -> T): T? =
commonOrNull() ?.let(block)
public inline fun KeyboardButtonRequestUsers.botOrNull(): KeyboardButtonRequestUsers.Bot? = this as?
dev.inmo.tgbotapi.types.buttons.KeyboardButtonRequestUsers.Bot
public inline fun KeyboardButtonRequestUsers.botOrThrow(): KeyboardButtonRequestUsers.Bot = this as
dev.inmo.tgbotapi.types.buttons.KeyboardButtonRequestUsers.Bot
public inline fun <T>
KeyboardButtonRequestUsers.ifBot(block: (KeyboardButtonRequestUsers.Bot) -> T): T? = botOrNull()
?.let(block)
public inline fun KeyboardMarkup.inlineKeyboardMarkupOrNull(): InlineKeyboardMarkup? = this as?
dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
@@ -2650,16 +2686,6 @@ public inline fun Chat.unknownChatTypeOrThrow(): UnknownChatType = this as
public inline fun <T> Chat.ifUnknownChatType(block: (UnknownChatType) -> T): T? =
unknownChatTypeOrNull() ?.let(block)
public inline fun ChatMessageReactionUpdated.byChatOrNull(): ChatMessageReactionUpdated.ByChat? =
this as? dev.inmo.tgbotapi.types.chat.ChatMessageReactionUpdated.ByChat
public inline fun ChatMessageReactionUpdated.byChatOrThrow(): ChatMessageReactionUpdated.ByChat =
this as dev.inmo.tgbotapi.types.chat.ChatMessageReactionUpdated.ByChat
public inline fun <T>
ChatMessageReactionUpdated.ifByChat(block: (ChatMessageReactionUpdated.ByChat) -> T): T? =
byChatOrNull() ?.let(block)
public inline fun ChatMessageReactionUpdated.byUserOrNull(): ChatMessageReactionUpdated.ByUser? =
this as? dev.inmo.tgbotapi.types.chat.ChatMessageReactionUpdated.ByUser
@@ -2670,6 +2696,16 @@ public inline fun <T>
ChatMessageReactionUpdated.ifByUser(block: (ChatMessageReactionUpdated.ByUser) -> T): T? =
byUserOrNull() ?.let(block)
public inline fun ChatMessageReactionUpdated.byChatOrNull(): ChatMessageReactionUpdated.ByChat? =
this as? dev.inmo.tgbotapi.types.chat.ChatMessageReactionUpdated.ByChat
public inline fun ChatMessageReactionUpdated.byChatOrThrow(): ChatMessageReactionUpdated.ByChat =
this as dev.inmo.tgbotapi.types.chat.ChatMessageReactionUpdated.ByChat
public inline fun <T>
ChatMessageReactionUpdated.ifByChat(block: (ChatMessageReactionUpdated.ByChat) -> T): T? =
byChatOrNull() ?.let(block)
public inline fun ChatMessageReactionUpdated.unknownOrNull(): ChatMessageReactionUpdated.Unknown? =
this as? dev.inmo.tgbotapi.types.chat.ChatMessageReactionUpdated.Unknown
@@ -3312,6 +3348,94 @@ public inline fun ChatEvent.chatBackgroundOrThrow(): ChatBackground = this as
public inline fun <T> ChatEvent.ifChatBackground(block: (ChatBackground) -> T): T? =
chatBackgroundOrNull() ?.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 <T> 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 <T>
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 <T>
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 <T> 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 <T>
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 <T>
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 <T>
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 <T>
ChatEvent.ifGiftSentOrReceivedUniqueReceivedInBusinessAccount(block: (GiftSentOrReceived.Unique.ReceivedInBusinessAccount) -> T):
T? = giftSentOrReceivedUniqueReceivedInBusinessAccountOrNull() ?.let(block)
public inline fun ChatEvent.giveawayCreatedOrNull(): GiveawayCreated? = this as?
dev.inmo.tgbotapi.types.giveaway.GiveawayCreated
@@ -3321,6 +3445,24 @@ public inline fun ChatEvent.giveawayCreatedOrThrow(): GiveawayCreated = this as
public inline fun <T> 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 <T> 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 <T> ChatEvent.ifGiveawayCreatedCompanion(block: (GiveawayCreated.Companion) -> T):
T? = giveawayCreatedCompanionOrNull() ?.let(block)
public inline fun ChatEvent.giveawayPrivateResultsOrNull(): GiveawayPrivateResults? = this as?
dev.inmo.tgbotapi.types.giveaway.GiveawayPrivateResults
@@ -3602,6 +3744,49 @@ public inline fun ChatEvent.writeAccessAllowedOrThrow(): WriteAccessAllowed = th
public inline fun <T> 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 <T> 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 <T>
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 <T>
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 <T>
ChatEvent.ifWriteAccessAllowedFromAttachmentMenu(block: (WriteAccessAllowed.FromAttachmentMenu) -> T):
T? = writeAccessAllowedFromAttachmentMenuOrNull() ?.let(block)
public inline fun ChatEvent.videoChatEndedOrNull(): VideoChatEnded? = this as?
dev.inmo.tgbotapi.types.message.ChatEvents.voice.VideoChatEnded
@@ -3702,14 +3887,24 @@ public inline fun ForwardInfo.byUserOrThrow(): ForwardInfo.ByUser = this as
public inline fun <T> ForwardInfo.ifByUser(block: (ForwardInfo.ByUser) -> T): T? = byUserOrNull()
?.let(block)
public inline fun ForwardInfo.publicChatOrNull(): ForwardInfo.PublicChat? = this as?
public inline fun ForwardInfo.OrNull(): ForwardInfo.PublicChat? = this as?
dev.inmo.tgbotapi.types.message.ForwardInfo.PublicChat
public inline fun ForwardInfo.publicChatOrThrow(): ForwardInfo.PublicChat = this as
public inline fun ForwardInfo.OrThrow(): ForwardInfo.PublicChat = this as
dev.inmo.tgbotapi.types.message.ForwardInfo.PublicChat
public inline fun <T> ForwardInfo.ifPublicChat(block: (ForwardInfo.PublicChat) -> T): T? =
publicChatOrNull() ?.let(block)
public inline fun <T> ForwardInfo.`if`(block: (ForwardInfo.PublicChat) -> T): T? = OrNull()
?.let(block)
public inline fun ForwardInfo.sentByChannelOrNull(): ForwardInfo.PublicChat.SentByChannel? = this
as? dev.inmo.tgbotapi.types.message.ForwardInfo.PublicChat.SentByChannel
public inline fun ForwardInfo.sentByChannelOrThrow(): ForwardInfo.PublicChat.SentByChannel = this as
dev.inmo.tgbotapi.types.message.ForwardInfo.PublicChat.SentByChannel
public inline fun <T>
ForwardInfo.ifSentByChannel(block: (ForwardInfo.PublicChat.SentByChannel) -> T): T? =
sentByChannelOrNull() ?.let(block)
public inline fun ForwardInfo.fromChannelOrNull(): ForwardInfo.PublicChat.FromChannel? = this as?
dev.inmo.tgbotapi.types.message.ForwardInfo.PublicChat.FromChannel
@@ -3730,16 +3925,6 @@ public inline fun <T>
ForwardInfo.ifFromSupergroup(block: (ForwardInfo.PublicChat.FromSupergroup) -> T): T? =
fromSupergroupOrNull() ?.let(block)
public inline fun ForwardInfo.sentByChannelOrNull(): ForwardInfo.PublicChat.SentByChannel? = this
as? dev.inmo.tgbotapi.types.message.ForwardInfo.PublicChat.SentByChannel
public inline fun ForwardInfo.sentByChannelOrThrow(): ForwardInfo.PublicChat.SentByChannel = this as
dev.inmo.tgbotapi.types.message.ForwardInfo.PublicChat.SentByChannel
public inline fun <T>
ForwardInfo.ifSentByChannel(block: (ForwardInfo.PublicChat.SentByChannel) -> T): T? =
sentByChannelOrNull() ?.let(block)
public inline fun Message.channelEventMessageOrNull(): ChannelEventMessage<ChannelEvent>? = this as?
dev.inmo.tgbotapi.types.message.ChannelEventMessage<dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.ChannelEvent>
@@ -5306,15 +5491,6 @@ public inline fun <T>
EncryptedPassportElement.ifEncryptedPassportElementWithSelfie(block: (EncryptedPassportElementWithSelfie) -> T):
T? = encryptedPassportElementWithSelfieOrNull() ?.let(block)
public inline fun RevenueWithdrawalState.failedOrNull(): RevenueWithdrawalState.Failed? = this as?
dev.inmo.tgbotapi.types.payments.stars.RevenueWithdrawalState.Failed
public inline fun RevenueWithdrawalState.failedOrThrow(): RevenueWithdrawalState.Failed = this as
dev.inmo.tgbotapi.types.payments.stars.RevenueWithdrawalState.Failed
public inline fun <T> RevenueWithdrawalState.ifFailed(block: (RevenueWithdrawalState.Failed) -> T):
T? = failedOrNull() ?.let(block)
public inline fun RevenueWithdrawalState.pendingOrNull(): RevenueWithdrawalState.Pending? = this as?
dev.inmo.tgbotapi.types.payments.stars.RevenueWithdrawalState.Pending
@@ -5335,6 +5511,15 @@ public inline fun <T>
RevenueWithdrawalState.ifSucceeded(block: (RevenueWithdrawalState.Succeeded) -> T): T? =
succeededOrNull() ?.let(block)
public inline fun RevenueWithdrawalState.failedOrNull(): RevenueWithdrawalState.Failed? = this as?
dev.inmo.tgbotapi.types.payments.stars.RevenueWithdrawalState.Failed
public inline fun RevenueWithdrawalState.failedOrThrow(): RevenueWithdrawalState.Failed = this as
dev.inmo.tgbotapi.types.payments.stars.RevenueWithdrawalState.Failed
public inline fun <T> RevenueWithdrawalState.ifFailed(block: (RevenueWithdrawalState.Failed) -> T):
T? = failedOrNull() ?.let(block)
public inline fun RevenueWithdrawalState.unknownOrNull(): RevenueWithdrawalState.Unknown? = this as?
dev.inmo.tgbotapi.types.payments.stars.RevenueWithdrawalState.Unknown
@@ -5372,34 +5557,6 @@ public inline fun StarTransaction.unknownOrThrow(): StarTransaction.Unknown = th
public inline fun <T> StarTransaction.ifUnknown(block: (StarTransaction.Unknown) -> T): T? =
unknownOrNull() ?.let(block)
public inline fun TransactionPartner.adsOrNull(): TransactionPartner.Ads? = this as?
dev.inmo.tgbotapi.types.payments.stars.TransactionPartner.Ads
public inline fun TransactionPartner.adsOrThrow(): TransactionPartner.Ads = this as
dev.inmo.tgbotapi.types.payments.stars.TransactionPartner.Ads
public inline fun <T> TransactionPartner.ifAds(block: (TransactionPartner.Ads) -> T): T? =
adsOrNull() ?.let(block)
public inline fun TransactionPartner.affiliateProgramOrNull(): TransactionPartner.AffiliateProgram?
= this as? dev.inmo.tgbotapi.types.payments.stars.TransactionPartner.AffiliateProgram
public inline fun TransactionPartner.affiliateProgramOrThrow(): TransactionPartner.AffiliateProgram
= this as dev.inmo.tgbotapi.types.payments.stars.TransactionPartner.AffiliateProgram
public inline fun <T>
TransactionPartner.ifAffiliateProgram(block: (TransactionPartner.AffiliateProgram) -> T): T? =
affiliateProgramOrNull() ?.let(block)
public inline fun TransactionPartner.chatOrNull(): TransactionPartner.Chat? = this as?
dev.inmo.tgbotapi.types.payments.stars.TransactionPartner.Chat
public inline fun TransactionPartner.chatOrThrow(): TransactionPartner.Chat = this as
dev.inmo.tgbotapi.types.payments.stars.TransactionPartner.Chat
public inline fun <T> TransactionPartner.ifChat(block: (TransactionPartner.Chat) -> T): T? =
chatOrNull() ?.let(block)
public inline fun TransactionPartner.fragmentOrNull(): TransactionPartner.Fragment? = this as?
dev.inmo.tgbotapi.types.payments.stars.TransactionPartner.Fragment
@@ -5409,14 +5566,23 @@ public inline fun TransactionPartner.fragmentOrThrow(): TransactionPartner.Fragm
public inline fun <T> TransactionPartner.ifFragment(block: (TransactionPartner.Fragment) -> T): T? =
fragmentOrNull() ?.let(block)
public inline fun TransactionPartner.otherOrNull(): TransactionPartner.Other? = this as?
dev.inmo.tgbotapi.types.payments.stars.TransactionPartner.Other
public inline fun TransactionPartner.userOrNull(): TransactionPartner.User? = this as?
dev.inmo.tgbotapi.types.payments.stars.TransactionPartner.User
public inline fun TransactionPartner.otherOrThrow(): TransactionPartner.Other = this as
dev.inmo.tgbotapi.types.payments.stars.TransactionPartner.Other
public inline fun TransactionPartner.userOrThrow(): TransactionPartner.User = this as
dev.inmo.tgbotapi.types.payments.stars.TransactionPartner.User
public inline fun <T> TransactionPartner.ifOther(block: (TransactionPartner.Other) -> T): T? =
otherOrNull() ?.let(block)
public inline fun <T> TransactionPartner.ifUser(block: (TransactionPartner.User) -> T): T? =
userOrNull() ?.let(block)
public inline fun TransactionPartner.chatOrNull(): TransactionPartner.Chat? = this as?
dev.inmo.tgbotapi.types.payments.stars.TransactionPartner.Chat
public inline fun TransactionPartner.chatOrThrow(): TransactionPartner.Chat = this as
dev.inmo.tgbotapi.types.payments.stars.TransactionPartner.Chat
public inline fun <T> TransactionPartner.ifChat(block: (TransactionPartner.Chat) -> T): T? =
chatOrNull() ?.let(block)
public inline fun TransactionPartner.telegramAPIOrNull(): TransactionPartner.TelegramAPI? = this as?
dev.inmo.tgbotapi.types.payments.stars.TransactionPartner.TelegramAPI
@@ -5428,6 +5594,34 @@ public inline fun <T>
TransactionPartner.ifTelegramAPI(block: (TransactionPartner.TelegramAPI) -> T): T? =
telegramAPIOrNull() ?.let(block)
public inline fun TransactionPartner.affiliateProgramOrNull(): TransactionPartner.AffiliateProgram?
= this as? dev.inmo.tgbotapi.types.payments.stars.TransactionPartner.AffiliateProgram
public inline fun TransactionPartner.affiliateProgramOrThrow(): TransactionPartner.AffiliateProgram
= this as dev.inmo.tgbotapi.types.payments.stars.TransactionPartner.AffiliateProgram
public inline fun <T>
TransactionPartner.ifAffiliateProgram(block: (TransactionPartner.AffiliateProgram) -> T): T? =
affiliateProgramOrNull() ?.let(block)
public inline fun TransactionPartner.adsOrNull(): TransactionPartner.Ads? = this as?
dev.inmo.tgbotapi.types.payments.stars.TransactionPartner.Ads
public inline fun TransactionPartner.adsOrThrow(): TransactionPartner.Ads = this as
dev.inmo.tgbotapi.types.payments.stars.TransactionPartner.Ads
public inline fun <T> TransactionPartner.ifAds(block: (TransactionPartner.Ads) -> T): T? =
adsOrNull() ?.let(block)
public inline fun TransactionPartner.otherOrNull(): TransactionPartner.Other? = this as?
dev.inmo.tgbotapi.types.payments.stars.TransactionPartner.Other
public inline fun TransactionPartner.otherOrThrow(): TransactionPartner.Other = this as
dev.inmo.tgbotapi.types.payments.stars.TransactionPartner.Other
public inline fun <T> TransactionPartner.ifOther(block: (TransactionPartner.Other) -> T): T? =
otherOrNull() ?.let(block)
public inline fun TransactionPartner.unknownOrNull(): TransactionPartner.Unknown? = this as?
dev.inmo.tgbotapi.types.payments.stars.TransactionPartner.Unknown
@@ -5437,15 +5631,6 @@ public inline fun TransactionPartner.unknownOrThrow(): TransactionPartner.Unknow
public inline fun <T> TransactionPartner.ifUnknown(block: (TransactionPartner.Unknown) -> T): T? =
unknownOrNull() ?.let(block)
public inline fun TransactionPartner.userOrNull(): TransactionPartner.User? = this as?
dev.inmo.tgbotapi.types.payments.stars.TransactionPartner.User
public inline fun TransactionPartner.userOrThrow(): TransactionPartner.User = this as
dev.inmo.tgbotapi.types.payments.stars.TransactionPartner.User
public inline fun <T> TransactionPartner.ifUser(block: (TransactionPartner.User) -> T): T? =
userOrNull() ?.let(block)
public inline fun ScheduledCloseInfo.exactScheduledCloseInfoOrNull(): ExactScheduledCloseInfo? =
this as? dev.inmo.tgbotapi.types.polls.ExactScheduledCloseInfo
@@ -5501,15 +5686,6 @@ public inline fun Poll.quizPollOrThrow(): QuizPoll = this as dev.inmo.tgbotapi.t
public inline fun <T> Poll.ifQuizPoll(block: (QuizPoll) -> T): T? = quizPollOrNull() ?.let(block)
public inline fun Reaction.customEmojiOrNull(): Reaction.CustomEmoji? = this as?
dev.inmo.tgbotapi.types.reactions.Reaction.CustomEmoji
public inline fun Reaction.customEmojiOrThrow(): Reaction.CustomEmoji = this as
dev.inmo.tgbotapi.types.reactions.Reaction.CustomEmoji
public inline fun <T> Reaction.ifCustomEmoji(block: (Reaction.CustomEmoji) -> T): T? =
customEmojiOrNull() ?.let(block)
public inline fun Reaction.emojiOrNull(): Reaction.Emoji? = this as?
dev.inmo.tgbotapi.types.reactions.Reaction.Emoji
@@ -5519,6 +5695,15 @@ public inline fun Reaction.emojiOrThrow(): Reaction.Emoji = this as
public inline fun <T> Reaction.ifEmoji(block: (Reaction.Emoji) -> T): T? = emojiOrNull()
?.let(block)
public inline fun Reaction.customEmojiOrNull(): Reaction.CustomEmoji? = this as?
dev.inmo.tgbotapi.types.reactions.Reaction.CustomEmoji
public inline fun Reaction.customEmojiOrThrow(): Reaction.CustomEmoji = this as
dev.inmo.tgbotapi.types.reactions.Reaction.CustomEmoji
public inline fun <T> Reaction.ifCustomEmoji(block: (Reaction.CustomEmoji) -> T): T? =
customEmojiOrNull() ?.let(block)
public inline fun Reaction.paidOrNull(): Reaction.Paid? = this as?
dev.inmo.tgbotapi.types.reactions.Reaction.Paid