diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ab37e1611..6fb1cbea07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # TelegramBotAPI changelog +## 23.1.0 + +**THIS UPDATE CONTAINS ADDING SUPPORT OF [Telegram Bots API 8.2](https://core.telegram.org/bots/api-changelog#january-1-2025)** + ## 23.0.0 * `Version`: diff --git a/README.md b/README.md index da1c8b76dc..70de48c432 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# TelegramBotAPI [![Maven Central](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi/badge.svg)](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi) [![Supported version](https://img.shields.io/badge/Telegram%20Bot%20API-8.1-blue)](https://core.telegram.org/bots/api-changelog#december-4-2024) +# TelegramBotAPI [![Maven Central](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi/badge.svg)](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi) [![Supported version](https://img.shields.io/badge/Telegram%20Bot%20API-8.2-blue)](https://core.telegram.org/bots/api-changelog#january-1-2025) | Docs | [![KDocs](https://img.shields.io/static/v1?label=Dokka&message=KDocs&color=blue&logo=kotlin)](https://tgbotapi.inmo.dev/index.html) [![Mini tutorial](https://img.shields.io/static/v1?label=Mk&message=Docs&color=blue&logo=mkdocs)](https://docs.inmo.dev/tgbotapi/index.html) | |:----------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:| diff --git a/gradle.properties b/gradle.properties index d04c1a76f2..c02033151f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,4 +6,4 @@ kotlin.incremental=true kotlin.incremental.js=true library_group=dev.inmo -library_version=23.0.0 +library_version=23.1.0 diff --git a/tgbotapi.api/api/tgbotapi.api.api b/tgbotapi.api/api/tgbotapi.api.api index 411a87a9ed..6db61f09dc 100644 --- a/tgbotapi.api/api/tgbotapi.api.api +++ b/tgbotapi.api/api/tgbotapi.api.api @@ -1090,14 +1090,22 @@ public final class dev/inmo/tgbotapi/extensions/api/gifts/GetAvailableGiftsKt { } public final class dev/inmo/tgbotapi/extensions/api/gifts/SendGiftKt { - public static final fun sendGift (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/User;Ldev/inmo/tgbotapi/types/gifts/Gift;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static final fun sendGift (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/User;Ldev/inmo/tgbotapi/types/gifts/Gift;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static final fun sendGift-1FWvrZc (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLjava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static final fun sendGift-4iNBclM (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLdev/inmo/tgbotapi/types/gifts/Gift;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static final fun sendGift-GROm3fU (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/User;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static final fun sendGift-WnQQACc (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLjava/lang/String;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static final fun sendGift-xkmhVIQ (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/User;Ljava/lang/String;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static final fun sendGift-ySMgKnk (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLdev/inmo/tgbotapi/types/gifts/Gift;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static final fun sendGift (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/User;Ldev/inmo/tgbotapi/types/gifts/Gift;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static final fun sendGift (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/User;Ldev/inmo/tgbotapi/types/gifts/Gift;Ljava/util/List;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun sendGift$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/User;Ldev/inmo/tgbotapi/types/gifts/Gift;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static synthetic fun sendGift$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/User;Ldev/inmo/tgbotapi/types/gifts/Gift;Ljava/util/List;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static final fun sendGift-0SDnvgk (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/User;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun sendGift-0SDnvgk$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/User;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static final fun sendGift-1FWvrZc (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLjava/lang/String;Ljava/util/List;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun sendGift-1FWvrZc$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLjava/lang/String;Ljava/util/List;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static final fun sendGift-CrS58cM (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLjava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun sendGift-CrS58cM$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLjava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static final fun sendGift-GROm3fU (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/User;Ljava/lang/String;Ljava/util/List;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun sendGift-GROm3fU$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/User;Ljava/lang/String;Ljava/util/List;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static final fun sendGift-VjR9mJc (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLdev/inmo/tgbotapi/types/gifts/Gift;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun sendGift-VjR9mJc$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLdev/inmo/tgbotapi/types/gifts/Gift;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static final fun sendGift-ySMgKnk (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLdev/inmo/tgbotapi/types/gifts/Gift;Ljava/util/List;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun sendGift-ySMgKnk$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLdev/inmo/tgbotapi/types/gifts/Gift;Ljava/util/List;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; } public final class dev/inmo/tgbotapi/extensions/api/inline/SavePreparedInlineMessageKt { @@ -2311,6 +2319,20 @@ public final class dev/inmo/tgbotapi/extensions/api/utils/UpdatesHandlingKt { public static synthetic fun updateHandlerWithMediaGroupsAdaptation$default (Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function2;JILjava/lang/Object;)Lkotlin/jvm/functions/Function2; } +public final class dev/inmo/tgbotapi/extensions/api/verifications/VerifyChatKt { + public static final fun verifyChat (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/ChatIdentifier;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static final fun verifyChat (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun verifyChat$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/ChatIdentifier;Ljava/lang/String;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static synthetic fun verifyChat$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;Ljava/lang/String;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; +} + +public final class dev/inmo/tgbotapi/extensions/api/verifications/VerifyUserKt { + public static final fun verifyUser (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun verifyUser$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;Ljava/lang/String;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static final fun verifyUser-nc95W0g (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLjava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun verifyUser-nc95W0g$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLjava/lang/String;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; +} + public final class dev/inmo/tgbotapi/extensions/api/webhook/DeleteWebhookKt { public static final fun deleteWebhook (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; } diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/gifts/SendGift.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/gifts/SendGift.kt index 5f044bcbe0..b86457fa70 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/gifts/SendGift.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/gifts/SendGift.kt @@ -13,13 +13,15 @@ public suspend fun TelegramBot.sendGift( userId: UserId, giftId: GiftId, text: String, - parseMode: ParseMode? + parseMode: ParseMode?, + upgradableToUnique: Boolean = false ): Boolean = execute( SendGift( - userId, - giftId, - text, - parseMode + userId = userId, + giftId = giftId, + text = text, + parseMode = parseMode, + upgradableToUnique = upgradableToUnique ) ) @@ -27,11 +29,13 @@ public suspend fun TelegramBot.sendGift( userId: UserId, giftId: GiftId, textSources: TextSourcesList, + upgradableToUnique: Boolean = false, ): Boolean = execute( SendGift( - userId, - giftId, - textSources + userId = userId, + giftId = giftId, + textSources = textSources, + upgradableToUnique = upgradableToUnique ) ) @@ -39,44 +43,52 @@ public suspend fun TelegramBot.sendGift( user: User, giftId: GiftId, text: String, - parseMode: ParseMode? + parseMode: ParseMode?, + upgradableToUnique: Boolean = false ): Boolean = sendGift( - user.id, - giftId, - text, - parseMode + userId = user.id, + giftId = giftId, + text = text, + parseMode = parseMode, + upgradableToUnique = upgradableToUnique ) public suspend fun TelegramBot.sendGift( user: User, giftId: GiftId, textSources: TextSourcesList, + upgradableToUnique: Boolean = false, ): Boolean = sendGift( - user.id, - giftId, - textSources + userId = user.id, + giftId = giftId, + textSources = textSources, + upgradableToUnique = upgradableToUnique ) public suspend fun TelegramBot.sendGift( user: UserId, gift: Gift, text: String, - parseMode: ParseMode? + parseMode: ParseMode?, + upgradableToUnique: Boolean = false ): Boolean = sendGift( - user, - gift.id, - text, - parseMode + userId = user, + giftId = gift.id, + text = text, + parseMode = parseMode, + upgradableToUnique = upgradableToUnique ) public suspend fun TelegramBot.sendGift( user: UserId, gift: Gift, textSources: TextSourcesList, + upgradableToUnique: Boolean = false, ): Boolean = sendGift( - user, - gift.id, - textSources + userId = user, + giftId = gift.id, + textSources = textSources, + upgradableToUnique = upgradableToUnique ) @@ -84,20 +96,24 @@ public suspend fun TelegramBot.sendGift( user: User, gift: Gift, text: String, - parseMode: ParseMode? + parseMode: ParseMode?, + upgradableToUnique: Boolean = false ): Boolean = sendGift( - user.id, - gift.id, - text, - parseMode + userId = user.id, + giftId = gift.id, + text = text, + parseMode = parseMode, + upgradableToUnique = upgradableToUnique ) public suspend fun TelegramBot.sendGift( user: User, gift: Gift, textSources: TextSourcesList, + upgradableToUnique: Boolean = false, ): Boolean = sendGift( - user.id, - gift.id, - textSources + userId = user.id, + giftId = gift.id, + textSources = textSources, + upgradableToUnique = upgradableToUnique ) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/verifications/VerifyChat.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/verifications/VerifyChat.kt new file mode 100644 index 0000000000..06074f8d24 --- /dev/null +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/verifications/VerifyChat.kt @@ -0,0 +1,39 @@ +package dev.inmo.tgbotapi.extensions.api.verifications + +import dev.inmo.tgbotapi.bot.TelegramBot +import dev.inmo.tgbotapi.requests.verifications.VerifyChat +import dev.inmo.tgbotapi.types.ChatIdentifier +import dev.inmo.tgbotapi.types.chat.* +import dev.inmo.tgbotapi.types.chatIdField +import dev.inmo.tgbotapi.types.customDescriptionField +import kotlinx.serialization.SerialName + +public suspend fun TelegramBot.verifyChat( + chatId: ChatIdentifier, + description: String? = null +): Boolean = execute( + VerifyChat( + chatId = chatId, + description = description + ) +) + +/** + * This method may call [verifyUser] in case when [chat] is [PrivateChat] + */ +public suspend fun TelegramBot.verifyChat( + chat: Chat, + description: String? = null +): Boolean = when (chat) { + is PrivateChat -> verifyUser( + chat = chat, + description = description + ) + is UnknownExtendedChat, + is UnknownChatType, + is BusinessChat, + is PublicChat -> verifyChat( + chatId = chat.id, + description = description + ) +} diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/verifications/VerifyUser.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/verifications/VerifyUser.kt new file mode 100644 index 0000000000..d3d8d3f24f --- /dev/null +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/verifications/VerifyUser.kt @@ -0,0 +1,26 @@ +package dev.inmo.tgbotapi.extensions.api.verifications + +import dev.inmo.tgbotapi.bot.TelegramBot +import dev.inmo.tgbotapi.requests.verifications.VerifyChat +import dev.inmo.tgbotapi.requests.verifications.VerifyUser +import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.types.chat.Chat +import kotlinx.serialization.SerialName + +public suspend fun TelegramBot.verifyUser( + userId: UserId, + description: String? = null +): Boolean = execute( + VerifyUser( + userId = userId, + description = description + ) +) + +public suspend fun TelegramBot.verifyUser( + chat: Chat, + description: String? = null +): Boolean = verifyUser( + userId = chat.id.toChatId(), + description = description +) diff --git a/tgbotapi.core/api/tgbotapi.core.api b/tgbotapi.core/api/tgbotapi.core.api index 02e46d5cd5..a2503b05aa 100644 --- a/tgbotapi.core/api/tgbotapi.core.api +++ b/tgbotapi.core/api/tgbotapi.core.api @@ -4674,15 +4674,18 @@ public final class dev/inmo/tgbotapi/requests/gifts/GetAvailableGifts : dev/inmo public final class dev/inmo/tgbotapi/requests/gifts/SendGift : dev/inmo/tgbotapi/abstracts/TextedOutput, dev/inmo/tgbotapi/requests/abstracts/SimpleRequest { public static final field Companion Ldev/inmo/tgbotapi/requests/gifts/SendGift$Companion; - public synthetic fun (JLjava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public synthetic fun (JLjava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Lkotlin/jvm/internal/DefaultConstructorMarker;)V - public synthetic fun (JLjava/lang/String;Ljava/util/List;Lkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (JLjava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;ZILkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (JLjava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;ZILkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (JLjava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;ZLkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (JLjava/lang/String;Ljava/util/List;ZILkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (JLjava/lang/String;Ljava/util/List;ZLkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1-tHkBKVM ()J public final fun component2-OyCYJok ()Ljava/lang/String; public final fun component3 ()Ljava/lang/String; public final fun component4 ()Ldev/inmo/tgbotapi/types/message/ParseMode; - public final fun copy-LbrZz8c (JLjava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;)Ldev/inmo/tgbotapi/requests/gifts/SendGift; - public static synthetic fun copy-LbrZz8c$default (Ldev/inmo/tgbotapi/requests/gifts/SendGift;JLjava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/gifts/SendGift; + public final fun component6 ()Z + public final fun copy-ekxNoiw (JLjava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Z)Ldev/inmo/tgbotapi/requests/gifts/SendGift; + public static synthetic fun copy-ekxNoiw$default (Ldev/inmo/tgbotapi/requests/gifts/SendGift;JLjava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;ZILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/gifts/SendGift; public fun equals (Ljava/lang/Object;)Z public fun getEntities ()Ljava/util/List; public final fun getGiftId-OyCYJok ()Ljava/lang/String; @@ -4691,6 +4694,7 @@ public final class dev/inmo/tgbotapi/requests/gifts/SendGift : dev/inmo/tgbotapi public fun getResultDeserializer ()Lkotlinx/serialization/DeserializationStrategy; public fun getText ()Ljava/lang/String; public fun getTextSources ()Ljava/util/List; + public final fun getUpgradableToUnique ()Z public final fun getUserId-tHkBKVM ()J public fun hashCode ()I public fun method ()Ljava/lang/String; @@ -7792,6 +7796,132 @@ public final class dev/inmo/tgbotapi/requests/stickers/abstracts/StickerSetActio public static fun getResultDeserializer (Ldev/inmo/tgbotapi/requests/stickers/abstracts/StickerSetAction;)Lkotlinx/serialization/KSerializer; } +public final class dev/inmo/tgbotapi/requests/verifications/RemoveChatVerification : dev/inmo/tgbotapi/abstracts/types/ChatRequest, dev/inmo/tgbotapi/requests/abstracts/SimpleRequest { + public static final field Companion Ldev/inmo/tgbotapi/requests/verifications/RemoveChatVerification$Companion; + public fun (Ldev/inmo/tgbotapi/types/ChatIdentifier;)V + public final fun component1 ()Ldev/inmo/tgbotapi/types/ChatIdentifier; + public final fun copy (Ldev/inmo/tgbotapi/types/ChatIdentifier;)Ldev/inmo/tgbotapi/requests/verifications/RemoveChatVerification; + public static synthetic fun copy$default (Ldev/inmo/tgbotapi/requests/verifications/RemoveChatVerification;Ldev/inmo/tgbotapi/types/ChatIdentifier;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/verifications/RemoveChatVerification; + public fun equals (Ljava/lang/Object;)Z + public fun getChatId ()Ldev/inmo/tgbotapi/types/ChatIdentifier; + public fun getRequestSerializer ()Lkotlinx/serialization/SerializationStrategy; + public fun getResultDeserializer ()Lkotlinx/serialization/DeserializationStrategy; + public fun hashCode ()I + public fun method ()Ljava/lang/String; + public fun toString ()Ljava/lang/String; +} + +public synthetic class dev/inmo/tgbotapi/requests/verifications/RemoveChatVerification$$serializer : kotlinx/serialization/internal/GeneratedSerializer { + public static final field INSTANCE Ldev/inmo/tgbotapi/requests/verifications/RemoveChatVerification$$serializer; + public final fun childSerializers ()[Lkotlinx/serialization/KSerializer; + public final fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ldev/inmo/tgbotapi/requests/verifications/RemoveChatVerification; + 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;Ldev/inmo/tgbotapi/requests/verifications/RemoveChatVerification;)V + public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V + public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer; +} + +public final class dev/inmo/tgbotapi/requests/verifications/RemoveChatVerification$Companion { + public final fun serializer ()Lkotlinx/serialization/KSerializer; +} + +public final class dev/inmo/tgbotapi/requests/verifications/RemoveUserVerification : dev/inmo/tgbotapi/requests/abstracts/SimpleRequest { + public static final field Companion Ldev/inmo/tgbotapi/requests/verifications/RemoveUserVerification$Companion; + public synthetic fun (JLkotlin/jvm/internal/DefaultConstructorMarker;)V + public final fun component1-tHkBKVM ()J + public final fun copy-HZVsHAI (J)Ldev/inmo/tgbotapi/requests/verifications/RemoveUserVerification; + public static synthetic fun copy-HZVsHAI$default (Ldev/inmo/tgbotapi/requests/verifications/RemoveUserVerification;JILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/verifications/RemoveUserVerification; + public fun equals (Ljava/lang/Object;)Z + public fun getRequestSerializer ()Lkotlinx/serialization/SerializationStrategy; + public fun getResultDeserializer ()Lkotlinx/serialization/DeserializationStrategy; + public final fun getUserId-tHkBKVM ()J + public fun hashCode ()I + public fun method ()Ljava/lang/String; + public fun toString ()Ljava/lang/String; +} + +public synthetic class dev/inmo/tgbotapi/requests/verifications/RemoveUserVerification$$serializer : kotlinx/serialization/internal/GeneratedSerializer { + public static final field INSTANCE Ldev/inmo/tgbotapi/requests/verifications/RemoveUserVerification$$serializer; + public final fun childSerializers ()[Lkotlinx/serialization/KSerializer; + public final fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ldev/inmo/tgbotapi/requests/verifications/RemoveUserVerification; + 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;Ldev/inmo/tgbotapi/requests/verifications/RemoveUserVerification;)V + public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V + public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer; +} + +public final class dev/inmo/tgbotapi/requests/verifications/RemoveUserVerification$Companion { + public final fun serializer ()Lkotlinx/serialization/KSerializer; +} + +public final class dev/inmo/tgbotapi/requests/verifications/VerifyChat : dev/inmo/tgbotapi/abstracts/types/ChatRequest, dev/inmo/tgbotapi/requests/abstracts/SimpleRequest { + public static final field Companion Ldev/inmo/tgbotapi/requests/verifications/VerifyChat$Companion; + public fun (Ldev/inmo/tgbotapi/types/ChatIdentifier;Ljava/lang/String;)V + public synthetic fun (Ldev/inmo/tgbotapi/types/ChatIdentifier;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public final fun component1 ()Ldev/inmo/tgbotapi/types/ChatIdentifier; + public final fun component2 ()Ljava/lang/String; + public final fun copy (Ldev/inmo/tgbotapi/types/ChatIdentifier;Ljava/lang/String;)Ldev/inmo/tgbotapi/requests/verifications/VerifyChat; + public static synthetic fun copy$default (Ldev/inmo/tgbotapi/requests/verifications/VerifyChat;Ldev/inmo/tgbotapi/types/ChatIdentifier;Ljava/lang/String;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/verifications/VerifyChat; + public fun equals (Ljava/lang/Object;)Z + public fun getChatId ()Ldev/inmo/tgbotapi/types/ChatIdentifier; + public final fun getDescription ()Ljava/lang/String; + public fun getRequestSerializer ()Lkotlinx/serialization/SerializationStrategy; + public fun getResultDeserializer ()Lkotlinx/serialization/DeserializationStrategy; + public fun hashCode ()I + public fun method ()Ljava/lang/String; + public fun toString ()Ljava/lang/String; +} + +public synthetic class dev/inmo/tgbotapi/requests/verifications/VerifyChat$$serializer : kotlinx/serialization/internal/GeneratedSerializer { + public static final field INSTANCE Ldev/inmo/tgbotapi/requests/verifications/VerifyChat$$serializer; + public final fun childSerializers ()[Lkotlinx/serialization/KSerializer; + public final fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ldev/inmo/tgbotapi/requests/verifications/VerifyChat; + 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;Ldev/inmo/tgbotapi/requests/verifications/VerifyChat;)V + public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V + public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer; +} + +public final class dev/inmo/tgbotapi/requests/verifications/VerifyChat$Companion { + public final fun serializer ()Lkotlinx/serialization/KSerializer; +} + +public final class dev/inmo/tgbotapi/requests/verifications/VerifyUser : dev/inmo/tgbotapi/requests/abstracts/SimpleRequest { + public static final field Companion Ldev/inmo/tgbotapi/requests/verifications/VerifyUser$Companion; + public synthetic fun (JLjava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (JLjava/lang/String;Lkotlin/jvm/internal/DefaultConstructorMarker;)V + public final fun component1-tHkBKVM ()J + public final fun component2 ()Ljava/lang/String; + public final fun copy-zv9neSE (JLjava/lang/String;)Ldev/inmo/tgbotapi/requests/verifications/VerifyUser; + public static synthetic fun copy-zv9neSE$default (Ldev/inmo/tgbotapi/requests/verifications/VerifyUser;JLjava/lang/String;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/verifications/VerifyUser; + public fun equals (Ljava/lang/Object;)Z + public final fun getDescription ()Ljava/lang/String; + public fun getRequestSerializer ()Lkotlinx/serialization/SerializationStrategy; + public fun getResultDeserializer ()Lkotlinx/serialization/DeserializationStrategy; + public final fun getUserId-tHkBKVM ()J + public fun hashCode ()I + public fun method ()Ljava/lang/String; + public fun toString ()Ljava/lang/String; +} + +public synthetic class dev/inmo/tgbotapi/requests/verifications/VerifyUser$$serializer : kotlinx/serialization/internal/GeneratedSerializer { + public static final field INSTANCE Ldev/inmo/tgbotapi/requests/verifications/VerifyUser$$serializer; + public final fun childSerializers ()[Lkotlinx/serialization/KSerializer; + public final fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ldev/inmo/tgbotapi/requests/verifications/VerifyUser; + 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;Ldev/inmo/tgbotapi/requests/verifications/VerifyUser;)V + public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V + public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer; +} + +public final class dev/inmo/tgbotapi/requests/verifications/VerifyUser$Companion { + public final fun serializer ()Lkotlinx/serialization/KSerializer; +} + public final class dev/inmo/tgbotapi/requests/webhook/DeleteWebhook : dev/inmo/tgbotapi/requests/abstracts/SimpleRequest { public static final field Companion Ldev/inmo/tgbotapi/requests/webhook/DeleteWebhook$Companion; public fun ()V @@ -8923,6 +9053,7 @@ public final class dev/inmo/tgbotapi/types/CommonKt { public static final field creatorField Ljava/lang/String; public static final field credentialsField Ljava/lang/String; public static final field currencyField Ljava/lang/String; + public static final field customDescriptionField Ljava/lang/String; public static final field customEmojiField Ljava/lang/String; public static final field customEmojiIdField Ljava/lang/String; public static final field customEmojiIdsField Ljava/lang/String; @@ -9115,6 +9246,7 @@ public final class dev/inmo/tgbotapi/types/CommonKt { public static final field passportField Ljava/lang/String; public static final field passportRegistrationField Ljava/lang/String; public static final field payField Ljava/lang/String; + public static final field payToUpgradeField Ljava/lang/String; public static final field payloadField Ljava/lang/String; public static final field pendingJoinRequestCountField Ljava/lang/String; public static final field pendingUpdateCountField Ljava/lang/String; @@ -9276,6 +9408,7 @@ public final class dev/inmo/tgbotapi/types/CommonKt { public static final field unspecifiedField Ljava/lang/String; public static final field untilDateField Ljava/lang/String; public static final field updateIdField Ljava/lang/String; + public static final field upgradeStarCountField Ljava/lang/String; public static final field urlField Ljava/lang/String; public static final field useIndependentChatPermissionsField Ljava/lang/String; public static final field userAdministratorRightsField Ljava/lang/String; @@ -9677,8 +9810,10 @@ public final class dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/Inlin public static final field Companion Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultArticle$Companion; public synthetic fun (Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ljava/lang/String;Ljava/lang/Boolean;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public synthetic fun (Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ljava/lang/String;Ljava/lang/Boolean;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;Lkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;Lkotlin/jvm/internal/DefaultConstructorMarker;)V public fun getDescription ()Ljava/lang/String; - public final fun getHideUrl ()Ljava/lang/Boolean; + public final fun getHideUrl ()Z public fun getId-5UnZwr4 ()Ljava/lang/String; public fun getInputMessageContent ()Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent; public fun getReplyMarkup ()Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup; @@ -18345,6 +18480,7 @@ public abstract interface class dev/inmo/tgbotapi/types/gifts/Gift { public abstract fun getStarCount ()I public abstract fun getSticker ()Ldev/inmo/tgbotapi/types/files/Sticker; public abstract fun getTotalCount ()Ljava/lang/Integer; + public abstract fun getUpgradeStarCount ()Ljava/lang/Integer; } public final class dev/inmo/tgbotapi/types/gifts/Gift$Companion : kotlinx/serialization/KSerializer { @@ -18358,20 +18494,23 @@ public final class dev/inmo/tgbotapi/types/gifts/Gift$Companion : kotlinx/serial public final class dev/inmo/tgbotapi/types/gifts/Gift$Limited : dev/inmo/tgbotapi/types/gifts/Gift { public static final field Companion Ldev/inmo/tgbotapi/types/gifts/Gift$Limited$Companion; - public synthetic fun (Ljava/lang/String;Ldev/inmo/tgbotapi/types/files/Sticker;IIILkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ljava/lang/String;Ldev/inmo/tgbotapi/types/files/Sticker;IIILjava/lang/Integer;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ljava/lang/String;Ldev/inmo/tgbotapi/types/files/Sticker;IIILjava/lang/Integer;Lkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1-OyCYJok ()Ljava/lang/String; public final fun component2 ()Ldev/inmo/tgbotapi/types/files/Sticker; public final fun component3 ()I public final fun component4 ()I public final fun component5 ()I - public final fun copy-dAh8QC0 (Ljava/lang/String;Ldev/inmo/tgbotapi/types/files/Sticker;III)Ldev/inmo/tgbotapi/types/gifts/Gift$Limited; - public static synthetic fun copy-dAh8QC0$default (Ldev/inmo/tgbotapi/types/gifts/Gift$Limited;Ljava/lang/String;Ldev/inmo/tgbotapi/types/files/Sticker;IIIILjava/lang/Object;)Ldev/inmo/tgbotapi/types/gifts/Gift$Limited; + public final fun component6 ()Ljava/lang/Integer; + public final fun copy-RpW899k (Ljava/lang/String;Ldev/inmo/tgbotapi/types/files/Sticker;IIILjava/lang/Integer;)Ldev/inmo/tgbotapi/types/gifts/Gift$Limited; + public static synthetic fun copy-RpW899k$default (Ldev/inmo/tgbotapi/types/gifts/Gift$Limited;Ljava/lang/String;Ldev/inmo/tgbotapi/types/files/Sticker;IIILjava/lang/Integer;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/gifts/Gift$Limited; public fun equals (Ljava/lang/Object;)Z public fun getId-OyCYJok ()Ljava/lang/String; public fun getRemainingCount ()Ljava/lang/Integer; public fun getStarCount ()I public fun getSticker ()Ldev/inmo/tgbotapi/types/files/Sticker; public fun getTotalCount ()Ljava/lang/Integer; + public fun getUpgradeStarCount ()Ljava/lang/Integer; public fun hashCode ()I public fun toString ()Ljava/lang/String; } @@ -18393,18 +18532,21 @@ public final class dev/inmo/tgbotapi/types/gifts/Gift$Limited$Companion { public final class dev/inmo/tgbotapi/types/gifts/Gift$Unlimited : dev/inmo/tgbotapi/types/gifts/Gift { public static final field Companion Ldev/inmo/tgbotapi/types/gifts/Gift$Unlimited$Companion; - public synthetic fun (Ljava/lang/String;Ldev/inmo/tgbotapi/types/files/Sticker;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ljava/lang/String;Ldev/inmo/tgbotapi/types/files/Sticker;ILjava/lang/Integer;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ljava/lang/String;Ldev/inmo/tgbotapi/types/files/Sticker;ILjava/lang/Integer;Lkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1-OyCYJok ()Ljava/lang/String; public final fun component2 ()Ldev/inmo/tgbotapi/types/files/Sticker; public final fun component3 ()I - public final fun copy-IqAKj4o (Ljava/lang/String;Ldev/inmo/tgbotapi/types/files/Sticker;I)Ldev/inmo/tgbotapi/types/gifts/Gift$Unlimited; - public static synthetic fun copy-IqAKj4o$default (Ldev/inmo/tgbotapi/types/gifts/Gift$Unlimited;Ljava/lang/String;Ldev/inmo/tgbotapi/types/files/Sticker;IILjava/lang/Object;)Ldev/inmo/tgbotapi/types/gifts/Gift$Unlimited; + public final fun component4 ()Ljava/lang/Integer; + public final fun copy-Pd50qfQ (Ljava/lang/String;Ldev/inmo/tgbotapi/types/files/Sticker;ILjava/lang/Integer;)Ldev/inmo/tgbotapi/types/gifts/Gift$Unlimited; + public static synthetic fun copy-Pd50qfQ$default (Ldev/inmo/tgbotapi/types/gifts/Gift$Unlimited;Ljava/lang/String;Ldev/inmo/tgbotapi/types/files/Sticker;ILjava/lang/Integer;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/gifts/Gift$Unlimited; public fun equals (Ljava/lang/Object;)Z public fun getId-OyCYJok ()Ljava/lang/String; public fun getRemainingCount ()Ljava/lang/Integer; public fun getStarCount ()I public fun getSticker ()Ldev/inmo/tgbotapi/types/files/Sticker; public fun getTotalCount ()Ljava/lang/Integer; + public fun getUpgradeStarCount ()Ljava/lang/Integer; public fun hashCode ()I public fun toString ()Ljava/lang/String; } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/gifts/SendGift.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/gifts/SendGift.kt index b411fd8c0c..82801bc110 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/gifts/SendGift.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/gifts/SendGift.kt @@ -28,6 +28,8 @@ data class SendGift internal constructor( override val parseMode: ParseMode?, @SerialName(textEntitiesField) private val rawEntities: List? = null, + @SerialName(payToUpgradeField) + val upgradableToUnique: Boolean = false ) : SimpleRequest, TextedOutput { override val textSources: TextSourcesList? by lazy { rawEntities ?.asTextSources(text) @@ -46,12 +48,28 @@ data class SendGift internal constructor( userId: UserId, giftId: GiftId, text: String, - parseMode: ParseMode? - ) : this(userId, giftId, text, parseMode, null) + parseMode: ParseMode?, + upgradableToUnique: Boolean = false + ) : this( + userId = userId, + giftId = giftId, + text = text, + parseMode = parseMode, + rawEntities = null, + upgradableToUnique = upgradableToUnique + ) constructor( userId: UserId, giftId: GiftId, textSources: TextSourcesList, - ) : this(userId, giftId, textSources.makeSourceString(), null, textSources.toRawMessageEntities()) + upgradableToUnique: Boolean = false, + ) : this( + userId = userId, + giftId = giftId, + text = textSources.makeSourceString(), + parseMode = null, + rawEntities = textSources.toRawMessageEntities(), + upgradableToUnique = upgradableToUnique + ) } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/verifications/RemoveChatVerification.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/verifications/RemoveChatVerification.kt new file mode 100644 index 0000000000..f88994a53f --- /dev/null +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/verifications/RemoveChatVerification.kt @@ -0,0 +1,23 @@ +package dev.inmo.tgbotapi.requests.verifications + +import dev.inmo.tgbotapi.abstracts.types.ChatRequest +import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest +import dev.inmo.tgbotapi.types.* +import kotlinx.serialization.DeserializationStrategy +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerializationStrategy +import kotlinx.serialization.builtins.serializer + + +@Serializable +data class RemoveChatVerification( + @SerialName(chatIdField) + override val chatId: ChatIdentifier, +): ChatRequest, SimpleRequest { + override fun method(): String = "removeChatVerification" + override val resultDeserializer: DeserializationStrategy + get() = Boolean.serializer() + override val requestSerializer: SerializationStrategy<*> + get() = serializer() +} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/verifications/RemoveUserVerification.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/verifications/RemoveUserVerification.kt new file mode 100644 index 0000000000..594364eabe --- /dev/null +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/verifications/RemoveUserVerification.kt @@ -0,0 +1,23 @@ +package dev.inmo.tgbotapi.requests.verifications + +import dev.inmo.tgbotapi.abstracts.types.ChatRequest +import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest +import dev.inmo.tgbotapi.types.* +import kotlinx.serialization.DeserializationStrategy +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerializationStrategy +import kotlinx.serialization.builtins.serializer + + +@Serializable +data class RemoveUserVerification( + @SerialName(userIdField) + val userId: UserId, +): SimpleRequest { + override fun method(): String = "removeUserVerification" + override val resultDeserializer: DeserializationStrategy + get() = Boolean.serializer() + override val requestSerializer: SerializationStrategy<*> + get() = serializer() +} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/verifications/VerifyChat.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/verifications/VerifyChat.kt new file mode 100644 index 0000000000..bd0f661d8e --- /dev/null +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/verifications/VerifyChat.kt @@ -0,0 +1,28 @@ +package dev.inmo.tgbotapi.requests.verifications + +import dev.inmo.tgbotapi.abstracts.types.ChatRequest +import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest +import dev.inmo.tgbotapi.types.ChatIdentifier +import dev.inmo.tgbotapi.types.chatIdField +import dev.inmo.tgbotapi.types.customDescriptionField +import dev.inmo.tgbotapi.types.descriptionField +import kotlinx.serialization.DeserializationStrategy +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerializationStrategy +import kotlinx.serialization.builtins.serializer + + +@Serializable +data class VerifyChat( + @SerialName(chatIdField) + override val chatId: ChatIdentifier, + @SerialName(customDescriptionField) + val description: String? = null +): ChatRequest, SimpleRequest { + override fun method(): String = "verifyChat" + override val resultDeserializer: DeserializationStrategy + get() = Boolean.serializer() + override val requestSerializer: SerializationStrategy<*> + get() = serializer() +} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/verifications/VerifyUser.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/verifications/VerifyUser.kt new file mode 100644 index 0000000000..235d38f969 --- /dev/null +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/verifications/VerifyUser.kt @@ -0,0 +1,25 @@ +package dev.inmo.tgbotapi.requests.verifications + +import dev.inmo.tgbotapi.abstracts.types.ChatRequest +import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest +import dev.inmo.tgbotapi.types.* +import kotlinx.serialization.DeserializationStrategy +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerializationStrategy +import kotlinx.serialization.builtins.serializer + + +@Serializable +data class VerifyUser( + @SerialName(userIdField) + val userId: UserId, + @SerialName(customDescriptionField) + val description: String? = null +): SimpleRequest { + override fun method(): String = "verifyUser" + override val resultDeserializer: DeserializationStrategy + get() = Boolean.serializer() + override val requestSerializer: SerializationStrategy<*> + get() = serializer() +} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt index 61a402d508..381b049e1c 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt @@ -427,6 +427,7 @@ const val emojiField = "emoji" const val emojisField = "emojis" const val titleField = "title" const val descriptionField = "description" +const val customDescriptionField = "custom_description" const val shortDescriptionField = "short_description" const val performerField = "performer" const val durationField = "duration" @@ -654,6 +655,8 @@ const val giveawayMessageField = "giveaway_message" const val wasRefundedField = "was_refunded" const val isManualField = "is_manual" const val starCountField = "star_count" +const val upgradeStarCountField = "upgrade_star_count" +const val payToUpgradeField = "pay_for_upgrade" const val paidMediaField = "paid_media" const val businessConnectionIdField = "business_connection_id" diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultArticle.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultArticle.kt index bb632e356b..9c7ecdc90c 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultArticle.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultArticle.kt @@ -19,8 +19,6 @@ class InlineQueryResultArticle( override val replyMarkup: InlineKeyboardMarkup? = null, @SerialName(urlField) override val url: String? = null, - @SerialName(hideUrlField) - val hideUrl: Boolean? = null, @SerialName(descriptionField) override val description: String? = null, @SerialName(thumbnailUrlField) @@ -36,4 +34,31 @@ class InlineQueryResultArticle( WithInputMessageContentInlineQueryResult, UrlInlineQueryResult { override val type: String = "article" + @Deprecated("Field hide_url has been deprecated in Bot API 8.2. Use empty url instead") + val hideUrl: Boolean + get() = url != null && url.isEmpty() + + @Deprecated("Field hide_url has been deprecated in Bot API 8.2. Use empty url instead") + constructor( + id: InlineQueryId, + title: String, + inputMessageContent: InputMessageContent, + replyMarkup: InlineKeyboardMarkup? = null, + url: String? = null, + hideUrl: Boolean?, + description: String? = null, + thumbnailUrl: String? = null, + thumbnailWidth: Int? = null, + thumbnailHeight: Int? = null + ) : this( + id = id, + title = title, + inputMessageContent = inputMessageContent, + replyMarkup = replyMarkup, + url = url, + description = description, + thumbnailUrl = thumbnailUrl, + thumbnailWidth = thumbnailWidth, + thumbnailHeight = thumbnailHeight + ) } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/gifts/Gift.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/gifts/Gift.kt index a8398160ab..cdf71fd8e5 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/gifts/Gift.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/gifts/Gift.kt @@ -15,6 +15,7 @@ sealed interface Gift { val sticker: Sticker val starCount: Int val totalCount: Int? + val upgradeStarCount: Int? val remainingCount: Int? @Serializable @@ -24,7 +25,9 @@ sealed interface Gift { @SerialName(stickerField) override val sticker: Sticker, @SerialName(starCountField) - override val starCount: Int + override val starCount: Int, + @SerialName(upgradeStarCountField) + override val upgradeStarCount: Int? = null ) : Gift { override val totalCount: Int? get() = null @@ -44,6 +47,8 @@ sealed interface Gift { override val totalCount: Int, @SerialName(remainingCountField) override val remainingCount: Int, + @SerialName(upgradeStarCountField) + override val upgradeStarCount: Int? = null, ) : Gift companion object : KSerializer { @@ -54,6 +59,7 @@ sealed interface Gift { val star_count: Int, val total_count: Int? = null, val remaining_count: Int? = null, + val upgrade_star_count: Int? = null, ) override val descriptor: SerialDescriptor @@ -64,29 +70,33 @@ sealed interface Gift { return if (surrogate.total_count != null && surrogate.remaining_count != null) { Limited( - surrogate.id, - surrogate.sticker, - surrogate.star_count, - surrogate.total_count, - surrogate.remaining_count + id = surrogate.id, + sticker = surrogate.sticker, + starCount = surrogate.star_count, + totalCount = surrogate.total_count, + remainingCount = surrogate.remaining_count, + upgradeStarCount = surrogate.upgrade_star_count, ) } else { Unlimited( - surrogate.id, - surrogate.sticker, - surrogate.star_count, + id = surrogate.id, + sticker = surrogate.sticker, + starCount = surrogate.star_count, + upgradeStarCount = surrogate.upgrade_star_count, ) } } override fun serialize(encoder: Encoder, value: Gift) { val surrogate = GiftSurrogate( - value.id, - value.sticker, - value.starCount, - value.totalCount, - value.remainingCount + id = value.id, + sticker = value.sticker, + star_count = value.starCount, + total_count = value.totalCount, + remaining_count = value.remainingCount, + upgrade_star_count = value.upgradeStarCount ) + GiftSurrogate.serializer().serialize(encoder, surrogate) } } }