mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2026-10-24 05:30:22 +00:00
Add Bot API 10.2 subscription updates support
New BotSubscriptionUpdated payload (user, invoicePayload, typed state: Canceled/Active/Failed/Unknown) in dev.inmo.tgbotapi.types.payments and the BotSubscriptionUpdatedUpdate for the new subscription update (UPDATE_SUBSCRIPTION), FlowsUpdatesFilter.botSubscriptionUpdatedUpdatesFlow, onBotSubscriptionUpdated trigger, waitBotSubscriptionUpdated expectation and class casts. Notes the Telegram-side Mini App method-origin security hardening. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2328,6 +2328,16 @@ inline fun Update.asChatJoinRequestUpdate(): ChatJoinRequestUpdate? = this as? C
|
||||
@PreviewFeature
|
||||
inline fun Update.requireChatJoinRequestUpdate(): ChatJoinRequestUpdate = this as ChatJoinRequestUpdate
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> Update.whenBotSubscriptionUpdatedUpdate(block: (BotSubscriptionUpdatedUpdate) -> T) =
|
||||
asBotSubscriptionUpdatedUpdate()?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Update.asBotSubscriptionUpdatedUpdate(): BotSubscriptionUpdatedUpdate? = this as? BotSubscriptionUpdatedUpdate
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Update.requireBotSubscriptionUpdatedUpdate(): BotSubscriptionUpdatedUpdate = this as BotSubscriptionUpdatedUpdate
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> TelegramMediaFile.whenAnimationFile(block: (AnimationFile) -> T) = asAnimationFile()?.let(block)
|
||||
|
||||
|
||||
@@ -521,6 +521,7 @@ import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.EncryptedPassportEle
|
||||
import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.EncryptedPassportElementWithReverseSide
|
||||
import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.EncryptedPassportElementWithSelfie
|
||||
import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.UnknownEncryptedPassportElement
|
||||
import dev.inmo.tgbotapi.types.payments.BotSubscriptionUpdated
|
||||
import dev.inmo.tgbotapi.types.payments.PreCheckoutQuery
|
||||
import dev.inmo.tgbotapi.types.payments.ShippingQuery
|
||||
import dev.inmo.tgbotapi.types.payments.stars.RevenueWithdrawalState
|
||||
@@ -630,6 +631,7 @@ import dev.inmo.tgbotapi.types.rich.RichTextSuperscript
|
||||
import dev.inmo.tgbotapi.types.rich.RichTextTextMention
|
||||
import dev.inmo.tgbotapi.types.rich.RichTextUnderline
|
||||
import dev.inmo.tgbotapi.types.rich.RichTextUrl
|
||||
import dev.inmo.tgbotapi.types.update.BotSubscriptionUpdatedUpdate
|
||||
import dev.inmo.tgbotapi.types.update.BusinessConnectionUpdate
|
||||
import dev.inmo.tgbotapi.types.update.BusinessMessageUpdate
|
||||
import dev.inmo.tgbotapi.types.update.CallbackQueryUpdate
|
||||
@@ -4096,6 +4098,12 @@ public inline fun Update.chatMessageReactionsCountUpdatedUpdateOrThrow(): ChatMe
|
||||
|
||||
public inline fun <T> Update.ifChatMessageReactionsCountUpdatedUpdate(block: (ChatMessageReactionsCountUpdatedUpdate) -> T): T? = chatMessageReactionsCountUpdatedUpdateOrNull() ?.let(block)
|
||||
|
||||
public inline fun Update.botSubscriptionUpdatedUpdateOrNull(): BotSubscriptionUpdatedUpdate? = this as? dev.inmo.tgbotapi.types.update.BotSubscriptionUpdatedUpdate
|
||||
|
||||
public inline fun Update.botSubscriptionUpdatedUpdateOrThrow(): BotSubscriptionUpdatedUpdate = this as dev.inmo.tgbotapi.types.update.BotSubscriptionUpdatedUpdate
|
||||
|
||||
public inline fun <T> Update.ifBotSubscriptionUpdatedUpdate(block: (BotSubscriptionUpdatedUpdate) -> T): T? = botSubscriptionUpdatedUpdateOrNull() ?.let(block)
|
||||
|
||||
public inline fun Update.chatJoinRequestUpdateOrNull(): ChatJoinRequestUpdate? = this as? dev.inmo.tgbotapi.types.update.ChatJoinRequestUpdate
|
||||
|
||||
public inline fun Update.chatJoinRequestUpdateOrThrow(): ChatJoinRequestUpdate = this as dev.inmo.tgbotapi.types.update.ChatJoinRequestUpdate
|
||||
@@ -4930,6 +4938,12 @@ public inline fun OptionallyWithUser.shippingQueryOrThrow(): ShippingQuery = thi
|
||||
|
||||
public inline fun <T> OptionallyWithUser.ifShippingQuery(block: (ShippingQuery) -> T): T? = shippingQueryOrNull() ?.let(block)
|
||||
|
||||
public inline fun OptionallyWithUser.botSubscriptionUpdatedOrNull(): BotSubscriptionUpdated? = this as? dev.inmo.tgbotapi.types.payments.BotSubscriptionUpdated
|
||||
|
||||
public inline fun OptionallyWithUser.botSubscriptionUpdatedOrThrow(): BotSubscriptionUpdated = this as dev.inmo.tgbotapi.types.payments.BotSubscriptionUpdated
|
||||
|
||||
public inline fun <T> OptionallyWithUser.ifBotSubscriptionUpdated(block: (BotSubscriptionUpdated) -> T): T? = botSubscriptionUpdatedOrNull() ?.let(block)
|
||||
|
||||
public inline fun OptionallyWithUser.chatInviteLinkOrNull(): ChatInviteLink? = this as? dev.inmo.tgbotapi.types.ChatInviteLink
|
||||
|
||||
public inline fun OptionallyWithUser.chatInviteLinkOrThrow(): ChatInviteLink = this as dev.inmo.tgbotapi.types.ChatInviteLink
|
||||
|
||||
Reference in New Issue
Block a user