From a2ce66f3cafa41d173a645d8358365b43f75fa0b Mon Sep 17 00:00:00 2001 From: Jey Date: Wed, 4 Dec 2024 17:27:16 +0300 Subject: [PATCH] 7.6.0 (#296) * Supported Telegram API [8.1](https://core.telegram.org/bots/api-changelog#december-4-2024). * Fixed `InlineQueryResult` cached and usual results serde clashing issue. * Fixed `savePreparedInlineMessage` options serde issue. * Added option to disable automatically cleaning class data through plugin's `autoCleanClassData` parameter. --- .../workflows/gradle-wrapper-validation.yml | 10 ++ CHANGELOG.md | 7 + README.md | 2 + buildSrc/src/main/resources/api.json | 117 +++++++++++++++- buildSrc/src/main/resources/scrape.py | 6 +- gradle/libs.versions.toml | 6 +- gradle/wrapper/gradle-wrapper.properties | 2 +- .../eu/vendeli/ksp/ActivityCollectors.kt | 6 +- .../eu/vendeli/ksp/ActivityProcessor.kt | 2 + .../eu/vendeli/ksp/InputChainCollector.kt | 2 +- .../eu/vendeli/ksp/InvocationLambdaBuilder.kt | 7 +- .../eu/vendeli/ksp/dto/CollectorsContext.kt | 1 + .../kotlin/eu/vendeli/ksp/utils/ParseUtils.kt | 2 +- .../eu/vendeli/ktgram/gradle/KtGramExt.kt | 1 + .../eu/vendeli/ktgram/gradle/KtGramPlugin.kt | 3 + .../vendeli/ktgram/extutils/TelegramBotSc.kt | 3 + settings.gradle.kts | 2 +- telegram-bot/api/telegram-bot.api | 127 +++++++++++++++--- telegram-bot/api/telegram-bot.klib.api | 119 +++++++++++++--- .../tgbot/api/botactions/CreateInvoiceLink.kt | 4 +- .../botactions/SavePreparedInlineMessage.kt | 10 +- .../eu/vendeli/tgbot/core/TgUpdateHandler.kt | 2 +- .../tgbot/interfaces/action/SimpleAction.kt | 2 +- .../tgbot/types/inline/InlineQueryResult.kt | 14 ++ .../tgbot/types/internal/ActivitiesData.kt | 8 +- .../tgbot/types/internal/InvocationMeta.kt | 3 +- .../SavePreparedInlineMessageOptions.kt | 3 + .../tgbot/types/stars/AffiliateInfo.kt | 25 ++++ .../tgbot/types/stars/StarTransaction.kt | 4 +- .../tgbot/types/stars/TransactionPartner.kt | 9 ++ .../tgbot/utils/BotRequestExtensions.kt | 24 ++-- .../eu/vendeli/tgbot/utils/LoggingUtils.kt | 8 +- .../eu/vendeli/tgbot/utils/ProcessUpdate.kt | 2 +- .../tgbot/utils/UpdateHandlingExtensions.kt | 4 +- .../vendeli/tgbot/utils/serde/SerdeHelpers.kt | 2 +- .../src/jvmTest/kotlin/BotTestContext.kt | 18 ++- .../kotlin/eu/vendeli/SerdeIssuesTest.kt | 14 +- .../api/botactions/CreateInvoiceLinkTest.kt | 3 +- .../EditUserStarSubscriptionTest.kt | 13 ++ .../vendeli/api/botactions/EmojiStatusTest.kt | 13 ++ .../eu/vendeli/api/botactions/GiftTest.kt | 23 ++++ .../SavePreparedInlineMessageTest.kt | 35 +++++ 42 files changed, 572 insertions(+), 96 deletions(-) create mode 100644 .github/workflows/gradle-wrapper-validation.yml create mode 100644 telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/types/stars/AffiliateInfo.kt create mode 100644 telegram-bot/src/jvmTest/kotlin/eu/vendeli/api/botactions/EditUserStarSubscriptionTest.kt create mode 100644 telegram-bot/src/jvmTest/kotlin/eu/vendeli/api/botactions/EmojiStatusTest.kt create mode 100644 telegram-bot/src/jvmTest/kotlin/eu/vendeli/api/botactions/GiftTest.kt create mode 100644 telegram-bot/src/jvmTest/kotlin/eu/vendeli/api/botactions/SavePreparedInlineMessageTest.kt diff --git a/.github/workflows/gradle-wrapper-validation.yml b/.github/workflows/gradle-wrapper-validation.yml new file mode 100644 index 0000000000..f2e6f69cae --- /dev/null +++ b/.github/workflows/gradle-wrapper-validation.yml @@ -0,0 +1,10 @@ +name: "Validate Gradle Wrapper" +on: [push, pull_request] + +jobs: + validation: + name: "Validation" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.2.2 + - uses: gradle/wrapper-validation-action@v3 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a59c01cec..7d75544eb7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Telegram-bot (KtGram) Changelog +## 7.6.0 + +* Supported Telegram API [8.1](https://core.telegram.org/bots/api-changelog#december-4-2024). +* Fixed `InlineQueryResult` cached and usual results serde clashing issue. +* Fixed `savePreparedInlineMessage` options serde issue. +* Added option to disable automatically cleaning class data through plugin's `autoCleanClassData` parameter. + ## 7.5.0 * Supported Telegram API [8.0](https://core.telegram.org/bots/api-changelog#november-17-2024). diff --git a/README.md b/README.md index 5c7fa9db5a..df1f5aa795 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,8 @@ [![Chat in Telegram](https://img.shields.io/static/v1?label=Telegram&message=Chat&color=blue&logo=telegram)](https://t.me/venny_tgbot) [![Chat in Telegram](https://img.shields.io/static/v1?label=Telegram&message=Channel&color=blue&logo=telegram)](https://t.me/kotlingram) +[![Validate Gradle Wrapper](https://github.com/vendelieu/telegram-bot/actions/workflows/gradle-wrapper-validation.yml/badge.svg)](https://github.com/vendelieu/telegram-bot/actions/workflows/gradle-wrapper-validation.yml) + Telegram Bot Api wrapper with a user-friendly interface. # Installation diff --git a/buildSrc/src/main/resources/api.json b/buildSrc/src/main/resources/api.json index 66676f9892..9f284eca14 100644 --- a/buildSrc/src/main/resources/api.json +++ b/buildSrc/src/main/resources/api.json @@ -1,7 +1,7 @@ { - "version": "Bot API 8.0", - "release_date": "November 17, 2024", - "changelog": "https://core.telegram.org/bots/api#november-17-2024", + "version": "Bot API 8.1", + "release_date": "December 4, 2024", + "changelog": "https://core.telegram.org/bots/api#december-4-2024", "methods": { "getUpdates": { "name": "getUpdates", @@ -6223,7 +6223,7 @@ "String" ], "required": false, - "description": "Unique identifier of the business connection on behalf of which the link will be created" + "description": "Unique identifier of the business connection on behalf of which the link will be created. For payments in Telegram Stars only." }, { "name": "title", @@ -6279,7 +6279,7 @@ "Integer" ], "required": false, - "description": "The number of seconds the subscription will be active for before the next payment. The currency must be set to \"XTR\" (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified." + "description": "The number of seconds the subscription will be active for before the next payment. The currency must be set to \"XTR\" (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified. Any number of subscriptions can be active for a given bot at the same time, including multiple concurrent subscriptions from the same user. Subscription price must no exceed 2500 Telegram Stars." }, { "name": "max_tip_amount", @@ -18032,12 +18032,62 @@ "RevenueWithdrawalState" ] }, + "AffiliateInfo": { + "name": "AffiliateInfo", + "href": "https://core.telegram.org/bots/api#affiliateinfo", + "description": [ + "Contains information about the affiliate that received a commission via this transaction." + ], + "fields": [ + { + "name": "affiliate_user", + "types": [ + "User" + ], + "required": false, + "description": "Optional. The bot or the user that received an affiliate commission if it was received by a bot or a user" + }, + { + "name": "affiliate_chat", + "types": [ + "Chat" + ], + "required": false, + "description": "Optional. The chat that received an affiliate commission if it was received by a chat" + }, + { + "name": "commission_per_mille", + "types": [ + "Integer" + ], + "required": true, + "description": "The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the bot from referred users" + }, + { + "name": "amount", + "types": [ + "Integer" + ], + "required": true, + "description": "Integer amount of Telegram Stars received by the affiliate from the transaction, rounded to 0; can be negative for refunds" + }, + { + "name": "nanostar_amount", + "types": [ + "Integer" + ], + "required": false, + "description": "Optional. The number of 1/1000000000 shares of Telegram Stars received by the affiliate; from -999999999 to 999999999; can be negative for refunds" + } + ] + }, "TransactionPartner": { "name": "TransactionPartner", "href": "https://core.telegram.org/bots/api#transactionpartner", "description": [ "This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of", "- TransactionPartnerUser", + "- TransactionPartnerAffiliateProgram", "- TransactionPartnerFragment", "- TransactionPartnerTelegramAds", "- TransactionPartnerTelegramApi", @@ -18045,6 +18095,7 @@ ], "subtypes": [ "TransactionPartnerUser", + "TransactionPartnerAffiliateProgram", "TransactionPartnerFragment", "TransactionPartnerTelegramAds", "TransactionPartnerTelegramApi", @@ -18074,6 +18125,14 @@ "required": true, "description": "Information about the user" }, + { + "name": "affiliate", + "types": [ + "AffiliateInfo" + ], + "required": false, + "description": "Optional. Information about the affiliate that received a commission via this transaction" + }, { "name": "invoice_payload", "types": [ @@ -18109,7 +18168,7 @@ { "name": "gift", "types": [ - "String" + "Gift" ], "required": false, "description": "Optional. The gift sent to the user by the bot" @@ -18119,6 +18178,42 @@ "TransactionPartner" ] }, + "TransactionPartnerAffiliateProgram": { + "name": "TransactionPartnerAffiliateProgram", + "href": "https://core.telegram.org/bots/api#transactionpartneraffiliateprogram", + "description": [ + "Describes the affiliate program that issued the affiliate commission received via this transaction." + ], + "fields": [ + { + "name": "type", + "types": [ + "String" + ], + "required": true, + "description": "Type of the transaction partner, always \"affiliate_program\"" + }, + { + "name": "sponsor_user", + "types": [ + "User" + ], + "required": false, + "description": "Optional. Information about the bot that sponsored the affiliate program" + }, + { + "name": "commission_per_mille", + "types": [ + "Integer" + ], + "required": true, + "description": "The number of Telegram Stars received by the bot for each 1000 Telegram Stars received by the affiliate program sponsor from referred users" + } + ], + "subtype_of": [ + "TransactionPartner" + ] + }, "TransactionPartnerFragment": { "name": "TransactionPartnerFragment", "href": "https://core.telegram.org/bots/api#transactionpartnerfragment", @@ -18236,7 +18331,15 @@ "Integer" ], "required": true, - "description": "Number of Telegram Stars transferred by the transaction" + "description": "Integer amount of Telegram Stars transferred by the transaction" + }, + { + "name": "nanostar_amount", + "types": [ + "Integer" + ], + "required": false, + "description": "Optional. The number of 1/1000000000 shares of Telegram Stars transferred by the transaction; from 0 to 999999999" }, { "name": "date", diff --git a/buildSrc/src/main/resources/scrape.py b/buildSrc/src/main/resources/scrape.py index ef188d36be..eceed545e7 100644 --- a/buildSrc/src/main/resources/scrape.py +++ b/buildSrc/src/main/resources/scrape.py @@ -143,9 +143,9 @@ def get_fields(curr_name: str, curr_type: str, x: Tag, items: dict, url: str): def get_method_return_type(curr_name: str, curr_type: str, description_items: list[str], items: dict): description = "\n".join(description_items) - ret_search = re.search("(?:on success,)([^.]*)", description, re.IGNORECASE) - ret_search2 = re.search("(?:returns)([^.]*)(?:on success)?", description, re.IGNORECASE) - ret_search3 = re.search("([^.]*)(?:is returned)", description, re.IGNORECASE) + ret_search = re.search(".*(?:on success,)([^.]*)", description, re.IGNORECASE) + ret_search2 = re.search(".*(?:returns)([^.]*)(?:on success)?", description, re.IGNORECASE) + ret_search3 = re.search(".*([^.]*)(?:is returned)", description, re.IGNORECASE) if ret_search: extract_return_type(curr_type, curr_name, ret_search.group(1).strip(), items) elif ret_search2: diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d8be648d12..58042e8b38 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -7,7 +7,7 @@ datetime = "0.6.0" serialization = "1.7.3" stately = "2.1.0" -kotlin = "2.0.21" +kotlin = "2.1.0" coroutines = "1.9.0" dokka = "1.9.20" kotlinter = "4.5.0" @@ -20,9 +20,9 @@ kover = "0.8.3" krypto = "4.0.10" urlencoder = "1.6.0" sslcontext = "8.3.7" -spring = "3.3.5" +spring = "3.4.0" -ksp = "2.0.21-1.0.28" +ksp = "2.1.0-1.0.29" poet = "2.0.0" binvalid = "0.16.3" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 94113f200e..e2847c8200 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/ksp/src/jvmMain/kotlin/eu/vendeli/ksp/ActivityCollectors.kt b/ksp/src/jvmMain/kotlin/eu/vendeli/ksp/ActivityCollectors.kt index f713876417..7c69f83bf9 100644 --- a/ksp/src/jvmMain/kotlin/eu/vendeli/ksp/ActivityCollectors.kt +++ b/ksp/src/jvmMain/kotlin/eu/vendeli/ksp/ActivityCollectors.kt @@ -76,7 +76,7 @@ internal fun collectCommandActivities( activitiesFile.buildInvocationLambdaCodeBlock( function, injectableTypes, - pkg, + ctx, buildMeta( qualifier = function.qualifiedName!!.getQualifier(), function = function.simpleName.asString(), @@ -124,7 +124,7 @@ internal fun collectInputActivities( activitiesFile.buildInvocationLambdaCodeBlock( function, injectableTypes, - pkg, + ctx, buildMeta( qualifier = function.qualifiedName!!.getQualifier(), function = function.simpleName.asString(), @@ -198,7 +198,7 @@ internal fun collectCommonActivities( activitiesFile.buildInvocationLambdaCodeBlock( commonAnnotationData.funDeclaration, injectableTypes, - pkg, + ctx, buildMeta( qualifier = commonAnnotationData.funQualifier, function = commonAnnotationData.funSimpleName, diff --git a/ksp/src/jvmMain/kotlin/eu/vendeli/ksp/ActivityProcessor.kt b/ksp/src/jvmMain/kotlin/eu/vendeli/ksp/ActivityProcessor.kt index e3e11b5b54..dac52cc213 100644 --- a/ksp/src/jvmMain/kotlin/eu/vendeli/ksp/ActivityProcessor.kt +++ b/ksp/src/jvmMain/kotlin/eu/vendeli/ksp/ActivityProcessor.kt @@ -42,6 +42,7 @@ class ActivityProcessor( private val codeGenerator: CodeGenerator, ) : SymbolProcessor { private val targetPackage = options["package"]?.split(';') + private val autoCleanClassData = options["autoCleanClassData"]?.toBooleanStrictOrNull() != false override fun process(resolver: Resolver): List { val fileSpec = FileSpec.builder("eu.vendeli.tgbot.generated", "ActivitiesData").apply { @@ -144,6 +145,7 @@ class ActivityProcessor( logger = logger, idxPostfix = idxPostfix, pkg = filePkg, + autoCleanClassData = autoCleanClassData ) collectCommandActivities(commandHandlerSymbols, context) diff --git a/ksp/src/jvmMain/kotlin/eu/vendeli/ksp/InputChainCollector.kt b/ksp/src/jvmMain/kotlin/eu/vendeli/ksp/InputChainCollector.kt index 2f439b7b5f..01d2032edc 100644 --- a/ksp/src/jvmMain/kotlin/eu/vendeli/ksp/InputChainCollector.kt +++ b/ksp/src/jvmMain/kotlin/eu/vendeli/ksp/InputChainCollector.kt @@ -32,7 +32,7 @@ internal fun collectInputChains( }.arguments .firstOrNull() ?.value - ?.cast() ?: false + ?.cast() == true val links = chain.declarations .filter { i -> diff --git a/ksp/src/jvmMain/kotlin/eu/vendeli/ksp/InvocationLambdaBuilder.kt b/ksp/src/jvmMain/kotlin/eu/vendeli/ksp/InvocationLambdaBuilder.kt index 60417c21fe..da93ce330d 100644 --- a/ksp/src/jvmMain/kotlin/eu/vendeli/ksp/InvocationLambdaBuilder.kt +++ b/ksp/src/jvmMain/kotlin/eu/vendeli/ksp/InvocationLambdaBuilder.kt @@ -14,6 +14,7 @@ import com.squareup.kotlinpoet.STRING import com.squareup.kotlinpoet.TypeName import com.squareup.kotlinpoet.buildCodeBlock import com.squareup.kotlinpoet.ksp.toTypeName +import eu.vendeli.ksp.dto.CollectorsContext import eu.vendeli.ksp.dto.CommandHandlerParams import eu.vendeli.ksp.dto.LambdaParameters import eu.vendeli.ksp.utils.FileBuilder @@ -78,7 +79,7 @@ import kotlin.reflect.KClass internal fun FileBuilder.buildInvocationLambdaCodeBlock( function: KSFunctionDeclaration, injectableTypes: Map, - pkg: String? = null, + ctx: CollectorsContext? = null, meta: Pair>? = null, parameters: List = emptyList(), ) = buildCodeBlock { @@ -176,12 +177,12 @@ internal fun FileBuilder.buildInvocationLambdaCodeBlock( if (index < function.parameters.lastIndex) parametersEnumeration += ", " } - if (pkg != null) add( + if (ctx?.autoCleanClassData == true && ctx.pkg != null) add( "\nif (\n\t" + (if (isUserNullable) "user != null\n && " else "") + "bot.update.userClassSteps[user.id] != %S\n) %L.____clearClassData(user.id)\n", funQualifier, - pkg, + ctx.pkg, ) if (parameters.contains(CommandHandlerParams.CallbackQueryAutoAnswer)) { diff --git a/ksp/src/jvmMain/kotlin/eu/vendeli/ksp/dto/CollectorsContext.kt b/ksp/src/jvmMain/kotlin/eu/vendeli/ksp/dto/CollectorsContext.kt index 8370a21992..5e729bc62c 100644 --- a/ksp/src/jvmMain/kotlin/eu/vendeli/ksp/dto/CollectorsContext.kt +++ b/ksp/src/jvmMain/kotlin/eu/vendeli/ksp/dto/CollectorsContext.kt @@ -12,4 +12,5 @@ data class CollectorsContext( val logger: KSPLogger, val idxPostfix: String, val pkg: String? = null, + val autoCleanClassData: Boolean = true, ) diff --git a/ksp/src/jvmMain/kotlin/eu/vendeli/ksp/utils/ParseUtils.kt b/ksp/src/jvmMain/kotlin/eu/vendeli/ksp/utils/ParseUtils.kt index 2e09d0ee9d..0831df6f96 100644 --- a/ksp/src/jvmMain/kotlin/eu/vendeli/ksp/utils/ParseUtils.kt +++ b/ksp/src/jvmMain/kotlin/eu/vendeli/ksp/utils/ParseUtils.kt @@ -23,7 +23,7 @@ internal fun List.parseAsCommandHandler(isCallbackQ: Boolean) = scope = parseScopes() ?: if (isCallbackQ) callbackQueryList else messageList, guardClass = parseGuard(), argParserClass = parseArgParser(), - isAutoAnswer = firstOrNull { it.name?.asString() == "autoAnswer" }?.value?.safeCast() ?: false, + isAutoAnswer = firstOrNull { it.name?.asString() == "autoAnswer" }?.value?.safeCast() == true, ) internal fun List.parseAsInputHandler() = Triple( diff --git a/ktgram-gradle-plugin/src/main/kotlin/eu/vendeli/ktgram/gradle/KtGramExt.kt b/ktgram-gradle-plugin/src/main/kotlin/eu/vendeli/ktgram/gradle/KtGramExt.kt index 43c854a02d..1078eaefa9 100644 --- a/ktgram-gradle-plugin/src/main/kotlin/eu/vendeli/ktgram/gradle/KtGramExt.kt +++ b/ktgram-gradle-plugin/src/main/kotlin/eu/vendeli/ktgram/gradle/KtGramExt.kt @@ -13,4 +13,5 @@ abstract class KtGramExt val packages = factory.listProperty() val addSnapshotRepo = factory.property() val forceVersion = factory.property() + val autoCleanClassData = factory.property() } diff --git a/ktgram-gradle-plugin/src/main/kotlin/eu/vendeli/ktgram/gradle/KtGramPlugin.kt b/ktgram-gradle-plugin/src/main/kotlin/eu/vendeli/ktgram/gradle/KtGramPlugin.kt index d7e0ae8ba8..f45838dc1a 100644 --- a/ktgram-gradle-plugin/src/main/kotlin/eu/vendeli/ktgram/gradle/KtGramPlugin.kt +++ b/ktgram-gradle-plugin/src/main/kotlin/eu/vendeli/ktgram/gradle/KtGramPlugin.kt @@ -55,6 +55,9 @@ abstract class KtGramPlugin : Plugin { pluginExtension.packages.orNull?.takeIf { it.isNotEmpty() }?.joinToString(";")?.let { arg("package", it) } + pluginExtension.autoCleanClassData.getOrElse(true).takeIf { !it }?.let { + arg("autoCleanClassData", "false") + } } if (!kspPluginPresent) log.error( diff --git a/ktgram-utils/src/commonMain/kotlin/eu/vendeli/ktgram/extutils/TelegramBotSc.kt b/ktgram-utils/src/commonMain/kotlin/eu/vendeli/ktgram/extutils/TelegramBotSc.kt index 32a30e67d3..9490a9382d 100644 --- a/ktgram-utils/src/commonMain/kotlin/eu/vendeli/ktgram/extutils/TelegramBotSc.kt +++ b/ktgram-utils/src/commonMain/kotlin/eu/vendeli/ktgram/extutils/TelegramBotSc.kt @@ -473,6 +473,9 @@ public inline fun TelegramBot.refundStarPayment(telegramPaymentChargeId: String, @Suppress("NOTHING_TO_INLINE") public inline fun TelegramBot.savePreparedInlineMessage(userId: Long, result: InlineQueryResult): SavePreparedInlineMessageAction = eu.vendeli.tgbot.api.botactions.savePreparedInlineMessage(userId, result) +@Suppress("NOTHING_TO_INLINE") +public inline fun TelegramBot.savePreparedInlineMessage(userId: Long, noinline result: () -> InlineQueryResult): SavePreparedInlineMessageAction = eu.vendeli.tgbot.api.botactions.savePreparedInlineMessage(userId, result) + @Suppress("NOTHING_TO_INLINE") public inline fun TelegramBot.sendGift( userId: Long, diff --git a/settings.gradle.kts b/settings.gradle.kts index 20bfa879af..a57bd1bf2e 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" + id("org.gradle.toolchains.foojay-resolver-convention") version "0.9.0" } rootProject.name = "ktgram" diff --git a/telegram-bot/api/telegram-bot.api b/telegram-bot/api/telegram-bot.api index 8305f09933..1b611f42b8 100644 --- a/telegram-bot/api/telegram-bot.api +++ b/telegram-bot/api/telegram-bot.api @@ -680,6 +680,7 @@ public final class eu/vendeli/tgbot/api/botactions/SavePreparedInlineMessageActi public final class eu/vendeli/tgbot/api/botactions/SavePreparedInlineMessageKt { public static final fun savePreparedInlineMessage (JLeu/vendeli/tgbot/types/inline/InlineQueryResult;)Leu/vendeli/tgbot/api/botactions/SavePreparedInlineMessageAction; + public static final fun savePreparedInlineMessage (JLkotlin/jvm/functions/Function0;)Leu/vendeli/tgbot/api/botactions/SavePreparedInlineMessageAction; } public final class eu/vendeli/tgbot/api/botactions/SendGiftAction : eu/vendeli/tgbot/interfaces/action/SimpleAction, eu/vendeli/tgbot/interfaces/features/EntitiesFeature { @@ -9902,6 +9903,7 @@ public final class eu/vendeli/tgbot/types/internal/options/ReplyKeyboardMarkupOp } public final class eu/vendeli/tgbot/types/internal/options/SavePreparedInlineMessageOptions : eu/vendeli/tgbot/types/internal/options/Options { + public static final field Companion Leu/vendeli/tgbot/types/internal/options/SavePreparedInlineMessageOptions$Companion; public fun ()V public fun (Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;)V public synthetic fun (Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;ILkotlin/jvm/internal/DefaultConstructorMarker;)V @@ -9924,6 +9926,21 @@ public final class eu/vendeli/tgbot/types/internal/options/SavePreparedInlineMes public fun toString ()Ljava/lang/String; } +public synthetic class eu/vendeli/tgbot/types/internal/options/SavePreparedInlineMessageOptions$$serializer : kotlinx/serialization/internal/GeneratedSerializer { + public static final field INSTANCE Leu/vendeli/tgbot/types/internal/options/SavePreparedInlineMessageOptions$$serializer; + public final fun childSerializers ()[Lkotlinx/serialization/KSerializer; + public final fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Leu/vendeli/tgbot/types/internal/options/SavePreparedInlineMessageOptions; + public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object; + public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor; + public final fun serialize (Lkotlinx/serialization/encoding/Encoder;Leu/vendeli/tgbot/types/internal/options/SavePreparedInlineMessageOptions;)V + public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V + public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer; +} + +public final class eu/vendeli/tgbot/types/internal/options/SavePreparedInlineMessageOptions$Companion { + public final fun serializer ()Lkotlinx/serialization/KSerializer; +} + public final class eu/vendeli/tgbot/types/internal/options/SetGameScoreOptions : eu/vendeli/tgbot/types/internal/options/Options { public static final field Companion Leu/vendeli/tgbot/types/internal/options/SetGameScoreOptions$Companion; public fun ()V @@ -13488,6 +13505,42 @@ public final class eu/vendeli/tgbot/types/poll/PollType$Companion { public final fun serializer ()Lkotlinx/serialization/KSerializer; } +public final class eu/vendeli/tgbot/types/stars/AffiliateInfo { + public static final field Companion Leu/vendeli/tgbot/types/stars/AffiliateInfo$Companion; + public fun (Leu/vendeli/tgbot/types/User;Leu/vendeli/tgbot/types/chat/Chat;IILjava/lang/Integer;)V + public synthetic fun (Leu/vendeli/tgbot/types/User;Leu/vendeli/tgbot/types/chat/Chat;IILjava/lang/Integer;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public final fun component1 ()Leu/vendeli/tgbot/types/User; + public final fun component2 ()Leu/vendeli/tgbot/types/chat/Chat; + public final fun component3 ()I + public final fun component4 ()I + public final fun component5 ()Ljava/lang/Integer; + public final fun copy (Leu/vendeli/tgbot/types/User;Leu/vendeli/tgbot/types/chat/Chat;IILjava/lang/Integer;)Leu/vendeli/tgbot/types/stars/AffiliateInfo; + public static synthetic fun copy$default (Leu/vendeli/tgbot/types/stars/AffiliateInfo;Leu/vendeli/tgbot/types/User;Leu/vendeli/tgbot/types/chat/Chat;IILjava/lang/Integer;ILjava/lang/Object;)Leu/vendeli/tgbot/types/stars/AffiliateInfo; + public fun equals (Ljava/lang/Object;)Z + public final fun getAffiliateChat ()Leu/vendeli/tgbot/types/chat/Chat; + public final fun getAffiliateUser ()Leu/vendeli/tgbot/types/User; + public final fun getAmount ()I + public final fun getCommissionPerMille ()I + public final fun getNanostarAmount ()Ljava/lang/Integer; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public synthetic class eu/vendeli/tgbot/types/stars/AffiliateInfo$$serializer : kotlinx/serialization/internal/GeneratedSerializer { + public static final field INSTANCE Leu/vendeli/tgbot/types/stars/AffiliateInfo$$serializer; + public final fun childSerializers ()[Lkotlinx/serialization/KSerializer; + public final fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Leu/vendeli/tgbot/types/stars/AffiliateInfo; + public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object; + public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor; + public final fun serialize (Lkotlinx/serialization/encoding/Encoder;Leu/vendeli/tgbot/types/stars/AffiliateInfo;)V + public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V + public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer; +} + +public final class eu/vendeli/tgbot/types/stars/AffiliateInfo$Companion { + public final fun serializer ()Lkotlinx/serialization/KSerializer; +} + public abstract class eu/vendeli/tgbot/types/stars/RevenueWithdrawalState { public static final field Companion Leu/vendeli/tgbot/types/stars/RevenueWithdrawalState$Companion; public synthetic fun (ILjava/lang/String;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V @@ -13547,19 +13600,21 @@ public final class eu/vendeli/tgbot/types/stars/RevenueWithdrawalState$Succeeded public final class eu/vendeli/tgbot/types/stars/StarTransaction { public static final field Companion Leu/vendeli/tgbot/types/stars/StarTransaction$Companion; - public fun (Ljava/lang/String;ILkotlinx/datetime/Instant;Leu/vendeli/tgbot/types/stars/TransactionPartner;Leu/vendeli/tgbot/types/stars/TransactionPartner;)V - public synthetic fun (Ljava/lang/String;ILkotlinx/datetime/Instant;Leu/vendeli/tgbot/types/stars/TransactionPartner;Leu/vendeli/tgbot/types/stars/TransactionPartner;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (Ljava/lang/String;ILjava/lang/Integer;Lkotlinx/datetime/Instant;Leu/vendeli/tgbot/types/stars/TransactionPartner;Leu/vendeli/tgbot/types/stars/TransactionPartner;)V + public synthetic fun (Ljava/lang/String;ILjava/lang/Integer;Lkotlinx/datetime/Instant;Leu/vendeli/tgbot/types/stars/TransactionPartner;Leu/vendeli/tgbot/types/stars/TransactionPartner;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()Ljava/lang/String; public final fun component2 ()I - public final fun component3 ()Lkotlinx/datetime/Instant; - public final fun component4 ()Leu/vendeli/tgbot/types/stars/TransactionPartner; + public final fun component3 ()Ljava/lang/Integer; + public final fun component4 ()Lkotlinx/datetime/Instant; public final fun component5 ()Leu/vendeli/tgbot/types/stars/TransactionPartner; - public final fun copy (Ljava/lang/String;ILkotlinx/datetime/Instant;Leu/vendeli/tgbot/types/stars/TransactionPartner;Leu/vendeli/tgbot/types/stars/TransactionPartner;)Leu/vendeli/tgbot/types/stars/StarTransaction; - public static synthetic fun copy$default (Leu/vendeli/tgbot/types/stars/StarTransaction;Ljava/lang/String;ILkotlinx/datetime/Instant;Leu/vendeli/tgbot/types/stars/TransactionPartner;Leu/vendeli/tgbot/types/stars/TransactionPartner;ILjava/lang/Object;)Leu/vendeli/tgbot/types/stars/StarTransaction; + public final fun component6 ()Leu/vendeli/tgbot/types/stars/TransactionPartner; + public final fun copy (Ljava/lang/String;ILjava/lang/Integer;Lkotlinx/datetime/Instant;Leu/vendeli/tgbot/types/stars/TransactionPartner;Leu/vendeli/tgbot/types/stars/TransactionPartner;)Leu/vendeli/tgbot/types/stars/StarTransaction; + public static synthetic fun copy$default (Leu/vendeli/tgbot/types/stars/StarTransaction;Ljava/lang/String;ILjava/lang/Integer;Lkotlinx/datetime/Instant;Leu/vendeli/tgbot/types/stars/TransactionPartner;Leu/vendeli/tgbot/types/stars/TransactionPartner;ILjava/lang/Object;)Leu/vendeli/tgbot/types/stars/StarTransaction; public fun equals (Ljava/lang/Object;)Z public final fun getAmount ()I public final fun getDate ()Lkotlinx/datetime/Instant; public final fun getId ()Ljava/lang/String; + public final fun getNanostarAmount ()Ljava/lang/Integer; public final fun getReceiver ()Leu/vendeli/tgbot/types/stars/TransactionPartner; public final fun getSource ()Leu/vendeli/tgbot/types/stars/TransactionPartner; public fun hashCode ()I @@ -13616,6 +13671,36 @@ public abstract class eu/vendeli/tgbot/types/stars/TransactionPartner { public static final synthetic fun write$Self (Leu/vendeli/tgbot/types/stars/TransactionPartner;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V } +public final class eu/vendeli/tgbot/types/stars/TransactionPartner$AffiliateProgram : eu/vendeli/tgbot/types/stars/TransactionPartner { + public static final field Companion Leu/vendeli/tgbot/types/stars/TransactionPartner$AffiliateProgram$Companion; + public fun (Leu/vendeli/tgbot/types/User;I)V + public synthetic fun (Leu/vendeli/tgbot/types/User;IILkotlin/jvm/internal/DefaultConstructorMarker;)V + public final fun component1 ()Leu/vendeli/tgbot/types/User; + public final fun component2 ()I + public final fun copy (Leu/vendeli/tgbot/types/User;I)Leu/vendeli/tgbot/types/stars/TransactionPartner$AffiliateProgram; + public static synthetic fun copy$default (Leu/vendeli/tgbot/types/stars/TransactionPartner$AffiliateProgram;Leu/vendeli/tgbot/types/User;IILjava/lang/Object;)Leu/vendeli/tgbot/types/stars/TransactionPartner$AffiliateProgram; + public fun equals (Ljava/lang/Object;)Z + public final fun getCommissionPerMille ()I + public final fun getSponsorUser ()Leu/vendeli/tgbot/types/User; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public synthetic class eu/vendeli/tgbot/types/stars/TransactionPartner$AffiliateProgram$$serializer : kotlinx/serialization/internal/GeneratedSerializer { + public static final field INSTANCE Leu/vendeli/tgbot/types/stars/TransactionPartner$AffiliateProgram$$serializer; + public final fun childSerializers ()[Lkotlinx/serialization/KSerializer; + public final fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Leu/vendeli/tgbot/types/stars/TransactionPartner$AffiliateProgram; + public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object; + public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor; + public final fun serialize (Lkotlinx/serialization/encoding/Encoder;Leu/vendeli/tgbot/types/stars/TransactionPartner$AffiliateProgram;)V + public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V + public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer; +} + +public final class eu/vendeli/tgbot/types/stars/TransactionPartner$AffiliateProgram$Companion { + public final fun serializer ()Lkotlinx/serialization/KSerializer; +} + public final class eu/vendeli/tgbot/types/stars/TransactionPartner$Companion { public final fun serializer ()Lkotlinx/serialization/KSerializer; } @@ -13694,17 +13779,19 @@ public final class eu/vendeli/tgbot/types/stars/TransactionPartner$TelegramApi$C public final class eu/vendeli/tgbot/types/stars/TransactionPartner$UserPartner : eu/vendeli/tgbot/types/stars/TransactionPartner { public static final field Companion Leu/vendeli/tgbot/types/stars/TransactionPartner$UserPartner$Companion; - public synthetic fun (Leu/vendeli/tgbot/types/User;Ljava/lang/String;Ljava/util/List;Ljava/lang/String;Lkotlin/time/Duration;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public synthetic fun (Leu/vendeli/tgbot/types/User;Ljava/lang/String;Ljava/util/List;Ljava/lang/String;Lkotlin/time/Duration;Ljava/lang/String;Lkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Leu/vendeli/tgbot/types/User;Leu/vendeli/tgbot/types/stars/AffiliateInfo;Ljava/lang/String;Ljava/util/List;Ljava/lang/String;Lkotlin/time/Duration;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Leu/vendeli/tgbot/types/User;Leu/vendeli/tgbot/types/stars/AffiliateInfo;Ljava/lang/String;Ljava/util/List;Ljava/lang/String;Lkotlin/time/Duration;Ljava/lang/String;Lkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()Leu/vendeli/tgbot/types/User; - public final fun component2 ()Ljava/lang/String; - public final fun component3 ()Ljava/util/List; - public final fun component4 ()Ljava/lang/String; - public final fun component5-FghU774 ()Lkotlin/time/Duration; - public final fun component6 ()Ljava/lang/String; - public final fun copy-yV_PMig (Leu/vendeli/tgbot/types/User;Ljava/lang/String;Ljava/util/List;Ljava/lang/String;Lkotlin/time/Duration;Ljava/lang/String;)Leu/vendeli/tgbot/types/stars/TransactionPartner$UserPartner; - public static synthetic fun copy-yV_PMig$default (Leu/vendeli/tgbot/types/stars/TransactionPartner$UserPartner;Leu/vendeli/tgbot/types/User;Ljava/lang/String;Ljava/util/List;Ljava/lang/String;Lkotlin/time/Duration;Ljava/lang/String;ILjava/lang/Object;)Leu/vendeli/tgbot/types/stars/TransactionPartner$UserPartner; + public final fun component2 ()Leu/vendeli/tgbot/types/stars/AffiliateInfo; + public final fun component3 ()Ljava/lang/String; + public final fun component4 ()Ljava/util/List; + public final fun component5 ()Ljava/lang/String; + public final fun component6-FghU774 ()Lkotlin/time/Duration; + public final fun component7 ()Ljava/lang/String; + public final fun copy-7Yrd8eY (Leu/vendeli/tgbot/types/User;Leu/vendeli/tgbot/types/stars/AffiliateInfo;Ljava/lang/String;Ljava/util/List;Ljava/lang/String;Lkotlin/time/Duration;Ljava/lang/String;)Leu/vendeli/tgbot/types/stars/TransactionPartner$UserPartner; + public static synthetic fun copy-7Yrd8eY$default (Leu/vendeli/tgbot/types/stars/TransactionPartner$UserPartner;Leu/vendeli/tgbot/types/User;Leu/vendeli/tgbot/types/stars/AffiliateInfo;Ljava/lang/String;Ljava/util/List;Ljava/lang/String;Lkotlin/time/Duration;Ljava/lang/String;ILjava/lang/Object;)Leu/vendeli/tgbot/types/stars/TransactionPartner$UserPartner; public fun equals (Ljava/lang/Object;)Z + public final fun getAffiliate ()Leu/vendeli/tgbot/types/stars/AffiliateInfo; public final fun getGift ()Ljava/lang/String; public final fun getInvoicePayload ()Ljava/lang/String; public final fun getPaidMedia ()Ljava/util/List; @@ -13853,11 +13940,11 @@ public final class eu/vendeli/tgbot/utils/FunctionalDSLUtilsKt { } public final class eu/vendeli/tgbot/utils/LoggingUtilsKt { - public static final fun debug (Lorg/slf4j/Logger;Lkotlin/jvm/functions/Function0;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static final fun error (Lorg/slf4j/Logger;Ljava/lang/Throwable;Lkotlin/jvm/functions/Function0;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static synthetic fun error$default (Lorg/slf4j/Logger;Ljava/lang/Throwable;Lkotlin/jvm/functions/Function0;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; - public static final fun info (Lorg/slf4j/Logger;Lkotlin/jvm/functions/Function0;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static final fun warn (Lorg/slf4j/Logger;Lkotlin/jvm/functions/Function0;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static final fun debug (Lorg/slf4j/Logger;Lkotlin/jvm/functions/Function0;)V + public static final fun error (Lorg/slf4j/Logger;Ljava/lang/Throwable;Lkotlin/jvm/functions/Function0;)V + public static synthetic fun error$default (Lorg/slf4j/Logger;Ljava/lang/Throwable;Lkotlin/jvm/functions/Function0;ILjava/lang/Object;)V + public static final fun info (Lorg/slf4j/Logger;Lkotlin/jvm/functions/Function0;)V + public static final fun warn (Lorg/slf4j/Logger;Lkotlin/jvm/functions/Function0;)V } public class eu/vendeli/tgbot/utils/TgException : java/lang/RuntimeException { diff --git a/telegram-bot/api/telegram-bot.klib.api b/telegram-bot/api/telegram-bot.klib.api index f3dc2e607e..921b9d2ba7 100644 --- a/telegram-bot/api/telegram-bot.klib.api +++ b/telegram-bot/api/telegram-bot.klib.api @@ -980,7 +980,7 @@ abstract class <#A: kotlin/Any?> eu.vendeli.tgbot.interfaces.action/MediaAction abstract class <#A: kotlin/Any?> eu.vendeli.tgbot.interfaces.action/SimpleAction : eu.vendeli.tgbot.interfaces.action/TgAction<#A> { // eu.vendeli.tgbot.interfaces.action/SimpleAction|null[0] constructor () // eu.vendeli.tgbot.interfaces.action/SimpleAction.|(){}[0] - final suspend fun sendReturning(eu.vendeli.tgbot/TelegramBot): kotlinx.coroutines/Deferred> // eu.vendeli.tgbot.interfaces.action/SimpleAction.sendReturning|sendReturning(eu.vendeli.tgbot.TelegramBot){}[0] + final suspend inline fun sendReturning(eu.vendeli.tgbot/TelegramBot): kotlinx.coroutines/Deferred> // eu.vendeli.tgbot.interfaces.action/SimpleAction.sendReturning|sendReturning(eu.vendeli.tgbot.TelegramBot){}[0] open suspend fun send(eu.vendeli.tgbot/TelegramBot) // eu.vendeli.tgbot.interfaces.action/SimpleAction.send|send(eu.vendeli.tgbot.TelegramBot){}[0] open suspend fun sendAsync(eu.vendeli.tgbot/TelegramBot): kotlinx.coroutines/Deferred> // eu.vendeli.tgbot.interfaces.action/SimpleAction.sendAsync|sendAsync(eu.vendeli.tgbot.TelegramBot){}[0] } @@ -5082,6 +5082,19 @@ final class eu.vendeli.tgbot.types.internal.options/SavePreparedInlineMessageOpt final fun equals(kotlin/Any?): kotlin/Boolean // eu.vendeli.tgbot.types.internal.options/SavePreparedInlineMessageOptions.equals|equals(kotlin.Any?){}[0] final fun hashCode(): kotlin/Int // eu.vendeli.tgbot.types.internal.options/SavePreparedInlineMessageOptions.hashCode|hashCode(){}[0] final fun toString(): kotlin/String // eu.vendeli.tgbot.types.internal.options/SavePreparedInlineMessageOptions.toString|toString(){}[0] + + final object $serializer : kotlinx.serialization.internal/GeneratedSerializer { // eu.vendeli.tgbot.types.internal.options/SavePreparedInlineMessageOptions.$serializer|null[0] + final val descriptor // eu.vendeli.tgbot.types.internal.options/SavePreparedInlineMessageOptions.$serializer.descriptor|{}descriptor[0] + final fun (): kotlinx.serialization.descriptors/SerialDescriptor // eu.vendeli.tgbot.types.internal.options/SavePreparedInlineMessageOptions.$serializer.descriptor.|(){}[0] + + final fun childSerializers(): kotlin/Array> // eu.vendeli.tgbot.types.internal.options/SavePreparedInlineMessageOptions.$serializer.childSerializers|childSerializers(){}[0] + final fun deserialize(kotlinx.serialization.encoding/Decoder): eu.vendeli.tgbot.types.internal.options/SavePreparedInlineMessageOptions // eu.vendeli.tgbot.types.internal.options/SavePreparedInlineMessageOptions.$serializer.deserialize|deserialize(kotlinx.serialization.encoding.Decoder){}[0] + final fun serialize(kotlinx.serialization.encoding/Encoder, eu.vendeli.tgbot.types.internal.options/SavePreparedInlineMessageOptions) // eu.vendeli.tgbot.types.internal.options/SavePreparedInlineMessageOptions.$serializer.serialize|serialize(kotlinx.serialization.encoding.Encoder;eu.vendeli.tgbot.types.internal.options.SavePreparedInlineMessageOptions){}[0] + } + + final object Companion { // eu.vendeli.tgbot.types.internal.options/SavePreparedInlineMessageOptions.Companion|null[0] + final fun serializer(): kotlinx.serialization/KSerializer // eu.vendeli.tgbot.types.internal.options/SavePreparedInlineMessageOptions.Companion.serializer|serializer(){}[0] + } } final class eu.vendeli.tgbot.types.internal.options/SetGameScoreOptions : eu.vendeli.tgbot.types.internal.options/Options { // eu.vendeli.tgbot.types.internal.options/SetGameScoreOptions|null[0] @@ -8370,8 +8383,46 @@ final class eu.vendeli.tgbot.types.poll/PollOption { // eu.vendeli.tgbot.types.p } } +final class eu.vendeli.tgbot.types.stars/AffiliateInfo { // eu.vendeli.tgbot.types.stars/AffiliateInfo|null[0] + constructor (eu.vendeli.tgbot.types/User? = ..., eu.vendeli.tgbot.types.chat/Chat? = ..., kotlin/Int, kotlin/Int, kotlin/Int? = ...) // eu.vendeli.tgbot.types.stars/AffiliateInfo.|(eu.vendeli.tgbot.types.User?;eu.vendeli.tgbot.types.chat.Chat?;kotlin.Int;kotlin.Int;kotlin.Int?){}[0] + + final val affiliateChat // eu.vendeli.tgbot.types.stars/AffiliateInfo.affiliateChat|{}affiliateChat[0] + final fun (): eu.vendeli.tgbot.types.chat/Chat? // eu.vendeli.tgbot.types.stars/AffiliateInfo.affiliateChat.|(){}[0] + final val affiliateUser // eu.vendeli.tgbot.types.stars/AffiliateInfo.affiliateUser|{}affiliateUser[0] + final fun (): eu.vendeli.tgbot.types/User? // eu.vendeli.tgbot.types.stars/AffiliateInfo.affiliateUser.|(){}[0] + final val amount // eu.vendeli.tgbot.types.stars/AffiliateInfo.amount|{}amount[0] + final fun (): kotlin/Int // eu.vendeli.tgbot.types.stars/AffiliateInfo.amount.|(){}[0] + final val commissionPerMille // eu.vendeli.tgbot.types.stars/AffiliateInfo.commissionPerMille|{}commissionPerMille[0] + final fun (): kotlin/Int // eu.vendeli.tgbot.types.stars/AffiliateInfo.commissionPerMille.|(){}[0] + final val nanostarAmount // eu.vendeli.tgbot.types.stars/AffiliateInfo.nanostarAmount|{}nanostarAmount[0] + final fun (): kotlin/Int? // eu.vendeli.tgbot.types.stars/AffiliateInfo.nanostarAmount.|(){}[0] + + final fun component1(): eu.vendeli.tgbot.types/User? // eu.vendeli.tgbot.types.stars/AffiliateInfo.component1|component1(){}[0] + final fun component2(): eu.vendeli.tgbot.types.chat/Chat? // eu.vendeli.tgbot.types.stars/AffiliateInfo.component2|component2(){}[0] + final fun component3(): kotlin/Int // eu.vendeli.tgbot.types.stars/AffiliateInfo.component3|component3(){}[0] + final fun component4(): kotlin/Int // eu.vendeli.tgbot.types.stars/AffiliateInfo.component4|component4(){}[0] + final fun component5(): kotlin/Int? // eu.vendeli.tgbot.types.stars/AffiliateInfo.component5|component5(){}[0] + final fun copy(eu.vendeli.tgbot.types/User? = ..., eu.vendeli.tgbot.types.chat/Chat? = ..., kotlin/Int = ..., kotlin/Int = ..., kotlin/Int? = ...): eu.vendeli.tgbot.types.stars/AffiliateInfo // eu.vendeli.tgbot.types.stars/AffiliateInfo.copy|copy(eu.vendeli.tgbot.types.User?;eu.vendeli.tgbot.types.chat.Chat?;kotlin.Int;kotlin.Int;kotlin.Int?){}[0] + final fun equals(kotlin/Any?): kotlin/Boolean // eu.vendeli.tgbot.types.stars/AffiliateInfo.equals|equals(kotlin.Any?){}[0] + final fun hashCode(): kotlin/Int // eu.vendeli.tgbot.types.stars/AffiliateInfo.hashCode|hashCode(){}[0] + final fun toString(): kotlin/String // eu.vendeli.tgbot.types.stars/AffiliateInfo.toString|toString(){}[0] + + final object $serializer : kotlinx.serialization.internal/GeneratedSerializer { // eu.vendeli.tgbot.types.stars/AffiliateInfo.$serializer|null[0] + final val descriptor // eu.vendeli.tgbot.types.stars/AffiliateInfo.$serializer.descriptor|{}descriptor[0] + final fun (): kotlinx.serialization.descriptors/SerialDescriptor // eu.vendeli.tgbot.types.stars/AffiliateInfo.$serializer.descriptor.|(){}[0] + + final fun childSerializers(): kotlin/Array> // eu.vendeli.tgbot.types.stars/AffiliateInfo.$serializer.childSerializers|childSerializers(){}[0] + final fun deserialize(kotlinx.serialization.encoding/Decoder): eu.vendeli.tgbot.types.stars/AffiliateInfo // eu.vendeli.tgbot.types.stars/AffiliateInfo.$serializer.deserialize|deserialize(kotlinx.serialization.encoding.Decoder){}[0] + final fun serialize(kotlinx.serialization.encoding/Encoder, eu.vendeli.tgbot.types.stars/AffiliateInfo) // eu.vendeli.tgbot.types.stars/AffiliateInfo.$serializer.serialize|serialize(kotlinx.serialization.encoding.Encoder;eu.vendeli.tgbot.types.stars.AffiliateInfo){}[0] + } + + final object Companion { // eu.vendeli.tgbot.types.stars/AffiliateInfo.Companion|null[0] + final fun serializer(): kotlinx.serialization/KSerializer // eu.vendeli.tgbot.types.stars/AffiliateInfo.Companion.serializer|serializer(){}[0] + } +} + final class eu.vendeli.tgbot.types.stars/StarTransaction { // eu.vendeli.tgbot.types.stars/StarTransaction|null[0] - constructor (kotlin/String, kotlin/Int, kotlinx.datetime/Instant, eu.vendeli.tgbot.types.stars/TransactionPartner? = ..., eu.vendeli.tgbot.types.stars/TransactionPartner? = ...) // eu.vendeli.tgbot.types.stars/StarTransaction.|(kotlin.String;kotlin.Int;kotlinx.datetime.Instant;eu.vendeli.tgbot.types.stars.TransactionPartner?;eu.vendeli.tgbot.types.stars.TransactionPartner?){}[0] + constructor (kotlin/String, kotlin/Int, kotlin/Int? = ..., kotlinx.datetime/Instant, eu.vendeli.tgbot.types.stars/TransactionPartner? = ..., eu.vendeli.tgbot.types.stars/TransactionPartner? = ...) // eu.vendeli.tgbot.types.stars/StarTransaction.|(kotlin.String;kotlin.Int;kotlin.Int?;kotlinx.datetime.Instant;eu.vendeli.tgbot.types.stars.TransactionPartner?;eu.vendeli.tgbot.types.stars.TransactionPartner?){}[0] final val amount // eu.vendeli.tgbot.types.stars/StarTransaction.amount|{}amount[0] final fun (): kotlin/Int // eu.vendeli.tgbot.types.stars/StarTransaction.amount.|(){}[0] @@ -8379,6 +8430,8 @@ final class eu.vendeli.tgbot.types.stars/StarTransaction { // eu.vendeli.tgbot.t final fun (): kotlinx.datetime/Instant // eu.vendeli.tgbot.types.stars/StarTransaction.date.|(){}[0] final val id // eu.vendeli.tgbot.types.stars/StarTransaction.id|{}id[0] final fun (): kotlin/String // eu.vendeli.tgbot.types.stars/StarTransaction.id.|(){}[0] + final val nanostarAmount // eu.vendeli.tgbot.types.stars/StarTransaction.nanostarAmount|{}nanostarAmount[0] + final fun (): kotlin/Int? // eu.vendeli.tgbot.types.stars/StarTransaction.nanostarAmount.|(){}[0] final val receiver // eu.vendeli.tgbot.types.stars/StarTransaction.receiver|{}receiver[0] final fun (): eu.vendeli.tgbot.types.stars/TransactionPartner? // eu.vendeli.tgbot.types.stars/StarTransaction.receiver.|(){}[0] final val source // eu.vendeli.tgbot.types.stars/StarTransaction.source|{}source[0] @@ -8386,10 +8439,11 @@ final class eu.vendeli.tgbot.types.stars/StarTransaction { // eu.vendeli.tgbot.t final fun component1(): kotlin/String // eu.vendeli.tgbot.types.stars/StarTransaction.component1|component1(){}[0] final fun component2(): kotlin/Int // eu.vendeli.tgbot.types.stars/StarTransaction.component2|component2(){}[0] - final fun component3(): kotlinx.datetime/Instant // eu.vendeli.tgbot.types.stars/StarTransaction.component3|component3(){}[0] - final fun component4(): eu.vendeli.tgbot.types.stars/TransactionPartner? // eu.vendeli.tgbot.types.stars/StarTransaction.component4|component4(){}[0] + final fun component3(): kotlin/Int? // eu.vendeli.tgbot.types.stars/StarTransaction.component3|component3(){}[0] + final fun component4(): kotlinx.datetime/Instant // eu.vendeli.tgbot.types.stars/StarTransaction.component4|component4(){}[0] final fun component5(): eu.vendeli.tgbot.types.stars/TransactionPartner? // eu.vendeli.tgbot.types.stars/StarTransaction.component5|component5(){}[0] - final fun copy(kotlin/String = ..., kotlin/Int = ..., kotlinx.datetime/Instant = ..., eu.vendeli.tgbot.types.stars/TransactionPartner? = ..., eu.vendeli.tgbot.types.stars/TransactionPartner? = ...): eu.vendeli.tgbot.types.stars/StarTransaction // eu.vendeli.tgbot.types.stars/StarTransaction.copy|copy(kotlin.String;kotlin.Int;kotlinx.datetime.Instant;eu.vendeli.tgbot.types.stars.TransactionPartner?;eu.vendeli.tgbot.types.stars.TransactionPartner?){}[0] + final fun component6(): eu.vendeli.tgbot.types.stars/TransactionPartner? // eu.vendeli.tgbot.types.stars/StarTransaction.component6|component6(){}[0] + final fun copy(kotlin/String = ..., kotlin/Int = ..., kotlin/Int? = ..., kotlinx.datetime/Instant = ..., eu.vendeli.tgbot.types.stars/TransactionPartner? = ..., eu.vendeli.tgbot.types.stars/TransactionPartner? = ...): eu.vendeli.tgbot.types.stars/StarTransaction // eu.vendeli.tgbot.types.stars/StarTransaction.copy|copy(kotlin.String;kotlin.Int;kotlin.Int?;kotlinx.datetime.Instant;eu.vendeli.tgbot.types.stars.TransactionPartner?;eu.vendeli.tgbot.types.stars.TransactionPartner?){}[0] final fun equals(kotlin/Any?): kotlin/Boolean // eu.vendeli.tgbot.types.stars/StarTransaction.equals|equals(kotlin.Any?){}[0] final fun hashCode(): kotlin/Int // eu.vendeli.tgbot.types.stars/StarTransaction.hashCode|hashCode(){}[0] final fun toString(): kotlin/String // eu.vendeli.tgbot.types.stars/StarTransaction.toString|toString(){}[0] @@ -12597,6 +12651,35 @@ sealed class eu.vendeli.tgbot.types.stars/TransactionPartner { // eu.vendeli.tgb final val type // eu.vendeli.tgbot.types.stars/TransactionPartner.type|{}type[0] final fun (): kotlin/String // eu.vendeli.tgbot.types.stars/TransactionPartner.type.|(){}[0] + final class AffiliateProgram : eu.vendeli.tgbot.types.stars/TransactionPartner { // eu.vendeli.tgbot.types.stars/TransactionPartner.AffiliateProgram|null[0] + constructor (eu.vendeli.tgbot.types/User? = ..., kotlin/Int) // eu.vendeli.tgbot.types.stars/TransactionPartner.AffiliateProgram.|(eu.vendeli.tgbot.types.User?;kotlin.Int){}[0] + + final val commissionPerMille // eu.vendeli.tgbot.types.stars/TransactionPartner.AffiliateProgram.commissionPerMille|{}commissionPerMille[0] + final fun (): kotlin/Int // eu.vendeli.tgbot.types.stars/TransactionPartner.AffiliateProgram.commissionPerMille.|(){}[0] + final val sponsorUser // eu.vendeli.tgbot.types.stars/TransactionPartner.AffiliateProgram.sponsorUser|{}sponsorUser[0] + final fun (): eu.vendeli.tgbot.types/User? // eu.vendeli.tgbot.types.stars/TransactionPartner.AffiliateProgram.sponsorUser.|(){}[0] + + final fun component1(): eu.vendeli.tgbot.types/User? // eu.vendeli.tgbot.types.stars/TransactionPartner.AffiliateProgram.component1|component1(){}[0] + final fun component2(): kotlin/Int // eu.vendeli.tgbot.types.stars/TransactionPartner.AffiliateProgram.component2|component2(){}[0] + final fun copy(eu.vendeli.tgbot.types/User? = ..., kotlin/Int = ...): eu.vendeli.tgbot.types.stars/TransactionPartner.AffiliateProgram // eu.vendeli.tgbot.types.stars/TransactionPartner.AffiliateProgram.copy|copy(eu.vendeli.tgbot.types.User?;kotlin.Int){}[0] + final fun equals(kotlin/Any?): kotlin/Boolean // eu.vendeli.tgbot.types.stars/TransactionPartner.AffiliateProgram.equals|equals(kotlin.Any?){}[0] + final fun hashCode(): kotlin/Int // eu.vendeli.tgbot.types.stars/TransactionPartner.AffiliateProgram.hashCode|hashCode(){}[0] + final fun toString(): kotlin/String // eu.vendeli.tgbot.types.stars/TransactionPartner.AffiliateProgram.toString|toString(){}[0] + + final object $serializer : kotlinx.serialization.internal/GeneratedSerializer { // eu.vendeli.tgbot.types.stars/TransactionPartner.AffiliateProgram.$serializer|null[0] + final val descriptor // eu.vendeli.tgbot.types.stars/TransactionPartner.AffiliateProgram.$serializer.descriptor|{}descriptor[0] + final fun (): kotlinx.serialization.descriptors/SerialDescriptor // eu.vendeli.tgbot.types.stars/TransactionPartner.AffiliateProgram.$serializer.descriptor.|(){}[0] + + final fun childSerializers(): kotlin/Array> // eu.vendeli.tgbot.types.stars/TransactionPartner.AffiliateProgram.$serializer.childSerializers|childSerializers(){}[0] + final fun deserialize(kotlinx.serialization.encoding/Decoder): eu.vendeli.tgbot.types.stars/TransactionPartner.AffiliateProgram // eu.vendeli.tgbot.types.stars/TransactionPartner.AffiliateProgram.$serializer.deserialize|deserialize(kotlinx.serialization.encoding.Decoder){}[0] + final fun serialize(kotlinx.serialization.encoding/Encoder, eu.vendeli.tgbot.types.stars/TransactionPartner.AffiliateProgram) // eu.vendeli.tgbot.types.stars/TransactionPartner.AffiliateProgram.$serializer.serialize|serialize(kotlinx.serialization.encoding.Encoder;eu.vendeli.tgbot.types.stars.TransactionPartner.AffiliateProgram){}[0] + } + + final object Companion { // eu.vendeli.tgbot.types.stars/TransactionPartner.AffiliateProgram.Companion|null[0] + final fun serializer(): kotlinx.serialization/KSerializer // eu.vendeli.tgbot.types.stars/TransactionPartner.AffiliateProgram.Companion.serializer|serializer(){}[0] + } + } + final class Fragment : eu.vendeli.tgbot.types.stars/TransactionPartner { // eu.vendeli.tgbot.types.stars/TransactionPartner.Fragment|null[0] constructor (eu.vendeli.tgbot.types.stars/RevenueWithdrawalState? = ...) // eu.vendeli.tgbot.types.stars/TransactionPartner.Fragment.|(eu.vendeli.tgbot.types.stars.RevenueWithdrawalState?){}[0] @@ -12652,8 +12735,10 @@ sealed class eu.vendeli.tgbot.types.stars/TransactionPartner { // eu.vendeli.tgb } final class UserPartner : eu.vendeli.tgbot.types.stars/TransactionPartner { // eu.vendeli.tgbot.types.stars/TransactionPartner.UserPartner|null[0] - constructor (eu.vendeli.tgbot.types/User, kotlin/String? = ..., kotlin.collections/List? = ..., kotlin/String? = ..., kotlin.time/Duration? = ..., kotlin/String? = ...) // eu.vendeli.tgbot.types.stars/TransactionPartner.UserPartner.|(eu.vendeli.tgbot.types.User;kotlin.String?;kotlin.collections.List?;kotlin.String?;kotlin.time.Duration?;kotlin.String?){}[0] + constructor (eu.vendeli.tgbot.types/User, eu.vendeli.tgbot.types.stars/AffiliateInfo? = ..., kotlin/String? = ..., kotlin.collections/List? = ..., kotlin/String? = ..., kotlin.time/Duration? = ..., kotlin/String? = ...) // eu.vendeli.tgbot.types.stars/TransactionPartner.UserPartner.|(eu.vendeli.tgbot.types.User;eu.vendeli.tgbot.types.stars.AffiliateInfo?;kotlin.String?;kotlin.collections.List?;kotlin.String?;kotlin.time.Duration?;kotlin.String?){}[0] + final val affiliate // eu.vendeli.tgbot.types.stars/TransactionPartner.UserPartner.affiliate|{}affiliate[0] + final fun (): eu.vendeli.tgbot.types.stars/AffiliateInfo? // eu.vendeli.tgbot.types.stars/TransactionPartner.UserPartner.affiliate.|(){}[0] final val gift // eu.vendeli.tgbot.types.stars/TransactionPartner.UserPartner.gift|{}gift[0] final fun (): kotlin/String? // eu.vendeli.tgbot.types.stars/TransactionPartner.UserPartner.gift.|(){}[0] final val invoicePayload // eu.vendeli.tgbot.types.stars/TransactionPartner.UserPartner.invoicePayload|{}invoicePayload[0] @@ -12668,12 +12753,13 @@ sealed class eu.vendeli.tgbot.types.stars/TransactionPartner { // eu.vendeli.tgb final fun (): eu.vendeli.tgbot.types/User // eu.vendeli.tgbot.types.stars/TransactionPartner.UserPartner.user.|(){}[0] final fun component1(): eu.vendeli.tgbot.types/User // eu.vendeli.tgbot.types.stars/TransactionPartner.UserPartner.component1|component1(){}[0] - final fun component2(): kotlin/String? // eu.vendeli.tgbot.types.stars/TransactionPartner.UserPartner.component2|component2(){}[0] - final fun component3(): kotlin.collections/List? // eu.vendeli.tgbot.types.stars/TransactionPartner.UserPartner.component3|component3(){}[0] - final fun component4(): kotlin/String? // eu.vendeli.tgbot.types.stars/TransactionPartner.UserPartner.component4|component4(){}[0] - final fun component5(): kotlin.time/Duration? // eu.vendeli.tgbot.types.stars/TransactionPartner.UserPartner.component5|component5(){}[0] - final fun component6(): kotlin/String? // eu.vendeli.tgbot.types.stars/TransactionPartner.UserPartner.component6|component6(){}[0] - final fun copy(eu.vendeli.tgbot.types/User = ..., kotlin/String? = ..., kotlin.collections/List? = ..., kotlin/String? = ..., kotlin.time/Duration? = ..., kotlin/String? = ...): eu.vendeli.tgbot.types.stars/TransactionPartner.UserPartner // eu.vendeli.tgbot.types.stars/TransactionPartner.UserPartner.copy|copy(eu.vendeli.tgbot.types.User;kotlin.String?;kotlin.collections.List?;kotlin.String?;kotlin.time.Duration?;kotlin.String?){}[0] + final fun component2(): eu.vendeli.tgbot.types.stars/AffiliateInfo? // eu.vendeli.tgbot.types.stars/TransactionPartner.UserPartner.component2|component2(){}[0] + final fun component3(): kotlin/String? // eu.vendeli.tgbot.types.stars/TransactionPartner.UserPartner.component3|component3(){}[0] + final fun component4(): kotlin.collections/List? // eu.vendeli.tgbot.types.stars/TransactionPartner.UserPartner.component4|component4(){}[0] + final fun component5(): kotlin/String? // eu.vendeli.tgbot.types.stars/TransactionPartner.UserPartner.component5|component5(){}[0] + final fun component6(): kotlin.time/Duration? // eu.vendeli.tgbot.types.stars/TransactionPartner.UserPartner.component6|component6(){}[0] + final fun component7(): kotlin/String? // eu.vendeli.tgbot.types.stars/TransactionPartner.UserPartner.component7|component7(){}[0] + final fun copy(eu.vendeli.tgbot.types/User = ..., eu.vendeli.tgbot.types.stars/AffiliateInfo? = ..., kotlin/String? = ..., kotlin.collections/List? = ..., kotlin/String? = ..., kotlin.time/Duration? = ..., kotlin/String? = ...): eu.vendeli.tgbot.types.stars/TransactionPartner.UserPartner // eu.vendeli.tgbot.types.stars/TransactionPartner.UserPartner.copy|copy(eu.vendeli.tgbot.types.User;eu.vendeli.tgbot.types.stars.AffiliateInfo?;kotlin.String?;kotlin.collections.List?;kotlin.String?;kotlin.time.Duration?;kotlin.String?){}[0] final fun equals(kotlin/Any?): kotlin/Boolean // eu.vendeli.tgbot.types.stars/TransactionPartner.UserPartner.equals|equals(kotlin.Any?){}[0] final fun hashCode(): kotlin/Int // eu.vendeli.tgbot.types.stars/TransactionPartner.UserPartner.hashCode|hashCode(){}[0] final fun toString(): kotlin/String // eu.vendeli.tgbot.types.stars/TransactionPartner.UserPartner.toString|toString(){}[0] @@ -13420,6 +13506,10 @@ final fun eu.vendeli.tgbot.utils.builders/inlineKeyboardMarkup(kotlin/Function1< final fun eu.vendeli.tgbot.utils.builders/replyKeyboardMarkup(kotlin/Function1): eu.vendeli.tgbot.types.keyboard/ReplyKeyboardMarkup // eu.vendeli.tgbot.utils.builders/replyKeyboardMarkup|replyKeyboardMarkup(kotlin.Function1){}[0] final inline fun (eu.vendeli.tgbot.types.internal/InputFile).eu.vendeli.tgbot.utils/toImplicitFile(): eu.vendeli.tgbot.types.internal/ImplicitFile.InpFile // eu.vendeli.tgbot.utils/toImplicitFile|toImplicitFile@eu.vendeli.tgbot.types.internal.InputFile(){}[0] final inline fun (eu.vendeli.tgbot.types.internal/ProcessedUpdate).eu.vendeli.tgbot.types.internal/getUser(): eu.vendeli.tgbot.types/User // eu.vendeli.tgbot.types.internal/getUser|getUser@eu.vendeli.tgbot.types.internal.ProcessedUpdate(){}[0] +final inline fun (io.ktor.util.logging/Logger).eu.vendeli.tgbot.utils/debug(kotlin/Function0) // eu.vendeli.tgbot.utils/debug|debug@io.ktor.util.logging.Logger(kotlin.Function0){}[0] +final inline fun (io.ktor.util.logging/Logger).eu.vendeli.tgbot.utils/error(kotlin/Throwable? = ..., kotlin/Function0) // eu.vendeli.tgbot.utils/error|error@io.ktor.util.logging.Logger(kotlin.Throwable?;kotlin.Function0){}[0] +final inline fun (io.ktor.util.logging/Logger).eu.vendeli.tgbot.utils/info(kotlin/Function0) // eu.vendeli.tgbot.utils/info|info@io.ktor.util.logging.Logger(kotlin.Function0){}[0] +final inline fun (io.ktor.util.logging/Logger).eu.vendeli.tgbot.utils/warn(kotlin/Function0) // eu.vendeli.tgbot.utils/warn|warn@io.ktor.util.logging.Logger(kotlin.Function0){}[0] final inline fun (kotlin/String).eu.vendeli.tgbot.utils/toImplicitFile(): eu.vendeli.tgbot.types.internal/ImplicitFile.Str // eu.vendeli.tgbot.utils/toImplicitFile|toImplicitFile@kotlin.String(){}[0] final inline fun <#A: kotlin/Any?> (eu.vendeli.tgbot.types.internal/Response<#A>).eu.vendeli.tgbot.types.internal/onFailure(kotlin/Function1): #A? // eu.vendeli.tgbot.types.internal/onFailure|onFailure@eu.vendeli.tgbot.types.internal.Response<0:0>(kotlin.Function1){0§}[0] final inline fun <#A: reified kotlin/Any> (eu.vendeli.tgbot.interfaces.ctx/ClassManager).eu.vendeli.tgbot.utils/getInstance(kotlin/Array...): #A? // eu.vendeli.tgbot.utils/getInstance|getInstance@eu.vendeli.tgbot.interfaces.ctx.ClassManager(kotlin.Array...){0§}[0] @@ -13450,6 +13540,7 @@ final inline fun eu.vendeli.tgbot.api.botactions/getWebhookInfo(): eu.vendeli.tg final inline fun eu.vendeli.tgbot.api.botactions/logOut(): eu.vendeli.tgbot.api.botactions/LogOutAction // eu.vendeli.tgbot.api.botactions/logOut|logOut(){}[0] final inline fun eu.vendeli.tgbot.api.botactions/refundStarPayment(kotlin/String, kotlin/Long): eu.vendeli.tgbot.api.botactions/RefundStarPaymentAction // eu.vendeli.tgbot.api.botactions/refundStarPayment|refundStarPayment(kotlin.String;kotlin.Long){}[0] final inline fun eu.vendeli.tgbot.api.botactions/savePreparedInlineMessage(kotlin/Long, eu.vendeli.tgbot.types.inline/InlineQueryResult): eu.vendeli.tgbot.api.botactions/SavePreparedInlineMessageAction // eu.vendeli.tgbot.api.botactions/savePreparedInlineMessage|savePreparedInlineMessage(kotlin.Long;eu.vendeli.tgbot.types.inline.InlineQueryResult){}[0] +final inline fun eu.vendeli.tgbot.api.botactions/savePreparedInlineMessage(kotlin/Long, kotlin/Function0): eu.vendeli.tgbot.api.botactions/SavePreparedInlineMessageAction // eu.vendeli.tgbot.api.botactions/savePreparedInlineMessage|savePreparedInlineMessage(kotlin.Long;kotlin.Function0){}[0] final inline fun eu.vendeli.tgbot.api.botactions/sendGift(kotlin/Long, kotlin/String, eu.vendeli.tgbot.types/ParseMode? = ..., noinline kotlin/Function0? = ...): eu.vendeli.tgbot.api.botactions/SendGiftAction // eu.vendeli.tgbot.api.botactions/sendGift|sendGift(kotlin.Long;kotlin.String;eu.vendeli.tgbot.types.ParseMode?;kotlin.Function0?){}[0] final inline fun eu.vendeli.tgbot.api.botactions/setMyCommands(kotlin/String? = ..., eu.vendeli.tgbot.types.bot/BotCommandScope? = ..., kotlin.collections/List): eu.vendeli.tgbot.api.botactions/SetMyCommandsAction // eu.vendeli.tgbot.api.botactions/setMyCommands|setMyCommands(kotlin.String?;eu.vendeli.tgbot.types.bot.BotCommandScope?;kotlin.collections.List){}[0] final inline fun eu.vendeli.tgbot.api.botactions/setMyCommands(kotlin/String? = ..., eu.vendeli.tgbot.types.bot/BotCommandScope? = ..., kotlin/Array...): eu.vendeli.tgbot.api.botactions/SetMyCommandsAction // eu.vendeli.tgbot.api.botactions/setMyCommands|setMyCommands(kotlin.String?;eu.vendeli.tgbot.types.bot.BotCommandScope?;kotlin.Array...){}[0] @@ -13671,10 +13762,6 @@ final inline fun eu.vendeli.tgbot.api/stopMessageLiveLocation(kotlin/Long): eu.v final inline fun eu.vendeli.tgbot.api/stopPoll(kotlin/Long): eu.vendeli.tgbot.api/StopPollAction // eu.vendeli.tgbot.api/stopPoll|stopPoll(kotlin.Long){}[0] final inline fun eu.vendeli.tgbot.api/venue(kotlin/Float, kotlin/Float, kotlin/String, kotlin/String): eu.vendeli.tgbot.api/SendVenueAction // eu.vendeli.tgbot.api/venue|venue(kotlin.Float;kotlin.Float;kotlin.String;kotlin.String){}[0] final suspend fun (eu.vendeli.tgbot.core/TgUpdateHandler).eu.vendeli.tgbot.utils/runExceptionHandler(kotlinx.coroutines/CoroutineDispatcher = ..., kotlin/Long = ..., eu.vendeli.tgbot.interfaces.helper/ExceptionHandler): kotlinx.coroutines/Job // eu.vendeli.tgbot.utils/runExceptionHandler|runExceptionHandler@eu.vendeli.tgbot.core.TgUpdateHandler(kotlinx.coroutines.CoroutineDispatcher;kotlin.Long;eu.vendeli.tgbot.interfaces.helper.ExceptionHandler){}[0] -final suspend inline fun (io.ktor.util.logging/Logger).eu.vendeli.tgbot.utils/debug(kotlin/Function0) // eu.vendeli.tgbot.utils/debug|debug@io.ktor.util.logging.Logger(kotlin.Function0){}[0] -final suspend inline fun (io.ktor.util.logging/Logger).eu.vendeli.tgbot.utils/error(kotlin/Throwable? = ..., kotlin/Function0) // eu.vendeli.tgbot.utils/error|error@io.ktor.util.logging.Logger(kotlin.Throwable?;kotlin.Function0){}[0] -final suspend inline fun (io.ktor.util.logging/Logger).eu.vendeli.tgbot.utils/info(kotlin/Function0) // eu.vendeli.tgbot.utils/info|info@io.ktor.util.logging.Logger(kotlin.Function0){}[0] -final suspend inline fun (io.ktor.util.logging/Logger).eu.vendeli.tgbot.utils/warn(kotlin/Function0) // eu.vendeli.tgbot.utils/warn|warn@io.ktor.util.logging.Logger(kotlin.Function0){}[0] final suspend inline fun <#A: kotlin/Any?, #B: kotlin/Any?> (kotlinx.coroutines/Deferred>).eu.vendeli.tgbot.types.internal/foldResponse(kotlin/Function1, #B>, kotlin/Function1): #B // eu.vendeli.tgbot.types.internal/foldResponse|foldResponse@kotlinx.coroutines.Deferred>(kotlin.Function1,0:1>;kotlin.Function1){0§;1§}[0] final suspend inline fun <#A: kotlin/Any?> (kotlinx.coroutines/Deferred>).eu.vendeli.tgbot.types.internal/getOrNull(): #A? // eu.vendeli.tgbot.types.internal/getOrNull|getOrNull@kotlinx.coroutines.Deferred>(){0§}[0] final suspend inline fun <#A: kotlin/Any?> (kotlinx.coroutines/Deferred>).eu.vendeli.tgbot.types.internal/onFailure(kotlin/Function1): #A? // eu.vendeli.tgbot.types.internal/onFailure|onFailure@kotlinx.coroutines.Deferred>(kotlin.Function1){0§}[0] diff --git a/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/api/botactions/CreateInvoiceLink.kt b/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/api/botactions/CreateInvoiceLink.kt index 25dbfbf764..e93cfc0100 100644 --- a/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/api/botactions/CreateInvoiceLink.kt +++ b/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/api/botactions/CreateInvoiceLink.kt @@ -42,14 +42,14 @@ class CreateInvoiceLinkAction( * Use this method to create a link for an invoice. Returns the created invoice link as String on success. * * [Api reference](https://core.telegram.org/bots/api#createinvoicelink) - * @param businessConnectionId Unique identifier of the business connection on behalf of which the link will be created + * @param businessConnectionId Unique identifier of the business connection on behalf of which the link will be created. For payments in Telegram Stars only. * @param title Product name, 1-32 characters * @param description Product description, 1-255 characters * @param payload Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal processes. * @param providerToken Payment provider token, obtained via @BotFather. Pass an empty string for payments in Telegram Stars. * @param currency Three-letter ISO 4217 currency code, see more on currencies. Pass "XTR" for payments in Telegram Stars. * @param prices Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in Telegram Stars. - * @param subscriptionPeriod The number of seconds the subscription will be active for before the next payment. The currency must be set to "XTR" (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified. + * @param subscriptionPeriod The number of seconds the subscription will be active for before the next payment. The currency must be set to "XTR" (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified. Any number of subscriptions can be active for a given bot at the same time, including multiple concurrent subscriptions from the same user. Subscription price must no exceed 2500 Telegram Stars. * @param maxTipAmount The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in Telegram Stars. * @param suggestedTipAmounts A JSON-serialized array of suggested amounts of tips in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount. * @param providerData JSON-serialized data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider. diff --git a/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/api/botactions/SavePreparedInlineMessage.kt b/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/api/botactions/SavePreparedInlineMessage.kt index c3bfb56293..18b7ca5be2 100644 --- a/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/api/botactions/SavePreparedInlineMessage.kt +++ b/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/api/botactions/SavePreparedInlineMessage.kt @@ -10,6 +10,7 @@ import eu.vendeli.tgbot.types.internal.options.SavePreparedInlineMessageOptions import eu.vendeli.tgbot.types.msg.PreparedInlineMessage import eu.vendeli.tgbot.utils.encodeWith import eu.vendeli.tgbot.utils.getReturnType +import eu.vendeli.tgbot.utils.serde.DynamicLookupSerializer import eu.vendeli.tgbot.utils.toJsonElement @TgAPI @@ -25,7 +26,7 @@ class SavePreparedInlineMessageAction( init { parameters["user_id"] = userId.toJsonElement() - parameters["result"] = result.encodeWith(InlineQueryResult.serializer()) + parameters["result"] = result.encodeWith(DynamicLookupSerializer) } } @@ -47,3 +48,10 @@ inline fun savePreparedInlineMessage( userId: Long, result: InlineQueryResult, ) = SavePreparedInlineMessageAction(userId, result) + +@Suppress("NOTHING_TO_INLINE") +@TgAPI +inline fun savePreparedInlineMessage( + userId: Long, + result: () -> InlineQueryResult, +) = SavePreparedInlineMessageAction(userId, result()) diff --git a/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/core/TgUpdateHandler.kt b/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/core/TgUpdateHandler.kt index 993dcb3f79..283c11f955 100644 --- a/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/core/TgUpdateHandler.kt +++ b/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/core/TgUpdateHandler.kt @@ -164,7 +164,7 @@ class TgUpdateHandler internal constructor( .runCatching { decodeFromString(ProcessedUpdate.serializer(), update) } .onFailure { logger.error(it) { "error during the update parsing process." } - }.onSuccess { logger.info { "Successfully parsed update to $it" } } + }.onSuccess { logger.debug { "Successfully parsed update to $it" } } .getOrNull() } diff --git a/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/interfaces/action/SimpleAction.kt b/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/interfaces/action/SimpleAction.kt index d03c536947..964ebd2887 100644 --- a/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/interfaces/action/SimpleAction.kt +++ b/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/interfaces/action/SimpleAction.kt @@ -29,5 +29,5 @@ abstract class SimpleAction : TgAction() { to: TelegramBot, ): Deferred> = doRequestReturning(to) - suspend fun sendReturning(to: TelegramBot): Deferred> = doRequestReturning(to) + suspend inline fun sendReturning(to: TelegramBot): Deferred> = doRequestReturning(to) } diff --git a/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/types/inline/InlineQueryResult.kt b/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/types/inline/InlineQueryResult.kt index 7d939d8a68..6b1731d0e4 100644 --- a/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/types/inline/InlineQueryResult.kt +++ b/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/types/inline/InlineQueryResult.kt @@ -1,3 +1,16 @@ +@file:UseContextualSerialization( + forClasses = [ + InlineQueryResult.CachedAudio::class, + InlineQueryResult.CachedDocument::class, + InlineQueryResult.CachedGif::class, + InlineQueryResult.CachedMpeg4Gif::class, + InlineQueryResult.CachedPhoto::class, + InlineQueryResult.CachedSticker::class, + InlineQueryResult.CachedVideo::class, + InlineQueryResult.CachedVoice::class, + ], +) + package eu.vendeli.tgbot.types.inline import eu.vendeli.tgbot.types.InputMessageContent @@ -7,6 +20,7 @@ import eu.vendeli.tgbot.types.msg.MessageEntity import kotlinx.serialization.Contextual import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable +import kotlinx.serialization.UseContextualSerialization /** * This object represents one result of an inline query. Telegram clients currently support results of the following 20 types: diff --git a/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/types/internal/ActivitiesData.kt b/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/types/internal/ActivitiesData.kt index a60c2bf6dc..2099a8ebf0 100644 --- a/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/types/internal/ActivitiesData.kt +++ b/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/types/internal/ActivitiesData.kt @@ -32,10 +32,10 @@ internal class ActivitiesData( @Suppress("OPT_IN_USAGE") GlobalScope.launch { logger.info { - "\nCommandHandlers:\n${commandHandlers.logString}\n" + - "InputHandlers:\n${inputHandlers.logString}\n" + - "CommonHandlers:\n${commonHandlers.logString}\n" + - "UpdateTypeHandlers:\n${updateTypeHandlers.logString}\n" + + "\nCommandHandlers:\n${commandHandlers.logString}\n\n" + + "InputHandlers:\n${inputHandlers.logString}\n\n" + + "CommonHandlers:\n${commonHandlers.logString}\n\n" + + "UpdateTypeHandlers:\n${updateTypeHandlers.logString}\n\n" + "UnprocessedHandler:\n${unprocessedHandler ?: "None"}" } } diff --git a/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/types/internal/InvocationMeta.kt b/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/types/internal/InvocationMeta.kt index af256e4fed..9069975565 100644 --- a/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/types/internal/InvocationMeta.kt +++ b/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/types/internal/InvocationMeta.kt @@ -16,7 +16,8 @@ data class InvocationMeta( val argParser: KClass = DefaultArgParser::class, ) { override fun toString(): String = buildString { - append("$qualifier::$function $rateLimits") + append("$qualifier::$function") + if (rateLimits.rate > 0 || rateLimits.period > 0) append(" $rateLimits") if (guard.fqName != DefaultGuard::class.fqName) append(" | \uD83D\uDEE1\uFE0F ${guard.simpleName}") if (argParser.fqName != DefaultArgParser::class.fqName) append(" | \uD83D\uDEE0 ${argParser.simpleName}") } diff --git a/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/types/internal/options/SavePreparedInlineMessageOptions.kt b/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/types/internal/options/SavePreparedInlineMessageOptions.kt index d79a631b55..90b69dfb05 100644 --- a/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/types/internal/options/SavePreparedInlineMessageOptions.kt +++ b/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/types/internal/options/SavePreparedInlineMessageOptions.kt @@ -1,5 +1,8 @@ package eu.vendeli.tgbot.types.internal.options +import kotlinx.serialization.Serializable + +@Serializable data class SavePreparedInlineMessageOptions( var allowUserChats: Boolean? = null, var allowBotChats: Boolean? = null, diff --git a/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/types/stars/AffiliateInfo.kt b/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/types/stars/AffiliateInfo.kt new file mode 100644 index 0000000000..87c422bfc5 --- /dev/null +++ b/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/types/stars/AffiliateInfo.kt @@ -0,0 +1,25 @@ +package eu.vendeli.tgbot.types.stars + +import eu.vendeli.tgbot.types.User +import eu.vendeli.tgbot.types.chat.Chat +import kotlinx.serialization.Serializable + + +/** + * Contains information about the affiliate that received a commission via this transaction. + * + * [Api reference](https://core.telegram.org/bots/api#affiliateinfo) + * @property affiliateUser Optional. The bot or the user that received an affiliate commission if it was received by a bot or a user + * @property affiliateChat Optional. The chat that received an affiliate commission if it was received by a chat + * @property commissionPerMille The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the bot from referred users + * @property amount Integer amount of Telegram Stars received by the affiliate from the transaction, rounded to 0; can be negative for refunds + * @property nanostarAmount Optional. The number of 1/1000000000 shares of Telegram Stars received by the affiliate; from -999999999 to 999999999; can be negative for refunds + */ +@Serializable +data class AffiliateInfo( + val affiliateUser: User? = null, + val affiliateChat: Chat? = null, + val commissionPerMille: Int, + val amount: Int, + val nanostarAmount: Int? = null, +) diff --git a/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/types/stars/StarTransaction.kt b/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/types/stars/StarTransaction.kt index ab4965399f..d5e8af4dfb 100644 --- a/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/types/stars/StarTransaction.kt +++ b/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/types/stars/StarTransaction.kt @@ -9,7 +9,8 @@ import kotlinx.serialization.Serializable * * [Api reference](https://core.telegram.org/bots/api#startransaction) * @property id Unique identifier of the transaction. Coincides with the identifier of the original transaction for refund transactions. Coincides with SuccessfulPayment.telegram_payment_charge_id for successful incoming payments from users. - * @property amount Number of Telegram Stars transferred by the transaction + * @property amount Integer amount of Telegram Stars transferred by the transaction + * @property nanostarAmount Optional. The number of 1/1000000000 shares of Telegram Stars transferred by the transaction; from 0 to 999999999 * @property date Date the transaction was created in Unix time * @property source Optional. Source of an incoming transaction (e.g., a user purchasing goods or services, Fragment refunding a failed withdrawal). Only for incoming transactions * @property receiver Optional. Receiver of an outgoing transaction (e.g., a user for a purchase refund, Fragment for a withdrawal). Only for outgoing transactions @@ -18,6 +19,7 @@ import kotlinx.serialization.Serializable data class StarTransaction( val id: String, val amount: Int, + val nanostarAmount: Int? = null, @Serializable(InstantSerializer::class) val date: Instant, val source: TransactionPartner? = null, diff --git a/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/types/stars/TransactionPartner.kt b/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/types/stars/TransactionPartner.kt index cffbb802ed..49be9d2b3f 100644 --- a/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/types/stars/TransactionPartner.kt +++ b/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/types/stars/TransactionPartner.kt @@ -11,6 +11,7 @@ import kotlin.time.Duration /** * This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of * - TransactionPartnerUser + * - TransactionPartnerAffiliateProgram * - TransactionPartnerFragment * - TransactionPartnerTelegramAds * - TransactionPartnerTelegramApi @@ -34,6 +35,7 @@ sealed class TransactionPartner( @TgAPI.Name("TransactionPartnerUser") data class UserPartner( val user: User, + val affiliate: AffiliateInfo? = null, val invoicePayload: String? = null, val paidMedia: List? = null, val paidMediaPayload: String? = null, @@ -55,4 +57,11 @@ sealed class TransactionPartner( data class TelegramApi( val requestCount: Int, ) : TransactionPartner("telegram_api") + + @Serializable + @SerialName("affiliate_program") + data class AffiliateProgram( + val sponsorUser: User? = null, + val commissionPerMille: Int, + ) : TransactionPartner("affiliate_program") } diff --git a/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/utils/BotRequestExtensions.kt b/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/utils/BotRequestExtensions.kt index 4aba3ddbc8..6a75ed63b8 100644 --- a/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/utils/BotRequestExtensions.kt +++ b/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/utils/BotRequestExtensions.kt @@ -7,7 +7,6 @@ import io.ktor.client.request.HttpRequestBuilder import io.ktor.client.request.forms.MultiPartFormDataContent import io.ktor.client.request.post import io.ktor.client.request.setBody -import io.ktor.client.statement.HttpResponse import io.ktor.client.statement.bodyAsText import io.ktor.client.statement.request import io.ktor.http.ContentType @@ -55,18 +54,6 @@ private fun HttpRequestBuilder.formReqBody( } } -private suspend fun HttpResponse.toResult( - type: KSerializer, - bot: TelegramBot, -) = bodyAsText().let { - if (status.isSuccess()) serde.decodeFromString(Response.Success.serializer(type), it) - else serde.decodeFromString(Response.Failure.serializer(), it).also { f -> - val stringFailure = f.toString() - bot.logger.error { "Request - ${call.request.content} received failure response: $stringFailure" } - if (bot.config.throwExOnActionsFailure) throw TgFailureException(stringFailure) - } -} - internal suspend inline fun TelegramBot.makeRequestReturning( method: String, data: Map, @@ -77,7 +64,16 @@ internal suspend inline fun TelegramBot.makeRequestReturning( formReqBody(data, multipartData) } - return@coroutineScope async { response.toResult(returnType, this@makeRequestReturning) } + return@coroutineScope async { + response.bodyAsText().let { + if (response.status.isSuccess()) serde.decodeFromString(Response.Success.serializer(returnType), it) + else serde.decodeFromString(Response.Failure.serializer(), it).also { f -> + val stringFailure = f.toString() + logger.error { "Request - ${response.call.request.content} received failure response: $stringFailure" } + if (config.throwExOnActionsFailure) throw TgFailureException(stringFailure) + } + } + } } internal suspend inline fun TelegramBot.makeSilentRequest( diff --git a/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/utils/LoggingUtils.kt b/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/utils/LoggingUtils.kt index 68ab4ee735..41eebc05ca 100644 --- a/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/utils/LoggingUtils.kt +++ b/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/utils/LoggingUtils.kt @@ -6,14 +6,14 @@ import io.ktor.util.logging.Logger internal expect inline fun getLogger(lvl: LogLvl, tag: String): Logger @Suppress("NOTHING_TO_INLINE") -suspend inline fun Logger.info(message: () -> String) = info(message()) +inline fun Logger.info(message: () -> String) = info(message()) @Suppress("NOTHING_TO_INLINE") -suspend inline fun Logger.warn(message: () -> String) = warn(message()) +inline fun Logger.warn(message: () -> String) = warn(message()) @Suppress("NOTHING_TO_INLINE") -suspend inline fun Logger.debug(message: () -> String) = debug(message()) +inline fun Logger.debug(message: () -> String) = debug(message()) @Suppress("NOTHING_TO_INLINE") -suspend inline fun Logger.error(throwable: Throwable? = null, message: () -> String) = +inline fun Logger.error(throwable: Throwable? = null, message: () -> String) = throwable?.let { error(message(), it) } ?: error(message()) diff --git a/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/utils/ProcessUpdate.kt b/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/utils/ProcessUpdate.kt index e9204fd000..761e36d0d7 100644 --- a/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/utils/ProcessUpdate.kt +++ b/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/utils/ProcessUpdate.kt @@ -53,5 +53,5 @@ fun Update.processUpdate(): ProcessedUpdate = when { editedBusinessMessage != null -> EditedBusinessMessageUpdate(updateId, this, editedBusinessMessage) deletedBusinessMessages != null -> DeletedBusinessMessagesUpdate(updateId, this, deletedBusinessMessages) purchasedPaidMedia != null -> PurchasedPaidMediaUpdate(updateId, this, purchasedPaidMedia) - else -> throw IllegalArgumentException("Unknown type of update.") + else -> throw TgException("Unknown type of update.") } diff --git a/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/utils/UpdateHandlingExtensions.kt b/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/utils/UpdateHandlingExtensions.kt index 53dd6d212c..a8bfd52419 100644 --- a/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/utils/UpdateHandlingExtensions.kt +++ b/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/utils/UpdateHandlingExtensions.kt @@ -136,11 +136,11 @@ private suspend fun FunctionalHandlingDsl.checkMessageForActivities(update: Proc foundChain.inputActivity.invoke(inputContext) // invoke chain if break condition is false } else { - prevChain?.breakPoint?.activity?.invoke(inputContext) + prevChain.breakPoint?.activity?.invoke(inputContext) // invoke break point activity when it's a break case } - if (isBreakCase && prevChain?.breakPoint?.repeat == true) { + if (isBreakCase && prevChain.breakPoint?.repeat == true) { // and if we need to repeat, do set listener again bot.inputListener.set(user.id, foundChain.id) return true diff --git a/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/utils/serde/SerdeHelpers.kt b/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/utils/serde/SerdeHelpers.kt index 197f097ae0..9eaa1d64e2 100644 --- a/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/utils/serde/SerdeHelpers.kt +++ b/telegram-bot/src/commonMain/kotlin/eu/vendeli/tgbot/utils/serde/SerdeHelpers.kt @@ -3,5 +3,5 @@ package eu.vendeli.tgbot.utils.serde import kotlinx.serialization.json.JsonElement import kotlinx.serialization.json.JsonPrimitive -public val JsonElement.primitiveOrNull: JsonPrimitive? +val JsonElement.primitiveOrNull: JsonPrimitive? get() = this as? JsonPrimitive diff --git a/telegram-bot/src/jvmTest/kotlin/BotTestContext.kt b/telegram-bot/src/jvmTest/kotlin/BotTestContext.kt index 3a982af986..1126bd999d 100644 --- a/telegram-bot/src/jvmTest/kotlin/BotTestContext.kt +++ b/telegram-bot/src/jvmTest/kotlin/BotTestContext.kt @@ -1,4 +1,3 @@ - import eu.vendeli.fixtures.__ACTIVITIES import eu.vendeli.tgbot.TelegramBot import eu.vendeli.tgbot.interfaces.action.Action @@ -20,8 +19,11 @@ import io.kotest.assertions.throwables.shouldNotThrowAny import io.kotest.common.ExperimentalKotest import io.kotest.common.runBlocking import io.kotest.core.spec.style.AnnotationSpec +import io.kotest.matchers.booleans.shouldBeFalse import io.kotest.matchers.booleans.shouldBeTrue +import io.kotest.matchers.nulls.shouldBeNull import io.kotest.matchers.nulls.shouldNotBeNull +import io.kotest.matchers.string.shouldContain import io.ktor.client.request.get import io.ktor.client.statement.readRawBytes import io.ktor.http.isSuccess @@ -143,6 +145,20 @@ abstract class BotTestContext( getOrNull().shouldNotBeNull() } + protected suspend inline fun Deferred>.shouldFailure() = await().shouldFailure() + + @Suppress("NOTHING_TO_INLINE") + protected inline fun Response.shouldFailure(): Response.Failure = with(this) { + ok.shouldBeFalse() + isSuccess().shouldBeFalse() + getOrNull().shouldBeNull() + this as Response.Failure + } + + @Suppress("NOTHING_TO_INLINE") + protected inline infix fun Response.Failure.shouldContainInDescription(text: String) = + description.shouldContain(text) + internal inline fun JsonElement.isSerializableTo(): T = shouldNotThrowAny { serde.decodeFromJsonElement( serializer(T::class.java), diff --git a/telegram-bot/src/jvmTest/kotlin/eu/vendeli/SerdeIssuesTest.kt b/telegram-bot/src/jvmTest/kotlin/eu/vendeli/SerdeIssuesTest.kt index 3839da99bd..1cdeeb3b5d 100644 --- a/telegram-bot/src/jvmTest/kotlin/eu/vendeli/SerdeIssuesTest.kt +++ b/telegram-bot/src/jvmTest/kotlin/eu/vendeli/SerdeIssuesTest.kt @@ -1,12 +1,13 @@ package eu.vendeli import BotTestContext -import eu.vendeli.tgbot.types.msg.MaybeInaccessibleMessage -import eu.vendeli.tgbot.types.msg.Message import eu.vendeli.tgbot.types.chat.Chat import eu.vendeli.tgbot.types.chat.ChatType +import eu.vendeli.tgbot.types.inline.InlineQueryResult import eu.vendeli.tgbot.types.keyboard.ForceReply import eu.vendeli.tgbot.types.media.Voice +import eu.vendeli.tgbot.types.msg.MaybeInaccessibleMessage +import eu.vendeli.tgbot.types.msg.Message import eu.vendeli.tgbot.utils.serde import io.kotest.assertions.throwables.shouldNotThrowAny import io.kotest.matchers.shouldBe @@ -55,4 +56,13 @@ class SerdeIssuesTest : BotTestContext() { serde.decodeFromString(MaybeInaccessibleMessage.serializer(), serializedDateMessage) }.shouldBeTypeOf() } + + @Test + fun `InlineQueryResult serde test`() { + val json = """{"type":"photo","id":"test","photo_url":"testUrl","thumbnail_url":"url"}""" + val result = serde.decodeFromString(InlineQueryResult.serializer(), json) + + result.type shouldBe "photo" + result::class shouldBe InlineQueryResult.Photo::class + } } diff --git a/telegram-bot/src/jvmTest/kotlin/eu/vendeli/api/botactions/CreateInvoiceLinkTest.kt b/telegram-bot/src/jvmTest/kotlin/eu/vendeli/api/botactions/CreateInvoiceLinkTest.kt index d4d408c7f9..b89c03987d 100644 --- a/telegram-bot/src/jvmTest/kotlin/eu/vendeli/api/botactions/CreateInvoiceLinkTest.kt +++ b/telegram-bot/src/jvmTest/kotlin/eu/vendeli/api/botactions/CreateInvoiceLinkTest.kt @@ -22,7 +22,8 @@ class CreateInvoiceLinkTest : BotTestContext() { "test2" }.options { providerToken = PAYMENT_PROVIDER_TOKEN - }.sendReq().shouldSuccess() + }.sendReq() + .shouldSuccess() result.shouldNotBeNull() result shouldContain "https://t.me" diff --git a/telegram-bot/src/jvmTest/kotlin/eu/vendeli/api/botactions/EditUserStarSubscriptionTest.kt b/telegram-bot/src/jvmTest/kotlin/eu/vendeli/api/botactions/EditUserStarSubscriptionTest.kt new file mode 100644 index 0000000000..b5fac182d1 --- /dev/null +++ b/telegram-bot/src/jvmTest/kotlin/eu/vendeli/api/botactions/EditUserStarSubscriptionTest.kt @@ -0,0 +1,13 @@ +package eu.vendeli.api.botactions + +import BotTestContext +import eu.vendeli.tgbot.api.botactions.editUserStarSubscription + +class EditUserStarSubscriptionTest : BotTestContext() { + @Test + suspend fun `edit user star subscription test`() { + editUserStarSubscription(TG_ID, "test", true) + .sendAsync(bot) + .shouldFailure() shouldContainInDescription "CHARGE_ID_INVALID" + } +} diff --git a/telegram-bot/src/jvmTest/kotlin/eu/vendeli/api/botactions/EmojiStatusTest.kt b/telegram-bot/src/jvmTest/kotlin/eu/vendeli/api/botactions/EmojiStatusTest.kt new file mode 100644 index 0000000000..c03d94cf0d --- /dev/null +++ b/telegram-bot/src/jvmTest/kotlin/eu/vendeli/api/botactions/EmojiStatusTest.kt @@ -0,0 +1,13 @@ +package eu.vendeli.api.botactions + +import BotTestContext +import eu.vendeli.tgbot.api.botactions.setUserEmojiStatus + +class EmojiStatusTest : BotTestContext() { + @Test + suspend fun `set emoji status test`() { + setUserEmojiStatus(TG_ID) + .sendAsync(bot) + .shouldFailure() shouldContainInDescription "not enough rights to change the user's emoji status" + } +} diff --git a/telegram-bot/src/jvmTest/kotlin/eu/vendeli/api/botactions/GiftTest.kt b/telegram-bot/src/jvmTest/kotlin/eu/vendeli/api/botactions/GiftTest.kt new file mode 100644 index 0000000000..748e6c385c --- /dev/null +++ b/telegram-bot/src/jvmTest/kotlin/eu/vendeli/api/botactions/GiftTest.kt @@ -0,0 +1,23 @@ +package eu.vendeli.api.botactions + +import BotTestContext +import eu.vendeli.tgbot.api.botactions.getAvailableGifts +import eu.vendeli.tgbot.api.botactions.sendGift +import io.kotest.matchers.collections.shouldHaveAtLeastSize + +class GiftTest : BotTestContext() { + @Test + suspend fun `get available gifts test`() { + val result = getAvailableGifts().sendAsync(bot).shouldSuccess() + + result.gifts shouldHaveAtLeastSize 1 + } + + @Test + suspend fun `send gift test`() { + val available = getAvailableGifts().sendAsync(bot).shouldSuccess() + val result = sendGift(TG_ID, available.gifts.first().id) { + "test" + }.sendAsync(bot).shouldFailure() shouldContainInDescription "BALANCE_TOO_LOW" + } +} diff --git a/telegram-bot/src/jvmTest/kotlin/eu/vendeli/api/botactions/SavePreparedInlineMessageTest.kt b/telegram-bot/src/jvmTest/kotlin/eu/vendeli/api/botactions/SavePreparedInlineMessageTest.kt new file mode 100644 index 0000000000..0601d38fb1 --- /dev/null +++ b/telegram-bot/src/jvmTest/kotlin/eu/vendeli/api/botactions/SavePreparedInlineMessageTest.kt @@ -0,0 +1,35 @@ +package eu.vendeli.api.botactions + +import BotTestContext +import eu.vendeli.tgbot.api.botactions.savePreparedInlineMessage +import eu.vendeli.tgbot.types.inline.InlineQueryResult +import eu.vendeli.utils.LOREM +import io.kotest.matchers.booleans.shouldBeTrue +import kotlinx.datetime.Clock +import kotlinx.datetime.toJavaInstant + +class SavePreparedInlineMessageTest : BotTestContext() { + @Test + suspend fun `save prepared inline message test`() { + val result = savePreparedInlineMessage(TG_ID) { + InlineQueryResult.Audio("test", LOREM.AUDIO.url, "testTitle") + }.options { + allowBotChats = true + }.sendAsync(bot) + .shouldSuccess() + + Clock.System + .now() + .toJavaInstant() + .isBefore(result.expirationDate.toJavaInstant()) + .shouldBeTrue() + } + + @Test + suspend fun `save prepared inline message without allowing options test`() { + val result = savePreparedInlineMessage(TG_ID) { + InlineQueryResult.Audio("test", LOREM.AUDIO.url, "testTitle") + }.sendAsync(bot) + .shouldFailure() shouldContainInDescription "Bad Request: at least one chat type must be allowed" + } +}