1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2025-09-03 23:29:33 +00:00

add different business entities

This commit is contained in:
2024-04-16 18:29:57 +06:00
parent be9c0cff61
commit a7b2bb820b
29 changed files with 679 additions and 30 deletions

View File

@@ -1109,6 +1109,12 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun bowlingDiceAnimationTypeOrThrow (Ldev/inmo/tgbotapi/types/dice/DiceAnimationType;)Ldev/inmo/tgbotapi/types/dice/BowlingDiceAnimationType;
public static final fun businessConnectionUpdateOrNull (Ldev/inmo/tgbotapi/types/update/abstracts/Update;)Ldev/inmo/tgbotapi/types/update/BusinessConnectionUpdate;
public static final fun businessConnectionUpdateOrThrow (Ldev/inmo/tgbotapi/types/update/abstracts/Update;)Ldev/inmo/tgbotapi/types/update/BusinessConnectionUpdate;
public static final fun businessContentMessageOrNull (Ldev/inmo/tgbotapi/abstracts/WithUser;)Ldev/inmo/tgbotapi/types/message/abstracts/BusinessContentMessage;
public static final fun businessContentMessageOrNull (Ldev/inmo/tgbotapi/types/message/abstracts/Message;)Ldev/inmo/tgbotapi/types/message/abstracts/BusinessContentMessage;
public static final fun businessContentMessageOrThrow (Ldev/inmo/tgbotapi/abstracts/WithUser;)Ldev/inmo/tgbotapi/types/message/abstracts/BusinessContentMessage;
public static final fun businessContentMessageOrThrow (Ldev/inmo/tgbotapi/types/message/abstracts/Message;)Ldev/inmo/tgbotapi/types/message/abstracts/BusinessContentMessage;
public static final fun businessMessageUpdateOrNull (Ldev/inmo/tgbotapi/types/update/abstracts/Update;)Ldev/inmo/tgbotapi/types/update/BusinessMessageUpdate;
public static final fun businessMessageUpdateOrThrow (Ldev/inmo/tgbotapi/types/update/abstracts/Update;)Ldev/inmo/tgbotapi/types/update/BusinessMessageUpdate;
public static final fun byAnonymousOrNull (Ldev/inmo/tgbotapi/types/message/ForwardInfo;)Ldev/inmo/tgbotapi/types/message/ForwardInfo$ByAnonymous;
public static final fun byAnonymousOrThrow (Ldev/inmo/tgbotapi/types/message/ForwardInfo;)Ldev/inmo/tgbotapi/types/message/ForwardInfo$ByAnonymous;
public static final fun byChatOrNull (Ldev/inmo/tgbotapi/types/chat/ChatMessageReactionUpdated;)Ldev/inmo/tgbotapi/types/chat/ChatMessageReactionUpdated$ByChat;
@@ -1261,6 +1267,8 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun dataCallbackQueryOrThrow (Ldev/inmo/tgbotapi/abstracts/WithUser;)Ldev/inmo/tgbotapi/types/queries/callback/DataCallbackQuery;
public static final fun deleteChatPhotoOrNull (Ldev/inmo/tgbotapi/types/message/ChatEvents/abstracts/ChatEvent;)Ldev/inmo/tgbotapi/types/message/ChatEvents/DeleteChatPhoto;
public static final fun deleteChatPhotoOrThrow (Ldev/inmo/tgbotapi/types/message/ChatEvents/abstracts/ChatEvent;)Ldev/inmo/tgbotapi/types/message/ChatEvents/DeleteChatPhoto;
public static final fun deletedBusinessMessageUpdateOrNull (Ldev/inmo/tgbotapi/types/update/abstracts/Update;)Ldev/inmo/tgbotapi/types/update/DeletedBusinessMessageUpdate;
public static final fun deletedBusinessMessageUpdateOrThrow (Ldev/inmo/tgbotapi/types/update/abstracts/Update;)Ldev/inmo/tgbotapi/types/update/DeletedBusinessMessageUpdate;
public static final fun describedInlineQueryResultOrNull (Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/InlineQueryResult;)Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/DescribedInlineQueryResult;
public static final fun describedInlineQueryResultOrThrow (Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/InlineQueryResult;)Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/DescribedInlineQueryResult;
public static final fun diceContentOrNull (Ldev/inmo/tgbotapi/types/message/content/ResendableContent;)Ldev/inmo/tgbotapi/types/message/content/DiceContent;
@@ -1283,6 +1291,8 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun duratedTelegramMediaOrThrow (Ldev/inmo/tgbotapi/types/media/TelegramMedia;)Ldev/inmo/tgbotapi/types/media/DuratedTelegramMedia;
public static final fun eMailTextSourceOrNull (Ldev/inmo/tgbotapi/types/message/textsources/TextSource;)Ldev/inmo/tgbotapi/types/message/textsources/EMailTextSource;
public static final fun eMailTextSourceOrThrow (Ldev/inmo/tgbotapi/types/message/textsources/TextSource;)Ldev/inmo/tgbotapi/types/message/textsources/EMailTextSource;
public static final fun editBusinessMessageUpdateOrNull (Ldev/inmo/tgbotapi/types/update/abstracts/Update;)Ldev/inmo/tgbotapi/types/update/EditBusinessMessageUpdate;
public static final fun editBusinessMessageUpdateOrThrow (Ldev/inmo/tgbotapi/types/update/abstracts/Update;)Ldev/inmo/tgbotapi/types/update/EditBusinessMessageUpdate;
public static final fun editChannelPostUpdateOrNull (Ldev/inmo/tgbotapi/types/update/abstracts/Update;)Ldev/inmo/tgbotapi/types/update/EditChannelPostUpdate;
public static final fun editChannelPostUpdateOrThrow (Ldev/inmo/tgbotapi/types/update/abstracts/Update;)Ldev/inmo/tgbotapi/types/update/EditChannelPostUpdate;
public static final fun editMessageUpdateOrNull (Ldev/inmo/tgbotapi/types/update/abstracts/Update;)Ldev/inmo/tgbotapi/types/update/EditMessageUpdate;
@@ -1451,6 +1461,9 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun ifBotCommandTextSource (Ldev/inmo/tgbotapi/types/message/textsources/TextSource;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifBowlingDiceAnimationType (Ldev/inmo/tgbotapi/types/dice/DiceAnimationType;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifBusinessConnectionUpdate (Ldev/inmo/tgbotapi/types/update/abstracts/Update;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifBusinessContentMessage (Ldev/inmo/tgbotapi/abstracts/WithUser;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifBusinessContentMessage (Ldev/inmo/tgbotapi/types/message/abstracts/Message;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifBusinessMessageUpdate (Ldev/inmo/tgbotapi/types/update/abstracts/Update;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifByAnonymous (Ldev/inmo/tgbotapi/types/message/ForwardInfo;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifByChat (Ldev/inmo/tgbotapi/types/chat/ChatMessageReactionUpdated;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifByUser (Ldev/inmo/tgbotapi/types/boosts/ChatBoostSource;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
@@ -1527,6 +1540,7 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun ifDartsDiceAnimationType (Ldev/inmo/tgbotapi/types/dice/DiceAnimationType;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifDataCallbackQuery (Ldev/inmo/tgbotapi/abstracts/WithUser;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifDeleteChatPhoto (Ldev/inmo/tgbotapi/types/message/ChatEvents/abstracts/ChatEvent;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifDeletedBusinessMessageUpdate (Ldev/inmo/tgbotapi/types/update/abstracts/Update;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifDescribedInlineQueryResult (Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/abstracts/InlineQueryResult;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifDiceContent (Ldev/inmo/tgbotapi/types/message/content/ResendableContent;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifDisabled (Ldev/inmo/tgbotapi/types/business_connection/BusinessConnection;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
@@ -1538,6 +1552,7 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun ifDriverLicenseSecureValue (Ldev/inmo/tgbotapi/types/passport/decrypted/abstracts/SecureValue;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifDuratedTelegramMedia (Ldev/inmo/tgbotapi/types/media/TelegramMedia;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifEMailTextSource (Ldev/inmo/tgbotapi/types/message/textsources/TextSource;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifEditBusinessMessageUpdate (Ldev/inmo/tgbotapi/types/update/abstracts/Update;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifEditChannelPostUpdate (Ldev/inmo/tgbotapi/types/update/abstracts/Update;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifEditMessageUpdate (Ldev/inmo/tgbotapi/types/update/abstracts/Update;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifEmail (Ldev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElement;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
@@ -1730,6 +1745,7 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun ifPollAnswerUpdate (Ldev/inmo/tgbotapi/types/update/abstracts/Update;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifPollContent (Ldev/inmo/tgbotapi/types/message/content/ResendableContent;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifPollUpdate (Ldev/inmo/tgbotapi/types/update/abstracts/Update;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifPossiblyBusinessMessage (Ldev/inmo/tgbotapi/types/message/abstracts/Message;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifPossiblyEditedMessage (Ldev/inmo/tgbotapi/types/message/abstracts/Message;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifPossiblyForwardedMessage (Ldev/inmo/tgbotapi/types/message/abstracts/Message;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifPossiblyMediaGroupMessage (Ldev/inmo/tgbotapi/types/message/abstracts/Message;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
@@ -2142,6 +2158,8 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun pollContentOrThrow (Ldev/inmo/tgbotapi/types/message/content/ResendableContent;)Ldev/inmo/tgbotapi/types/message/content/PollContent;
public static final fun pollUpdateOrNull (Ldev/inmo/tgbotapi/types/update/abstracts/Update;)Ldev/inmo/tgbotapi/types/update/PollUpdate;
public static final fun pollUpdateOrThrow (Ldev/inmo/tgbotapi/types/update/abstracts/Update;)Ldev/inmo/tgbotapi/types/update/PollUpdate;
public static final fun possiblyBusinessMessageOrNull (Ldev/inmo/tgbotapi/types/message/abstracts/Message;)Ldev/inmo/tgbotapi/types/message/abstracts/PossiblyBusinessMessage;
public static final fun possiblyBusinessMessageOrThrow (Ldev/inmo/tgbotapi/types/message/abstracts/Message;)Ldev/inmo/tgbotapi/types/message/abstracts/PossiblyBusinessMessage;
public static final fun possiblyEditedMessageOrNull (Ldev/inmo/tgbotapi/types/message/abstracts/Message;)Ldev/inmo/tgbotapi/types/message/abstracts/PossiblyEditedMessage;
public static final fun possiblyEditedMessageOrThrow (Ldev/inmo/tgbotapi/types/message/abstracts/Message;)Ldev/inmo/tgbotapi/types/message/abstracts/PossiblyEditedMessage;
public static final fun possiblyForwardedMessageOrNull (Ldev/inmo/tgbotapi/types/message/abstracts/Message;)Ldev/inmo/tgbotapi/types/message/abstracts/PossiblyForwardedMessage;
@@ -2603,6 +2621,8 @@ public final class dev/inmo/tgbotapi/extensions/utils/extensions/FlowsSameKt {
}
public final class dev/inmo/tgbotapi/extensions/utils/extensions/SameKt {
public static final fun sameBusinessConnection (Ldev/inmo/tgbotapi/types/message/abstracts/Message;Ldev/inmo/tgbotapi/abstracts/types/WithBusinessConnectionId;)Z
public static final fun sameBusinessConnection-X6RVWW0 (Ldev/inmo/tgbotapi/types/message/abstracts/Message;Ljava/lang/String;)Z
public static final fun sameChat (Ldev/inmo/tgbotapi/abstracts/WithPreviewChat;Ldev/inmo/tgbotapi/types/ChatIdentifier;)Z
public static final fun sameChat (Ldev/inmo/tgbotapi/abstracts/WithPreviewChat;Ldev/inmo/tgbotapi/types/chat/Chat;)Z
public static final fun sameChat (Ldev/inmo/tgbotapi/abstracts/WithPreviewChat;Ldev/inmo/tgbotapi/types/message/abstracts/Message;)Z
@@ -2632,8 +2652,8 @@ public final class dev/inmo/tgbotapi/extensions/utils/extensions/TelegramBotComm
public final class dev/inmo/tgbotapi/extensions/utils/extensions/UpdateChatRetrieverKt {
public static final fun sourceChat (Ldev/inmo/tgbotapi/types/queries/callback/CallbackQuery;)Ldev/inmo/tgbotapi/types/chat/PreviewChat;
public static final fun sourceChat (Ldev/inmo/tgbotapi/types/update/abstracts/Update;)Ldev/inmo/tgbotapi/types/chat/Chat;
public static final fun sourceChatWithConverters (Ldev/inmo/tgbotapi/types/update/abstracts/Update;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)Ldev/inmo/tgbotapi/types/chat/Chat;
public static synthetic fun sourceChatWithConverters$default (Ldev/inmo/tgbotapi/types/update/abstracts/Update;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/chat/Chat;
public static final fun sourceChatWithConverters (Ldev/inmo/tgbotapi/types/update/abstracts/Update;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)Ldev/inmo/tgbotapi/types/chat/Chat;
public static synthetic fun sourceChatWithConverters$default (Ldev/inmo/tgbotapi/types/update/abstracts/Update;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/chat/Chat;
public static final fun sourceUser (Ldev/inmo/tgbotapi/types/update/abstracts/Update;)Ldev/inmo/tgbotapi/types/chat/User;
}
@@ -2984,6 +3004,11 @@ public final class dev/inmo/tgbotapi/extensions/utils/formatting/StringFormattin
public static final fun underlineMarkdownV2 (Ljava/lang/String;)Ljava/lang/String;
}
public final class dev/inmo/tgbotapi/extensions/utils/shortcuts/BusinessMessagesMappersKt {
public static final fun allBusinessMessages (Lkotlinx/coroutines/flow/Flow;)Lkotlinx/coroutines/flow/Flow;
public static final fun businessMessages (Lkotlinx/coroutines/flow/Flow;)Lkotlinx/coroutines/flow/Flow;
}
public final class dev/inmo/tgbotapi/extensions/utils/shortcuts/CommandsShortcutsKt {
public static final fun filterCommandsInsideTextMessages (Lkotlinx/coroutines/flow/Flow;Lkotlin/text/Regex;)Lkotlinx/coroutines/flow/Flow;
public static final fun filterCommandsWithArgs (Lkotlinx/coroutines/flow/Flow;Lkotlin/text/Regex;)Lkotlinx/coroutines/flow/Flow;

View File

@@ -265,6 +265,7 @@ import dev.inmo.tgbotapi.types.message.PrivateEventMessage
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
import dev.inmo.tgbotapi.types.message.abstracts.AnonymousForumContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.AnonymousGroupContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.BusinessContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.ChannelContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.ChatEventMessage
import dev.inmo.tgbotapi.types.message.abstracts.CommonForumContentMessage
@@ -441,6 +442,7 @@ import dev.inmo.tgbotapi.types.request.ChatSharedRequest
import dev.inmo.tgbotapi.types.request.RequestResponse
import dev.inmo.tgbotapi.types.request.UsersShared
import dev.inmo.tgbotapi.types.update.BusinessConnectionUpdate
import dev.inmo.tgbotapi.types.update.BusinessMessageUpdate
import dev.inmo.tgbotapi.types.update.CallbackQueryUpdate
import dev.inmo.tgbotapi.types.update.ChannelPostUpdate
import dev.inmo.tgbotapi.types.update.ChatBoostRemovedUpdate
@@ -450,6 +452,8 @@ import dev.inmo.tgbotapi.types.update.ChatMessageReactionUpdatedUpdate
import dev.inmo.tgbotapi.types.update.ChatMessageReactionsCountUpdatedUpdate
import dev.inmo.tgbotapi.types.update.ChosenInlineResultUpdate
import dev.inmo.tgbotapi.types.update.CommonChatMemberUpdatedUpdate
import dev.inmo.tgbotapi.types.update.DeletedBusinessMessageUpdate
import dev.inmo.tgbotapi.types.update.EditBusinessMessageUpdate
import dev.inmo.tgbotapi.types.update.EditChannelPostUpdate
import dev.inmo.tgbotapi.types.update.EditMessageUpdate
import dev.inmo.tgbotapi.types.update.InlineQueryUpdate
@@ -760,6 +764,18 @@ public inline fun WithUser.passportMessageOrThrow(): PassportMessage = this as
public inline fun <T> WithUser.ifPassportMessage(block: (PassportMessage) -> T): T? =
passportMessageOrNull() ?.let(block)
public inline fun WithUser.businessContentMessageOrNull(): BusinessContentMessage<MessageContent>? =
this as?
dev.inmo.tgbotapi.types.message.abstracts.BusinessContentMessage<dev.inmo.tgbotapi.types.message.content.MessageContent>
public inline fun WithUser.businessContentMessageOrThrow(): BusinessContentMessage<MessageContent> =
this as
dev.inmo.tgbotapi.types.message.abstracts.BusinessContentMessage<dev.inmo.tgbotapi.types.message.content.MessageContent>
public inline fun <T>
WithUser.ifBusinessContentMessage(block: (BusinessContentMessage<MessageContent>) -> T): T? =
businessContentMessageOrNull() ?.let(block)
public inline fun WithUser.fromUserMessageOrNull(): FromUserMessage? = this as?
dev.inmo.tgbotapi.types.message.abstracts.FromUserMessage
@@ -3358,6 +3374,18 @@ public inline fun <T>
Message.ifPrivateEventMessage(block: (PrivateEventMessage<PrivateEvent>) -> T): T? =
privateEventMessageOrNull() ?.let(block)
public inline fun Message.businessContentMessageOrNull(): BusinessContentMessage<MessageContent>? =
this as?
dev.inmo.tgbotapi.types.message.abstracts.BusinessContentMessage<dev.inmo.tgbotapi.types.message.content.MessageContent>
public inline fun Message.businessContentMessageOrThrow(): BusinessContentMessage<MessageContent> =
this as
dev.inmo.tgbotapi.types.message.abstracts.BusinessContentMessage<dev.inmo.tgbotapi.types.message.content.MessageContent>
public inline fun <T>
Message.ifBusinessContentMessage(block: (BusinessContentMessage<MessageContent>) -> T): T? =
businessContentMessageOrNull() ?.let(block)
public inline fun Message.channelContentMessageOrNull(): ChannelContentMessage<MessageContent>? =
this as?
dev.inmo.tgbotapi.types.message.abstracts.ChannelContentMessage<dev.inmo.tgbotapi.types.message.content.MessageContent>
@@ -4910,6 +4938,15 @@ public inline fun Update.businessConnectionUpdateOrThrow(): BusinessConnectionUp
public inline fun <T> Update.ifBusinessConnectionUpdate(block: (BusinessConnectionUpdate) -> T): T?
= businessConnectionUpdateOrNull() ?.let(block)
public inline fun Update.businessMessageUpdateOrNull(): BusinessMessageUpdate? = this as?
dev.inmo.tgbotapi.types.update.BusinessMessageUpdate
public inline fun Update.businessMessageUpdateOrThrow(): BusinessMessageUpdate = this as
dev.inmo.tgbotapi.types.update.BusinessMessageUpdate
public inline fun <T> Update.ifBusinessMessageUpdate(block: (BusinessMessageUpdate) -> T): T? =
businessMessageUpdateOrNull() ?.let(block)
public inline fun Update.callbackQueryUpdateOrNull(): CallbackQueryUpdate? = this as?
dev.inmo.tgbotapi.types.update.CallbackQueryUpdate
@@ -4996,6 +5033,25 @@ public inline fun <T>
Update.ifCommonChatMemberUpdatedUpdate(block: (CommonChatMemberUpdatedUpdate) -> T): T? =
commonChatMemberUpdatedUpdateOrNull() ?.let(block)
public inline fun Update.deletedBusinessMessageUpdateOrNull(): DeletedBusinessMessageUpdate? = this
as? dev.inmo.tgbotapi.types.update.DeletedBusinessMessageUpdate
public inline fun Update.deletedBusinessMessageUpdateOrThrow(): DeletedBusinessMessageUpdate = this
as dev.inmo.tgbotapi.types.update.DeletedBusinessMessageUpdate
public inline fun <T>
Update.ifDeletedBusinessMessageUpdate(block: (DeletedBusinessMessageUpdate) -> T): T? =
deletedBusinessMessageUpdateOrNull() ?.let(block)
public inline fun Update.editBusinessMessageUpdateOrNull(): EditBusinessMessageUpdate? = this as?
dev.inmo.tgbotapi.types.update.EditBusinessMessageUpdate
public inline fun Update.editBusinessMessageUpdateOrThrow(): EditBusinessMessageUpdate = this as
dev.inmo.tgbotapi.types.update.EditBusinessMessageUpdate
public inline fun <T> Update.ifEditBusinessMessageUpdate(block: (EditBusinessMessageUpdate) -> T):
T? = editBusinessMessageUpdateOrNull() ?.let(block)
public inline fun Update.editChannelPostUpdateOrNull(): EditChannelPostUpdate? = this as?
dev.inmo.tgbotapi.types.update.EditChannelPostUpdate

View File

@@ -23,6 +23,9 @@ inline fun <reified T : MessageContent> ChannelContentMessage<*>.requireWithCont
inline fun <reified T : MessageContent> PrivateContentMessage<*>.withContent() = if (content is T) { this as PrivateContentMessage<T> } else { null }
inline fun <reified T : MessageContent> PrivateContentMessage<*>.requireWithContent() = withContent<T>()!!
inline fun <reified T : MessageContent> BusinessContentMessage<*>.withContent() = if (content is T) { this as BusinessContentMessage<T> } else { null }
inline fun <reified T : MessageContent> BusinessContentMessage<*>.requireWithContent() = withContent<T>()!!
inline fun <reified T : MessageContent> PublicContentMessage<*>.withContent() = if (content is T) { this as PublicContentMessage<T> } else { null }
inline fun <reified T : MessageContent> PublicContentMessage<*>.requireWithContent() = withContent<T>()!!

View File

@@ -1,2 +0,0 @@
package dev.inmo.tgbotapi.extensions.utils.extensions

View File

@@ -1,12 +1,15 @@
package dev.inmo.tgbotapi.extensions.utils.extensions
import dev.inmo.tgbotapi.abstracts.WithPreviewChat
import dev.inmo.tgbotapi.abstracts.types.WithBusinessConnectionId
import dev.inmo.tgbotapi.abstracts.types.WithOptionalBusinessConnectionId
import dev.inmo.tgbotapi.extensions.utils.usernameChatOrNull
import dev.inmo.tgbotapi.extensions.utils.whenUsernameChat
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.Username
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.abstracts.Message
import dev.inmo.tgbotapi.types.threadId
@@ -126,3 +129,17 @@ inline fun Message.sameTopic(other: Message) = sameTopic(other.chat, other.threa
*/
@Suppress("NOTHING_TO_INLINE")
inline fun Message.sameThread(other: Message) = sameTopic(other)
/**
* @return true in case if [this] message is from the same business connection (with businessConnectionId == [id])
*/
@Suppress("NOTHING_TO_INLINE")
inline fun Message.sameBusinessConnection(
id: BusinessConnectionId
) = businessConnectionId == id
/**
* @return true in case if [this] message is from the same business connection (with businessConnectionId == [other.businessConnectionId])
*/
@Suppress("NOTHING_TO_INLINE")
inline fun Message.sameBusinessConnection(other: WithBusinessConnectionId) = sameBusinessConnection(other.businessConnectionId)

View File

@@ -44,6 +44,9 @@ fun Update.sourceChatWithConverters(
chatBoostUpdatedUpdateFlow: (ChatBoostUpdatedUpdate) -> Chat? = { it.data.chat },
chatBoostRemovedUpdateFlow: (ChatBoostRemovedUpdate) -> Chat? = { it.data.chat },
businessConnectionUpdateConverter: (BusinessConnectionUpdate) -> Chat? = { it.data.user },
businessMessageUpdateConverter: (BusinessMessageUpdate) -> Chat? = { it.data.chat },
editBusinessMessageUpdateConverter: (EditBusinessMessageUpdate) -> Chat? = { it.data.chat },
deleteBusinessMessageUpdateConverter: (DeletedBusinessMessageUpdate) -> Chat? = { it.data.chat },
commonChatMemberUpdatedUpdateConverter: (CommonChatMemberUpdatedUpdate) -> Chat? = { it.data.chat }
): Chat? = when (this) {
is BaseMessageUpdate -> baseMessageUpdateConverter(this)
@@ -66,6 +69,9 @@ fun Update.sourceChatWithConverters(
is ChatBoostUpdatedUpdate -> chatBoostUpdatedUpdateFlow(this)
is ChatBoostRemovedUpdate -> chatBoostRemovedUpdateFlow(this)
is BusinessConnectionUpdate -> businessConnectionUpdateConverter(this)
is BusinessMessageUpdate -> businessMessageUpdateConverter(this)
is EditBusinessMessageUpdate -> editBusinessMessageUpdateConverter(this)
is DeletedBusinessMessageUpdate -> deleteBusinessMessageUpdateConverter(this)
else -> {
when (val data = data) {
is FromUser -> data.from

View File

@@ -0,0 +1,12 @@
package dev.inmo.tgbotapi.extensions.utils.shortcuts
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
import dev.inmo.tgbotapi.types.message.abstracts.BusinessContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.content.MessageContent
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.filterIsInstance
inline fun Flow<AccessibleMessage>.businessMessages() = filterIsInstance<BusinessContentMessage<*>>()
inline fun <reified T : MessageContent> Flow<ContentMessage<T>>.businessMessagesWithType() = filterIsInstance<BusinessContentMessage<T>>()
inline fun Flow<ContentMessage<*>>.allBusinessMessages() = businessMessagesWithType()