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

add paid media payload support

This commit is contained in:
2024-09-06 20:05:32 +06:00
parent 3f726c9b3b
commit 1980f8a9ca
22 changed files with 430 additions and 55 deletions

View File

@@ -1774,6 +1774,8 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun ifOwnerChatMember (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifPaid (Ldev/inmo/tgbotapi/types/reactions/Reaction;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifPaidMediaInfoContent (Ldev/inmo/tgbotapi/types/message/content/ResendableContent;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifPaidMediaPurchased (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifPaidMediaPurchasedUpdate (Ldev/inmo/tgbotapi/types/update/abstracts/Update;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifPassport (Ldev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElement;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifPassportElementErrorDataField (Ldev/inmo/tgbotapi/types/passport/PassportElementError;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun ifPassportElementErrorFile (Ldev/inmo/tgbotapi/types/passport/PassportElementError;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
@@ -2196,6 +2198,10 @@ public final class dev/inmo/tgbotapi/extensions/utils/ClassCastsNewKt {
public static final fun ownerChatMemberOrThrow (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;)Ldev/inmo/tgbotapi/types/chat/member/OwnerChatMember;
public static final fun paidMediaInfoContentOrNull (Ldev/inmo/tgbotapi/types/message/content/ResendableContent;)Ldev/inmo/tgbotapi/types/message/content/PaidMediaInfoContent;
public static final fun paidMediaInfoContentOrThrow (Ldev/inmo/tgbotapi/types/message/content/ResendableContent;)Ldev/inmo/tgbotapi/types/message/content/PaidMediaInfoContent;
public static final fun paidMediaPurchasedOrNull (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;)Ldev/inmo/tgbotapi/types/message/payments/PaidMediaPurchased;
public static final fun paidMediaPurchasedOrThrow (Ldev/inmo/tgbotapi/abstracts/OptionallyWithUser;)Ldev/inmo/tgbotapi/types/message/payments/PaidMediaPurchased;
public static final fun paidMediaPurchasedUpdateOrNull (Ldev/inmo/tgbotapi/types/update/abstracts/Update;)Ldev/inmo/tgbotapi/types/update/PaidMediaPurchasedUpdate;
public static final fun paidMediaPurchasedUpdateOrThrow (Ldev/inmo/tgbotapi/types/update/abstracts/Update;)Ldev/inmo/tgbotapi/types/update/PaidMediaPurchasedUpdate;
public static final fun paidOrNull (Ldev/inmo/tgbotapi/types/reactions/Reaction;)Ldev/inmo/tgbotapi/types/reactions/Reaction$Paid;
public static final fun paidOrThrow (Ldev/inmo/tgbotapi/types/reactions/Reaction;)Ldev/inmo/tgbotapi/types/reactions/Reaction$Paid;
public static final fun passportElementErrorDataFieldOrNull (Ldev/inmo/tgbotapi/types/passport/PassportElementError;)Ldev/inmo/tgbotapi/types/passport/PassportElementErrorDataField;
@@ -2850,8 +2856,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;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 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;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;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;
}

View File

@@ -351,6 +351,7 @@ import dev.inmo.tgbotapi.types.message.content.VideoNoteContent
import dev.inmo.tgbotapi.types.message.content.VisualMediaGroupPartContent
import dev.inmo.tgbotapi.types.message.content.VoiceContent
import dev.inmo.tgbotapi.types.message.content.WithCustomizedCaptionMediaContent
import dev.inmo.tgbotapi.types.message.payments.PaidMediaPurchased
import dev.inmo.tgbotapi.types.message.payments.RefundedPaymentEvent
import dev.inmo.tgbotapi.types.message.payments.SuccessfulPaymentEvent
import dev.inmo.tgbotapi.types.message.textsources.BlockquoteTextSource
@@ -487,6 +488,7 @@ import dev.inmo.tgbotapi.types.update.EditMessageUpdate
import dev.inmo.tgbotapi.types.update.InlineQueryUpdate
import dev.inmo.tgbotapi.types.update.MessageUpdate
import dev.inmo.tgbotapi.types.update.MyChatMemberUpdatedUpdate
import dev.inmo.tgbotapi.types.update.PaidMediaPurchasedUpdate
import dev.inmo.tgbotapi.types.update.PollAnswerUpdate
import dev.inmo.tgbotapi.types.update.PollUpdate
import dev.inmo.tgbotapi.types.update.PreCheckoutQueryUpdate
@@ -931,6 +933,15 @@ public inline fun <T>
OptionallyWithUser.ifSupergroupEventMessage(block: (SupergroupEventMessage<SupergroupEvent>) -> T):
T? = supergroupEventMessageOrNull() ?.let(block)
public inline fun OptionallyWithUser.paidMediaPurchasedOrNull(): PaidMediaPurchased? = this as?
dev.inmo.tgbotapi.types.message.payments.PaidMediaPurchased
public inline fun OptionallyWithUser.paidMediaPurchasedOrThrow(): PaidMediaPurchased = this as
dev.inmo.tgbotapi.types.message.payments.PaidMediaPurchased
public inline fun <T> OptionallyWithUser.ifPaidMediaPurchased(block: (PaidMediaPurchased) -> T): T?
= paidMediaPurchasedOrNull() ?.let(block)
public inline fun OptionallyWithUser.preCheckoutQueryOrNull(): PreCheckoutQuery? = this as?
dev.inmo.tgbotapi.types.payments.PreCheckoutQuery
@@ -5621,6 +5632,15 @@ public inline fun Update.myChatMemberUpdatedUpdateOrThrow(): MyChatMemberUpdated
public inline fun <T> Update.ifMyChatMemberUpdatedUpdate(block: (MyChatMemberUpdatedUpdate) -> T):
T? = myChatMemberUpdatedUpdateOrNull() ?.let(block)
public inline fun Update.paidMediaPurchasedUpdateOrNull(): PaidMediaPurchasedUpdate? = this as?
dev.inmo.tgbotapi.types.update.PaidMediaPurchasedUpdate
public inline fun Update.paidMediaPurchasedUpdateOrThrow(): PaidMediaPurchasedUpdate = this as
dev.inmo.tgbotapi.types.update.PaidMediaPurchasedUpdate
public inline fun <T> Update.ifPaidMediaPurchasedUpdate(block: (PaidMediaPurchasedUpdate) -> T): T?
= paidMediaPurchasedUpdateOrNull() ?.let(block)
public inline fun Update.pollAnswerUpdateOrNull(): PollAnswerUpdate? = this as?
dev.inmo.tgbotapi.types.update.PollAnswerUpdate

View File

@@ -47,6 +47,7 @@ fun Update.sourceChatWithConverters(
businessMessageUpdateConverter: (BusinessMessageUpdate) -> Chat? = { it.data.chat },
editBusinessMessageUpdateConverter: (EditBusinessMessageUpdate) -> Chat? = { it.data.chat },
deleteBusinessMessageUpdateConverter: (DeletedBusinessMessageUpdate) -> Chat? = { it.data.chat },
paidMediaPurchasedUpdatesFlowConverter: (PaidMediaPurchasedUpdate) -> Chat? = { it.data.user },
commonChatMemberUpdatedUpdateConverter: (CommonChatMemberUpdatedUpdate) -> Chat? = { it.data.chat }
): Chat? = when (this) {
is BaseMessageUpdate -> baseMessageUpdateConverter(this)
@@ -72,6 +73,7 @@ fun Update.sourceChatWithConverters(
is BusinessMessageUpdate -> businessMessageUpdateConverter(this)
is EditBusinessMessageUpdate -> editBusinessMessageUpdateConverter(this)
is DeletedBusinessMessageUpdate -> deleteBusinessMessageUpdateConverter(this)
is PaidMediaPurchasedUpdate -> paidMediaPurchasedUpdatesFlowConverter(this)
else -> {
when (val data = data) {
is FromUser -> data.from