diff --git a/CHANGELOG.md b/CHANGELOG.md index d0fa59bff3..49dbe847d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # TelegramBotAPI changelog +## 15.3.0 + +**THIS UPDATE CONTAINS ADDING OF SUPPORT FOR BOTS API 7.8** + +* `Core`: + * `OptionallyBusinessConnectionRequest` now extends `WithOptionalBusinessConnectionId` + * Add `hasMainWebApp` in `ExtendedBot` +* `API`: + * Add `BusinessConnectionId` to pin/unpin methods +* `WebApp`: + * Add `shareToStory` in `WebApp` + + + ## 15.2.0 * `API`: diff --git a/README.md b/README.md index 5ee58069da..5ee6e4837c 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-7.7-blue)](https://core.telegram.org/bots/api-changelog#july-7-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-7.8-blue)](https://core.telegram.org/bots/api-changelog#july-31-2024) | 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 01c72d41e8..4b0cc5d055 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,4 +6,4 @@ kotlin.incremental=true kotlin.incremental.js=true library_group=dev.inmo -library_version=15.2.0 +library_version=15.3.0 diff --git a/tgbotapi.api/api/tgbotapi.api.api b/tgbotapi.api/api/tgbotapi.api.api index 5d4dedc9f0..659607348e 100644 --- a/tgbotapi.api/api/tgbotapi.api.api +++ b/tgbotapi.api/api/tgbotapi.api.api @@ -667,12 +667,12 @@ public final class dev/inmo/tgbotapi/extensions/api/chat/modify/DeleteChatPhotoK } public final class dev/inmo/tgbotapi/extensions/api/chat/modify/PinChatMessageKt { - public static final fun pinChatMessage (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/message/abstracts/AccessibleMessage;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static synthetic fun pinChatMessage$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/message/abstracts/AccessibleMessage;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; - public static final fun pinChatMessage-SAUdIcY (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/ChatIdentifier;JZLkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static final fun pinChatMessage-SAUdIcY (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;JZLkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static synthetic fun pinChatMessage-SAUdIcY$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/ChatIdentifier;JZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; - public static synthetic fun pinChatMessage-SAUdIcY$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;JZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static final fun pinChatMessage-iJMbh4A (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/message/abstracts/AccessibleMessage;Ljava/lang/String;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun pinChatMessage-iJMbh4A$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/message/abstracts/AccessibleMessage;Ljava/lang/String;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static final fun pinChatMessage-rd3ngj0 (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/ChatIdentifier;JLjava/lang/String;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static final fun pinChatMessage-rd3ngj0 (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;JLjava/lang/String;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun pinChatMessage-rd3ngj0$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/ChatIdentifier;JLjava/lang/String;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static synthetic fun pinChatMessage-rd3ngj0$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;JLjava/lang/String;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; } public final class dev/inmo/tgbotapi/extensions/api/chat/modify/SetChatDescriptionKt { @@ -712,11 +712,12 @@ public final class dev/inmo/tgbotapi/extensions/api/chat/modify/UnpinAllChatMess } public final class dev/inmo/tgbotapi/extensions/api/chat/modify/UnpinChatMessageKt { - public static final fun unpinChatMessage (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/message/abstracts/AccessibleMessage;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static final fun unpinChatMessage-MzaUNdY (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/types/MessageId;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static final fun unpinChatMessage-MzaUNdY (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;Ldev/inmo/tgbotapi/types/MessageId;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static synthetic fun unpinChatMessage-MzaUNdY$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/types/MessageId;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; - public static synthetic fun unpinChatMessage-MzaUNdY$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;Ldev/inmo/tgbotapi/types/MessageId;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static final fun unpinChatMessage-DZdi6a4 (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/types/MessageId;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static final fun unpinChatMessage-DZdi6a4 (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;Ldev/inmo/tgbotapi/types/MessageId;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun unpinChatMessage-DZdi6a4$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/types/MessageId;Ljava/lang/String;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static synthetic fun unpinChatMessage-DZdi6a4$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;Ldev/inmo/tgbotapi/types/MessageId;Ljava/lang/String;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static final fun unpinChatMessage-efQd2eE (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/message/abstracts/AccessibleMessage;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun unpinChatMessage-efQd2eE$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/message/abstracts/AccessibleMessage;Ljava/lang/String;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; } public final class dev/inmo/tgbotapi/extensions/api/chat/stickers/DeleteChatStickerSetKt { diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/chat/modify/PinChatMessage.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/chat/modify/PinChatMessage.kt index b08f55f5a7..d22aa7458e 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/chat/modify/PinChatMessage.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/chat/modify/PinChatMessage.kt @@ -4,22 +4,27 @@ import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.requests.chat.modify.PinChatMessage import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.MessageId +import dev.inmo.tgbotapi.types.businessConnectionId +import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage public suspend fun TelegramBot.pinChatMessage( chatId: ChatIdentifier, messageId: MessageId, + businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, disableNotification: Boolean = false -): Boolean = execute(PinChatMessage(chatId, messageId, disableNotification)) +): Boolean = execute(PinChatMessage(chatId, messageId, businessConnectionId, disableNotification)) public suspend fun TelegramBot.pinChatMessage( chat: Chat, messageId: MessageId, + businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, disableNotification: Boolean = false -): Boolean = pinChatMessage(chat.id, messageId, disableNotification) +): Boolean = pinChatMessage(chat.id, messageId, businessConnectionId, disableNotification) public suspend fun TelegramBot.pinChatMessage( message: AccessibleMessage, + businessConnectionId: BusinessConnectionId? = message.chat.id.businessConnectionId, disableNotification: Boolean = false -): Boolean = pinChatMessage(message.chat.id, message.messageId, disableNotification) +): Boolean = pinChatMessage(message.chat.id, message.messageId, businessConnectionId, disableNotification) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/chat/modify/UnpinChatMessage.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/chat/modify/UnpinChatMessage.kt index 35da0909cd..4c599faf3c 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/chat/modify/UnpinChatMessage.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/chat/modify/UnpinChatMessage.kt @@ -4,19 +4,24 @@ import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.requests.chat.modify.UnpinChatMessage import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.MessageId +import dev.inmo.tgbotapi.types.businessConnectionId +import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage public suspend fun TelegramBot.unpinChatMessage( chatId: ChatIdentifier, - messageId: MessageId? = null -): Boolean = execute(UnpinChatMessage(chatId, messageId)) + messageId: MessageId? = null, + businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId +): Boolean = execute(UnpinChatMessage(chatId, messageId, businessConnectionId)) public suspend fun TelegramBot.unpinChatMessage( chat: Chat, - messageId: MessageId? = null -): Boolean = unpinChatMessage(chat.id, messageId) + messageId: MessageId? = null, + businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId +): Boolean = unpinChatMessage(chat.id, messageId, businessConnectionId) public suspend fun TelegramBot.unpinChatMessage( - message: AccessibleMessage -): Boolean = unpinChatMessage(message.chat.id, message.messageId) + message: AccessibleMessage, + businessConnectionId: BusinessConnectionId? = message.chat.id.businessConnectionId, +): Boolean = unpinChatMessage(message.chat.id, message.messageId, businessConnectionId) diff --git a/tgbotapi.core/api/tgbotapi.core.api b/tgbotapi.core/api/tgbotapi.core.api index 32a63f508b..de071ed17f 100644 --- a/tgbotapi.core/api/tgbotapi.core.api +++ b/tgbotapi.core/api/tgbotapi.core.api @@ -168,8 +168,7 @@ public abstract interface class dev/inmo/tgbotapi/abstracts/types/OptionalChatRe public abstract fun getChatId ()Ldev/inmo/tgbotapi/types/ChatIdentifier; } -public abstract interface class dev/inmo/tgbotapi/abstracts/types/OptionallyBusinessConnectionRequest { - public abstract fun getBusinessConnectionId-nXr5wdE ()Ljava/lang/String; +public abstract interface class dev/inmo/tgbotapi/abstracts/types/OptionallyBusinessConnectionRequest : dev/inmo/tgbotapi/abstracts/types/WithOptionalBusinessConnectionId { } public abstract interface class dev/inmo/tgbotapi/abstracts/types/OptionallyWithEffectId { @@ -3076,16 +3075,18 @@ public final class dev/inmo/tgbotapi/requests/chat/modify/DeleteChatPhoto$Compan public final fun serializer ()Lkotlinx/serialization/KSerializer; } -public final class dev/inmo/tgbotapi/requests/chat/modify/PinChatMessage : dev/inmo/tgbotapi/abstracts/types/ChatRequest, dev/inmo/tgbotapi/abstracts/types/DisableNotification, dev/inmo/tgbotapi/abstracts/types/MessageAction, dev/inmo/tgbotapi/requests/abstracts/SimpleRequest { +public final class dev/inmo/tgbotapi/requests/chat/modify/PinChatMessage : dev/inmo/tgbotapi/abstracts/types/ChatRequest, dev/inmo/tgbotapi/abstracts/types/DisableNotification, dev/inmo/tgbotapi/abstracts/types/MessageAction, dev/inmo/tgbotapi/abstracts/types/OptionallyBusinessConnectionRequest, dev/inmo/tgbotapi/requests/abstracts/SimpleRequest { public static final field Companion Ldev/inmo/tgbotapi/requests/chat/modify/PinChatMessage$Companion; - public synthetic fun (Ldev/inmo/tgbotapi/types/ChatIdentifier;JZILkotlin/jvm/internal/DefaultConstructorMarker;)V - public synthetic fun (Ldev/inmo/tgbotapi/types/ChatIdentifier;JZLkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ldev/inmo/tgbotapi/types/ChatIdentifier;JLjava/lang/String;ZILkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ldev/inmo/tgbotapi/types/ChatIdentifier;JLjava/lang/String;ZLkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()Ldev/inmo/tgbotapi/types/ChatIdentifier; public final fun component2-APLFQys ()J - public final fun component3 ()Z - public final fun copy-HkzWJnM (Ldev/inmo/tgbotapi/types/ChatIdentifier;JZ)Ldev/inmo/tgbotapi/requests/chat/modify/PinChatMessage; - public static synthetic fun copy-HkzWJnM$default (Ldev/inmo/tgbotapi/requests/chat/modify/PinChatMessage;Ldev/inmo/tgbotapi/types/ChatIdentifier;JZILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/chat/modify/PinChatMessage; + public final fun component3-nXr5wdE ()Ljava/lang/String; + public final fun component4 ()Z + public final fun copy-HtX6zsU (Ldev/inmo/tgbotapi/types/ChatIdentifier;JLjava/lang/String;Z)Ldev/inmo/tgbotapi/requests/chat/modify/PinChatMessage; + public static synthetic fun copy-HtX6zsU$default (Ldev/inmo/tgbotapi/requests/chat/modify/PinChatMessage;Ldev/inmo/tgbotapi/types/ChatIdentifier;JLjava/lang/String;ZILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/chat/modify/PinChatMessage; public fun equals (Ljava/lang/Object;)Z + public fun getBusinessConnectionId-nXr5wdE ()Ljava/lang/String; public fun getChatId ()Ldev/inmo/tgbotapi/types/ChatIdentifier; public fun getDisableNotification ()Z public fun getMessageId-APLFQys ()J @@ -3337,15 +3338,17 @@ public final class dev/inmo/tgbotapi/requests/chat/modify/UnpinAllChatMessages$C public final fun serializer ()Lkotlinx/serialization/KSerializer; } -public final class dev/inmo/tgbotapi/requests/chat/modify/UnpinChatMessage : dev/inmo/tgbotapi/abstracts/types/ChatRequest, dev/inmo/tgbotapi/requests/abstracts/SimpleRequest { +public final class dev/inmo/tgbotapi/requests/chat/modify/UnpinChatMessage : dev/inmo/tgbotapi/abstracts/types/ChatRequest, dev/inmo/tgbotapi/abstracts/types/OptionallyBusinessConnectionRequest, dev/inmo/tgbotapi/requests/abstracts/SimpleRequest { public static final field Companion Ldev/inmo/tgbotapi/requests/chat/modify/UnpinChatMessage$Companion; - public synthetic fun (Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/types/MessageId;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public synthetic fun (Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/types/MessageId;Lkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/types/MessageId;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/types/MessageId;Ljava/lang/String;Lkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()Ldev/inmo/tgbotapi/types/ChatIdentifier; public final fun component2-CigXjpw ()Ldev/inmo/tgbotapi/types/MessageId; - public final fun copy-rTT8EQM (Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/types/MessageId;)Ldev/inmo/tgbotapi/requests/chat/modify/UnpinChatMessage; - public static synthetic fun copy-rTT8EQM$default (Ldev/inmo/tgbotapi/requests/chat/modify/UnpinChatMessage;Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/types/MessageId;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/chat/modify/UnpinChatMessage; + public final fun component3-nXr5wdE ()Ljava/lang/String; + public final fun copy-PPbMvFs (Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/types/MessageId;Ljava/lang/String;)Ldev/inmo/tgbotapi/requests/chat/modify/UnpinChatMessage; + public static synthetic fun copy-PPbMvFs$default (Ldev/inmo/tgbotapi/requests/chat/modify/UnpinChatMessage;Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/types/MessageId;Ljava/lang/String;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/chat/modify/UnpinChatMessage; public fun equals (Ljava/lang/Object;)Z + public fun getBusinessConnectionId-nXr5wdE ()Ljava/lang/String; public fun getChatId ()Ldev/inmo/tgbotapi/types/ChatIdentifier; public final fun getMessageId-CigXjpw ()Ldev/inmo/tgbotapi/types/MessageId; public fun getRequestSerializer ()Lkotlinx/serialization/SerializationStrategy; @@ -8553,6 +8556,7 @@ public final class dev/inmo/tgbotapi/types/CommonKt { public static final field hasAggressiveAntiSpamEnabledField Ljava/lang/String; public static final field hasCustomCertificateField Ljava/lang/String; public static final field hasHiddenMembersField Ljava/lang/String; + public static final field hasMainWebAppField Ljava/lang/String; public static final field hasPrivateForwardsField Ljava/lang/String; public static final field hasPublicWinnersField Ljava/lang/String; public static final field hasRestrictedVoiceAndVideoMessagesField Ljava/lang/String; @@ -14515,14 +14519,15 @@ public final class dev/inmo/tgbotapi/types/chat/CommonUser$Companion { public final class dev/inmo/tgbotapi/types/chat/ExtendedBot : dev/inmo/tgbotapi/types/chat/Bot, dev/inmo/tgbotapi/types/chat/ExtendedChat { public static final field Companion Ldev/inmo/tgbotapi/types/chat/ExtendedBot$Companion; - public synthetic fun (JLjava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZZZLdev/inmo/tgbotapi/types/ChatPhoto;ILdev/inmo/tgbotapi/types/colors/ColorId;Ljava/lang/String;Ljava/lang/String;IILkotlin/jvm/internal/DefaultConstructorMarker;)V - public synthetic fun (JLjava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZZZLdev/inmo/tgbotapi/types/ChatPhoto;ILdev/inmo/tgbotapi/types/colors/ColorId;Ljava/lang/String;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (JLjava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZZZLdev/inmo/tgbotapi/types/ChatPhoto;ILdev/inmo/tgbotapi/types/colors/ColorId;Ljava/lang/String;Ljava/lang/String;IZILkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (JLjava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZZZLdev/inmo/tgbotapi/types/ChatPhoto;ILdev/inmo/tgbotapi/types/colors/ColorId;Ljava/lang/String;Ljava/lang/String;IZLkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1-tHkBKVM ()J public final fun component10-f3WtEc0 ()I public final fun component11-mg_h9nU ()Ldev/inmo/tgbotapi/types/colors/ColorId; public final fun component12-GbmMWyQ ()Ljava/lang/String; public final fun component13-GbmMWyQ ()Ljava/lang/String; public final fun component14 ()I + public final fun component15 ()Z public final fun component2 ()Ljava/lang/String; public final fun component3 ()Ljava/lang/String; public final fun component4-san03mo ()Ljava/lang/String; @@ -14531,8 +14536,8 @@ public final class dev/inmo/tgbotapi/types/chat/ExtendedBot : dev/inmo/tgbotapi/ public final fun component7 ()Z public final fun component8 ()Z public final fun component9 ()Ldev/inmo/tgbotapi/types/ChatPhoto; - public final fun copy-gWg6A_4 (JLjava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZZZLdev/inmo/tgbotapi/types/ChatPhoto;ILdev/inmo/tgbotapi/types/colors/ColorId;Ljava/lang/String;Ljava/lang/String;I)Ldev/inmo/tgbotapi/types/chat/ExtendedBot; - public static synthetic fun copy-gWg6A_4$default (Ldev/inmo/tgbotapi/types/chat/ExtendedBot;JLjava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZZZLdev/inmo/tgbotapi/types/ChatPhoto;ILdev/inmo/tgbotapi/types/colors/ColorId;Ljava/lang/String;Ljava/lang/String;IILjava/lang/Object;)Ldev/inmo/tgbotapi/types/chat/ExtendedBot; + public final fun copy-IItryQQ (JLjava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZZZLdev/inmo/tgbotapi/types/ChatPhoto;ILdev/inmo/tgbotapi/types/colors/ColorId;Ljava/lang/String;Ljava/lang/String;IZ)Ldev/inmo/tgbotapi/types/chat/ExtendedBot; + public static synthetic fun copy-IItryQQ$default (Ldev/inmo/tgbotapi/types/chat/ExtendedBot;JLjava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZZZLdev/inmo/tgbotapi/types/ChatPhoto;ILdev/inmo/tgbotapi/types/colors/ColorId;Ljava/lang/String;Ljava/lang/String;IZILjava/lang/Object;)Ldev/inmo/tgbotapi/types/chat/ExtendedBot; public fun equals (Ljava/lang/Object;)Z public fun getAccentColorId-f3WtEc0 ()I public fun getBackgroundCustomEmojiId-GbmMWyQ ()Ljava/lang/String; @@ -14541,6 +14546,7 @@ public final class dev/inmo/tgbotapi/types/chat/ExtendedBot : dev/inmo/tgbotapi/ public final fun getCanReadAllGroupMessages ()Z public fun getChatPhoto ()Ldev/inmo/tgbotapi/types/ChatPhoto; public fun getFirstName ()Ljava/lang/String; + public final fun getHasMainWebApp ()Z public synthetic fun getId ()Ldev/inmo/tgbotapi/types/IdChatIdentifier; public fun getId-tHkBKVM ()J public fun getLastName ()Ljava/lang/String; diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/abstracts/types/OptionallyBusinessConnectionRequest.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/abstracts/types/OptionallyBusinessConnectionRequest.kt index d33f8d3b85..8aba6f9dec 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/abstracts/types/OptionallyBusinessConnectionRequest.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/abstracts/types/OptionallyBusinessConnectionRequest.kt @@ -1,7 +1,3 @@ package dev.inmo.tgbotapi.abstracts.types -import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId - -interface OptionallyBusinessConnectionRequest { - val businessConnectionId: BusinessConnectionId? -} +interface OptionallyBusinessConnectionRequest : WithOptionalBusinessConnectionId diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/modify/PinChatMessage.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/modify/PinChatMessage.kt index cc01d6dcc9..b10408f8de 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/modify/PinChatMessage.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/modify/PinChatMessage.kt @@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.requests.chat.modify import dev.inmo.tgbotapi.abstracts.types.* import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import kotlinx.serialization.* import kotlinx.serialization.builtins.serializer @@ -17,9 +18,11 @@ data class PinChatMessage ( override val chatId: ChatIdentifier, @SerialName(messageIdField) override val messageId: MessageId, + @SerialName(businessConnectionIdField) + override val businessConnectionId: BusinessConnectionId? = null, @SerialName(disableNotificationField) override val disableNotification: Boolean = false -): ChatRequest, SimpleRequest, MessageAction, DisableNotification { +): ChatRequest, SimpleRequest, MessageAction, DisableNotification, OptionallyBusinessConnectionRequest { override fun method(): String = "pinChatMessage" override val resultDeserializer: DeserializationStrategy get() = Boolean.serializer() diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/modify/UnpinChatMessage.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/modify/UnpinChatMessage.kt index b191a2a3d7..7437ff3bc3 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/modify/UnpinChatMessage.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/modify/UnpinChatMessage.kt @@ -1,8 +1,10 @@ package dev.inmo.tgbotapi.requests.chat.modify import dev.inmo.tgbotapi.abstracts.types.ChatRequest +import dev.inmo.tgbotapi.abstracts.types.OptionallyBusinessConnectionRequest import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import kotlinx.serialization.* import kotlinx.serialization.builtins.serializer @@ -11,8 +13,10 @@ data class UnpinChatMessage( @SerialName(chatIdField) override val chatId: ChatIdentifier, @SerialName(messageIdField) - val messageId: MessageId? = null -): ChatRequest, SimpleRequest { + val messageId: MessageId? = null, + @SerialName(businessConnectionIdField) + override val businessConnectionId: BusinessConnectionId? = null +): ChatRequest, SimpleRequest, OptionallyBusinessConnectionRequest { override fun method(): String = "unpinChatMessage" override val resultDeserializer: DeserializationStrategy get() = Boolean.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 4abe77e2e3..d8de107a3c 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 @@ -159,6 +159,7 @@ const val hasVisibleHistoryField = "has_visible_history" const val unrestrictBoostsCountField = "unrestrict_boost_count" const val customEmojiStickerSetNameField = "custom_emoji_sticker_set_name" const val iconCustomEmojiIdField = "icon_custom_emoji_id" +const val hasMainWebAppField = "has_main_web_app" const val canJoinGroupsField = "can_join_groups" const val canReadAllGroupMessagesField = "can_read_all_group_messages" const val canReplyField = "can_reply" diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/Extended.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/Extended.kt index 58419106df..5dc0f90985 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/Extended.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/Extended.kt @@ -308,6 +308,8 @@ data class ExtendedBot( override val profileBackgroundCustomEmojiId: CustomEmojiId? = null, @SerialName(maxReactionCountField) override val maxReactionsCount: Int = 3, + @SerialName(hasMainWebAppField) + val hasMainWebApp: Boolean = false ) : Bot(), ExtendedChat { @SerialName(isBotField) private val isBot = true diff --git a/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/WebApp.kt b/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/WebApp.kt index 47465ef96b..f205ae37e9 100644 --- a/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/WebApp.kt +++ b/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/WebApp.kt @@ -6,6 +6,7 @@ import dev.inmo.tgbotapi.webapps.cloud.CloudStorage import dev.inmo.tgbotapi.webapps.haptic.HapticFeedback import dev.inmo.tgbotapi.webapps.invoice.InvoiceClosedInfo import dev.inmo.tgbotapi.webapps.popup.* +import dev.inmo.tgbotapi.webapps.stories.StoryShareParams external class WebApp { val version: String @@ -101,6 +102,8 @@ external class WebApp { fun openTelegramLink(url: String) fun openInvoice(url: String, callback: (InvoiceClosedInfo) -> Unit = definedExternally) + fun shareToStory(mediaUrl: String, params: StoryShareParams?) + fun requestWriteAccess(callback: ((Boolean) -> Unit)? = definedExternally) fun requestContact(callback: ((Boolean) -> Unit)? = definedExternally) } diff --git a/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/stories/StoryShareParams.kt b/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/stories/StoryShareParams.kt new file mode 100644 index 0000000000..93257cdd0b --- /dev/null +++ b/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/stories/StoryShareParams.kt @@ -0,0 +1,19 @@ +package dev.inmo.tgbotapi.webapps.stories + +import kotlin.js.json + +external interface StoryShareParams { + val text: String + @JsName("widget_link") + val widgetLink: StoryWidgetLink? +} + +fun StoryShareParams( + text: String, + widgetLink: StoryWidgetLink? = null +): StoryShareParams { + val json = json() + json["text"] = text + widgetLink ?.let { json["widget_link"] = it } + return json.unsafeCast() +} diff --git a/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/stories/StoryWidgetLink.kt b/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/stories/StoryWidgetLink.kt new file mode 100644 index 0000000000..06767336a8 --- /dev/null +++ b/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/stories/StoryWidgetLink.kt @@ -0,0 +1,18 @@ +package dev.inmo.tgbotapi.webapps.stories + +import kotlin.js.json + +external interface StoryWidgetLink { + val url: String + val name: String? +} + +fun StoryWidgetLink( + url: String, + name: String? = null +): StoryWidgetLink { + val json = json() + json["url"] = url + name ?.let { json["name"] = it } + return json.unsafeCast() +}