From e4a3acdd68988beb4ea14604d9f0042a3e27ef53 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Tue, 16 Apr 2024 23:11:01 +0600 Subject: [PATCH] start adding of support business_connection_id in sending requests --- .../OptionallyBusinessConnectionRequest.kt | 7 +++++++ .../inmo/tgbotapi/requests/send/CopyMessage.kt | 11 +++++++++++ .../tgbotapi/requests/send/CopyMessages.kt | 6 ++++++ .../inmo/tgbotapi/requests/send/SendAction.kt | 8 ++++++-- .../inmo/tgbotapi/requests/send/SendContact.kt | 7 +++++++ .../inmo/tgbotapi/requests/send/SendDice.kt | 5 ++++- .../tgbotapi/requests/send/SendLocation.kt | 10 +++++++++- .../inmo/tgbotapi/requests/send/SendMessage.kt | 7 +++++++ .../inmo/tgbotapi/requests/send/SendVenue.kt | 6 ++++++ .../send/abstracts/SendMessageRequest.kt | 3 ++- .../tgbotapi/requests/send/games/SendGame.kt | 3 +++ .../requests/send/media/SendAnimation.kt | 7 +++++++ .../tgbotapi/requests/send/media/SendAudio.kt | 7 +++++++ .../requests/send/media/SendDocument.kt | 7 +++++++ .../requests/send/media/SendMediaGroup.kt | 14 +++++++++++--- .../tgbotapi/requests/send/media/SendPhoto.kt | 7 +++++++ .../requests/send/media/SendSticker.kt | 5 +++++ .../tgbotapi/requests/send/media/SendVideo.kt | 7 +++++++ .../requests/send/media/SendVideoNote.kt | 5 +++++ .../tgbotapi/requests/send/media/SendVoice.kt | 7 +++++++ .../requests/send/payments/SendInvoice.kt | 3 +++ .../tgbotapi/requests/send/polls/SendPoll.kt | 18 ++++++++++++++++++ .../dev/inmo/tgbotapi/types/ChatIdentifier.kt | 3 +++ 23 files changed, 155 insertions(+), 8 deletions(-) create mode 100644 tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/abstracts/types/OptionallyBusinessConnectionRequest.kt 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 new file mode 100644 index 0000000000..d33f8d3b85 --- /dev/null +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/abstracts/types/OptionallyBusinessConnectionRequest.kt @@ -0,0 +1,7 @@ +package dev.inmo.tgbotapi.abstracts.types + +import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId + +interface OptionallyBusinessConnectionRequest { + val businessConnectionId: BusinessConnectionId? +} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/CopyMessage.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/CopyMessage.kt index c1a97db0d5..6fbd01e393 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/CopyMessage.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/CopyMessage.kt @@ -7,6 +7,7 @@ import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest import dev.inmo.tgbotapi.requests.send.abstracts.OptionallyMessageThreadRequest import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageRequest import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import dev.inmo.tgbotapi.types.message.textsources.TextSource import dev.inmo.tgbotapi.types.message.ParseMode import dev.inmo.tgbotapi.types.message.parseModeField @@ -28,6 +29,7 @@ fun CopyMessage( text: String? = null, parseMode: ParseMode? = null, threadId: MessageThreadId? = toChatId.threadId, + businessConnectionId: BusinessConnectionId? = toChatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, replyParameters: ReplyParameters? = null, @@ -40,6 +42,7 @@ fun CopyMessage( parseMode, null, threadId, + businessConnectionId, disableNotification, protectContent, replyParameters, @@ -52,6 +55,7 @@ fun CopyMessage( messageId: MessageId, entities: List, threadId: MessageThreadId? = toChatId.threadId, + businessConnectionId: BusinessConnectionId? = toChatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, replyParameters: ReplyParameters? = null, @@ -64,6 +68,7 @@ fun CopyMessage( null, entities.toRawMessageEntities(), threadId, + businessConnectionId, disableNotification, protectContent, replyParameters, @@ -77,6 +82,7 @@ fun CopyMessage( text: String? = null, parseMode: ParseMode? = null, threadId: MessageThreadId? = toChatId.threadId, + businessConnectionId: BusinessConnectionId? = toChatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, replyParameters: ReplyParameters? = null, @@ -89,6 +95,7 @@ fun CopyMessage( parseMode, null, threadId, + businessConnectionId, disableNotification, protectContent, replyParameters, @@ -101,6 +108,7 @@ fun CopyMessage( toChatId: ChatIdentifier, entities: List, threadId: MessageThreadId? = toChatId.threadId, + businessConnectionId: BusinessConnectionId? = toChatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, replyParameters: ReplyParameters? = null, @@ -113,6 +121,7 @@ fun CopyMessage( null, entities.toRawMessageEntities(), threadId, + businessConnectionId, disableNotification, protectContent, replyParameters, @@ -135,6 +144,8 @@ data class CopyMessage internal constructor( private val rawEntities: List? = null, @SerialName(messageThreadIdField) override val threadId: MessageThreadId? = toChatId.threadId, + @SerialName(businessConnectionIdField) + override val businessConnectionId: BusinessConnectionId? = toChatId.businessConnectionId, @SerialName(disableNotificationField) override val disableNotification: Boolean = false, @SerialName(protectContentField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/CopyMessages.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/CopyMessages.kt index b8305b50ce..5125929d8a 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/CopyMessages.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/CopyMessages.kt @@ -2,10 +2,12 @@ package dev.inmo.tgbotapi.requests.send import dev.inmo.tgbotapi.abstracts.types.DisableNotification import dev.inmo.tgbotapi.abstracts.types.MessagesAction +import dev.inmo.tgbotapi.abstracts.types.OptionallyBusinessConnectionRequest import dev.inmo.tgbotapi.abstracts.types.ProtectContent import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest import dev.inmo.tgbotapi.requests.send.abstracts.OptionallyMessageThreadRequest import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import dev.inmo.tgbotapi.types.message.textsources.TextSource import dev.inmo.tgbotapi.types.message.ParseMode import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup @@ -20,6 +22,7 @@ fun CopyMessages( fromChatId: ChatIdentifier, messageIds: Array, threadId: MessageThreadId? = toChatId.threadId, + businessConnectionId: BusinessConnectionId? = toChatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, removeCaption: Boolean = false @@ -43,6 +46,8 @@ data class CopyMessages ( override val messageIds: List, @SerialName(messageThreadIdField) override val threadId: MessageThreadId? = toChatId.threadId, + @SerialName(businessConnectionIdField) + override val businessConnectionId: BusinessConnectionId? = toChatId.businessConnectionId, @SerialName(disableNotificationField) override val disableNotification: Boolean = false, @SerialName(protectContentField) @@ -53,6 +58,7 @@ data class CopyMessages ( MessagesAction, ProtectContent, OptionallyMessageThreadRequest, + OptionallyBusinessConnectionRequest, DisableNotification { override val chatId: ChatIdentifier get() = fromChatId diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendAction.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendAction.kt index 6a5762dd31..2e8a00cd1f 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendAction.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendAction.kt @@ -1,9 +1,11 @@ package dev.inmo.tgbotapi.requests.send +import dev.inmo.tgbotapi.abstracts.types.OptionallyBusinessConnectionRequest import dev.inmo.tgbotapi.requests.send.abstracts.OptionallyMessageThreadRequest import dev.inmo.tgbotapi.requests.send.abstracts.SendChatMessageRequest import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.actions.BotAction +import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import kotlinx.serialization.* import kotlinx.serialization.builtins.serializer @@ -17,8 +19,10 @@ data class SendAction( @SerialName(actionField) val action: BotAction, @SerialName(messageThreadIdField) - override val threadId: MessageThreadId? = chatId.threadId -): SendChatMessageRequest, OptionallyMessageThreadRequest { + override val threadId: MessageThreadId? = chatId.threadId, + @SerialName(businessConnectionIdField) + override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId +): SendChatMessageRequest, OptionallyMessageThreadRequest, OptionallyBusinessConnectionRequest { override fun method(): String = "sendChatAction" override val resultDeserializer: DeserializationStrategy get() = Boolean.serializer() diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendContact.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendContact.kt index f3ab14ef43..73266ccb97 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendContact.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendContact.kt @@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.requests.send import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageRequest import dev.inmo.tgbotapi.requests.send.abstracts.SendMessageRequest import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass @@ -24,6 +25,8 @@ data class SendContact( val lastName: String? = null, @SerialName(messageThreadIdField) override val threadId: MessageThreadId? = chatId.threadId, + @SerialName(businessConnectionIdField) + override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, @SerialName(disableNotificationField) override val disableNotification: Boolean = false, @SerialName(protectContentField) @@ -39,6 +42,7 @@ data class SendContact( chatId: ChatIdentifier, contact: Contact, threadId: MessageThreadId? = chatId.threadId, + businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, replyParameters: ReplyParameters? = null, @@ -49,6 +53,7 @@ data class SendContact( contact.firstName, contact.lastName, threadId, + businessConnectionId, disableNotification, protectContent, replyParameters, @@ -65,6 +70,7 @@ data class SendContact( fun Contact.toRequest( chatId: ChatIdentifier, threadId: MessageThreadId? = chatId.threadId, + businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, replyParameters: ReplyParameters? = null, @@ -73,6 +79,7 @@ fun Contact.toRequest( chatId, this, threadId, + businessConnectionId, disableNotification, protectContent, replyParameters, diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendDice.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendDice.kt index 629f29a445..5a796bc4b5 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendDice.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendDice.kt @@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.abstracts.types.DisableNotification import dev.inmo.tgbotapi.abstracts.types.WithReplyParameters import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageRequest import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.dice.DiceAnimationType import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage @@ -21,7 +22,9 @@ data class SendDice( @SerialName(emojiField) val animationType: DiceAnimationType? = null, @SerialName(messageThreadIdField) - override val threadId: MessageThreadId?, + override val threadId: MessageThreadId? = chatId.threadId, + @SerialName(businessConnectionIdField) + override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, @SerialName(disableNotificationField) override val disableNotification: Boolean = false, @SerialName(protectContentField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendLocation.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendLocation.kt index 4aa76820fe..e7bbab6238 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendLocation.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendLocation.kt @@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.requests.send import dev.inmo.tgbotapi.abstracts.* import dev.inmo.tgbotapi.requests.send.abstracts.* import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass @@ -19,6 +20,7 @@ fun SendLocation( latitude: Double, longitude: Double, threadId: MessageThreadId? = chatId.threadId, + businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, replyParameters: ReplyParameters? = null, @@ -32,6 +34,7 @@ fun SendLocation( null, null, threadId, + businessConnectionId, disableNotification, protectContent, replyParameters, @@ -43,11 +46,12 @@ fun SendStaticLocation( latitude: Double, longitude: Double, threadId: MessageThreadId? = chatId.threadId, + businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, replyParameters: ReplyParameters? = null, replyMarkup: KeyboardMarkup? = null -) = SendLocation(chatId, latitude, longitude, threadId, disableNotification, protectContent, replyParameters, replyMarkup) +) = SendLocation(chatId, latitude, longitude, threadId, businessConnectionId, disableNotification, protectContent, replyParameters, replyMarkup) fun SendLiveLocation( chatId: ChatIdentifier, @@ -58,6 +62,7 @@ fun SendLiveLocation( heading: Degrees? = null, proximityAlertRadius: Meters? = null, threadId: MessageThreadId? = chatId.threadId, + businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, replyParameters: ReplyParameters? = null, @@ -71,6 +76,7 @@ fun SendLiveLocation( heading, proximityAlertRadius, threadId, + businessConnectionId, disableNotification, protectContent, replyParameters, @@ -95,6 +101,8 @@ data class SendLocation internal constructor( override val proximityAlertRadius: Meters? = null, @SerialName(messageThreadIdField) override val threadId: MessageThreadId? = chatId.threadId, + @SerialName(businessConnectionIdField) + override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, @SerialName(disableNotificationField) override val disableNotification: Boolean = false, @SerialName(protectContentField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendMessage.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendMessage.kt index 23711b9c3d..4823d4534c 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendMessage.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendMessage.kt @@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.requests.send import dev.inmo.tgbotapi.abstracts.types.LinkPreviewOptionsContainer import dev.inmo.tgbotapi.requests.send.abstracts.* import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList import dev.inmo.tgbotapi.types.message.ParseMode import dev.inmo.tgbotapi.types.message.parseModeField @@ -26,6 +27,7 @@ fun SendTextMessage( parseMode: ParseMode? = null, linkPreviewOptions: LinkPreviewOptions? = null, threadId: MessageThreadId? = chatId.threadId, + businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, replyParameters: ReplyParameters? = null, @@ -36,6 +38,7 @@ fun SendTextMessage( parseMode, null, threadId, + businessConnectionId, linkPreviewOptions, disableNotification, protectContent, @@ -48,6 +51,7 @@ fun SendTextMessage( entities: TextSourcesList, linkPreviewOptions: LinkPreviewOptions? = null, threadId: MessageThreadId? = chatId.threadId, + businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, replyParameters: ReplyParameters? = null, @@ -58,6 +62,7 @@ fun SendTextMessage( null, entities.toRawMessageEntities(), threadId, + businessConnectionId, linkPreviewOptions, disableNotification, protectContent, @@ -77,6 +82,8 @@ data class SendTextMessage internal constructor( private val rawEntities: List? = null, @SerialName(messageThreadIdField) override val threadId: MessageThreadId? = chatId.threadId, + @SerialName(businessConnectionIdField) + override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, @SerialName(linkPreviewOptionsField) override val linkPreviewOptions: LinkPreviewOptions? = null, @SerialName(disableNotificationField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendVenue.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendVenue.kt index 4812627536..4acb1422bb 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendVenue.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendVenue.kt @@ -2,6 +2,7 @@ package dev.inmo.tgbotapi.requests.send import dev.inmo.tgbotapi.requests.send.abstracts.* import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass @@ -34,6 +35,8 @@ data class SendVenue( val googlePlaceType: GooglePlaceType? = null, @SerialName(messageThreadIdField) override val threadId: MessageThreadId? = chatId.threadId, + @SerialName(businessConnectionIdField) + override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, @SerialName(disableNotificationField) override val disableNotification: Boolean = false, @SerialName(protectContentField) @@ -51,6 +54,7 @@ data class SendVenue( chatId: ChatIdentifier, venue: Venue, threadId: MessageThreadId? = chatId.threadId, + businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, replyParameters: ReplyParameters? = null, @@ -82,6 +86,7 @@ data class SendVenue( fun Venue.toRequest( chatId: ChatIdentifier, threadId: MessageThreadId? = chatId.threadId, + businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, replyParameters: ReplyParameters? = null, @@ -90,6 +95,7 @@ fun Venue.toRequest( chatId, this, threadId, + businessConnectionId, disableNotification, protectContent, replyParameters, diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/abstracts/SendMessageRequest.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/abstracts/SendMessageRequest.kt index e52810b8d4..8f08a9a76f 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/abstracts/SendMessageRequest.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/abstracts/SendMessageRequest.kt @@ -6,4 +6,5 @@ interface SendMessageRequest : SendChatMessageRequest, WithReplyParameters, DisableNotification, ProtectContent, - OptionallyMessageThreadRequest + OptionallyMessageThreadRequest, + OptionallyBusinessConnectionRequest diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/games/SendGame.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/games/SendGame.kt index e00b08885d..4b604e0d78 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/games/SendGame.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/games/SendGame.kt @@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.requests.send.games import dev.inmo.tgbotapi.abstracts.types.WithReplyMarkup import dev.inmo.tgbotapi.requests.send.abstracts.SendMessageRequest import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass @@ -20,6 +21,8 @@ data class SendGame ( val gameShortName: String, @SerialName(messageThreadIdField) override val threadId: MessageThreadId? = chatId.threadId, + @SerialName(businessConnectionIdField) + override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, @SerialName(disableNotificationField) override val disableNotification: Boolean = false, @SerialName(protectContentField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendAnimation.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendAnimation.kt index 1a4d4816a1..ed98790139 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendAnimation.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendAnimation.kt @@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest import dev.inmo.tgbotapi.requests.send.abstracts.* import dev.inmo.tgbotapi.requests.send.media.base.* import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList import dev.inmo.tgbotapi.types.message.ParseMode import dev.inmo.tgbotapi.types.message.parseModeField @@ -31,6 +32,7 @@ fun SendAnimation( width: Int? = null, height: Int? = null, threadId: MessageThreadId? = chatId.threadId, + businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, replyParameters: ReplyParameters? = null, @@ -51,6 +53,7 @@ fun SendAnimation( width, height, threadId, + businessConnectionId, disableNotification, protectContent, replyParameters, @@ -77,6 +80,7 @@ fun SendAnimation( width: Int? = null, height: Int? = null, threadId: MessageThreadId? = chatId.threadId, + businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, replyParameters: ReplyParameters? = null, @@ -97,6 +101,7 @@ fun SendAnimation( width, height, threadId, + businessConnectionId, disableNotification, protectContent, replyParameters, @@ -140,6 +145,8 @@ data class SendAnimationData internal constructor( override val height: Int? = null, @SerialName(messageThreadIdField) override val threadId: MessageThreadId? = chatId.threadId, + @SerialName(businessConnectionIdField) + override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, @SerialName(disableNotificationField) override val disableNotification: Boolean = false, @SerialName(protectContentField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendAudio.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendAudio.kt index 2c85f6199a..d0bf39e8a0 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendAudio.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendAudio.kt @@ -6,6 +6,7 @@ import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest import dev.inmo.tgbotapi.requests.send.abstracts.* import dev.inmo.tgbotapi.requests.send.media.base.* import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import dev.inmo.tgbotapi.types.message.textsources.TextSource import dev.inmo.tgbotapi.types.message.ParseMode import dev.inmo.tgbotapi.types.message.parseModeField @@ -31,6 +32,7 @@ fun SendAudio( performer: String? = null, title: String? = null, threadId: MessageThreadId? = chatId.threadId, + businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, replyParameters: ReplyParameters? = null, @@ -50,6 +52,7 @@ fun SendAudio( performer, title, threadId, + businessConnectionId, disableNotification, protectContent, replyParameters, @@ -75,6 +78,7 @@ fun SendAudio( performer: String? = null, title: String? = null, threadId: MessageThreadId? = chatId.threadId, + businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, replyParameters: ReplyParameters? = null, @@ -94,6 +98,7 @@ fun SendAudio( performer, title, threadId, + businessConnectionId, disableNotification, protectContent, replyParameters, @@ -135,6 +140,8 @@ data class SendAudioData internal constructor( override val title: String? = null, @SerialName(messageThreadIdField) override val threadId: MessageThreadId? = chatId.threadId, + @SerialName(businessConnectionIdField) + override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, @SerialName(disableNotificationField) override val disableNotification: Boolean = false, @SerialName(protectContentField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendDocument.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendDocument.kt index b9b33cbbb4..00d5d08af7 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendDocument.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendDocument.kt @@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest import dev.inmo.tgbotapi.requests.send.abstracts.* import dev.inmo.tgbotapi.requests.send.media.base.* import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList import dev.inmo.tgbotapi.types.message.ParseMode import dev.inmo.tgbotapi.types.message.parseModeField @@ -36,6 +37,7 @@ fun SendDocument( text: String? = null, parseMode: ParseMode? = null, threadId: MessageThreadId? = chatId.threadId, + businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, replyParameters: ReplyParameters? = null, @@ -53,6 +55,7 @@ fun SendDocument( parseMode, null, threadId, + businessConnectionId, disableNotification, protectContent, replyParameters, @@ -85,6 +88,7 @@ fun SendDocument( thumbnail: InputFile? = null, entities: TextSourcesList, threadId: MessageThreadId? = chatId.threadId, + businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, replyParameters: ReplyParameters? = null, @@ -102,6 +106,7 @@ fun SendDocument( null, entities.toRawMessageEntities(), threadId, + businessConnectionId, disableNotification, protectContent, replyParameters, @@ -147,6 +152,8 @@ data class SendDocumentData internal constructor( private val rawEntities: List? = null, @SerialName(messageThreadIdField) override val threadId: MessageThreadId? = chatId.threadId, + @SerialName(businessConnectionIdField) + override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, @SerialName(disableNotificationField) override val disableNotification: Boolean = false, @SerialName(protectContentField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendMediaGroup.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendMediaGroup.kt index 0304856ba7..2e6b92bb13 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendMediaGroup.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendMediaGroup.kt @@ -6,6 +6,7 @@ import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest import dev.inmo.tgbotapi.requests.send.abstracts.SendMessageRequest import dev.inmo.tgbotapi.requests.send.media.base.* import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import dev.inmo.tgbotapi.types.media.* import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.abstracts.PossiblySentViaBotCommonMessage @@ -32,6 +33,7 @@ fun SendMediaGroup( chatId: ChatIdentifier, media: List, threadId: MessageThreadId? = chatId.threadId, + businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, replyParameters: ReplyParameters? = null, @@ -56,6 +58,7 @@ fun SendMediaGroup( chatId, media, threadId, + businessConnectionId, disableNotification, protectContent, replyParameters @@ -81,11 +84,12 @@ inline fun SendPlaylist( chatId: ChatIdentifier, media: List, threadId: MessageThreadId? = chatId.threadId, + businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null -) = SendMediaGroup(chatId, media, threadId, disableNotification, protectContent, replyParameters, allowSendingWithoutReply) +) = SendMediaGroup(chatId, media, threadId, businessConnectionId, disableNotification, protectContent, replyParameters, allowSendingWithoutReply) /** * Use this method to be sure that you are correctly sending documents media group @@ -97,11 +101,12 @@ inline fun SendDocumentsGroup( chatId: ChatIdentifier, media: List, threadId: MessageThreadId? = chatId.threadId, + businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null -) = SendMediaGroup(chatId, media, threadId, disableNotification, protectContent, replyParameters, allowSendingWithoutReply) +) = SendMediaGroup(chatId, media, threadId, businessConnectionId, disableNotification, protectContent, replyParameters, allowSendingWithoutReply) /** * Use this method to be sure that you are correctly sending visual media group @@ -114,11 +119,12 @@ inline fun SendVisualMediaGroup( chatId: ChatIdentifier, media: List, threadId: MessageThreadId? = chatId.threadId, + businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null -) = SendMediaGroup(chatId, media, threadId, disableNotification, protectContent, replyParameters, allowSendingWithoutReply) +) = SendMediaGroup(chatId, media, threadId, businessConnectionId, disableNotification, protectContent, replyParameters, allowSendingWithoutReply) private object MessagesListSerializer: KSerializer>> { private val serializer = ListSerializer(TelegramBotAPIMessageDeserializeOnlySerializerClass>()) @@ -142,6 +148,8 @@ data class SendMediaGroupData internal constructor( val media: List = emptyList(), @SerialName(messageThreadIdField) override val threadId: MessageThreadId? = chatId.threadId, + @SerialName(businessConnectionIdField) + override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, @SerialName(disableNotificationField) override val disableNotification: Boolean = false, @SerialName(protectContentField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendPhoto.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendPhoto.kt index 4c16cf55c8..b2444b1a97 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendPhoto.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendPhoto.kt @@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest import dev.inmo.tgbotapi.requests.send.abstracts.* import dev.inmo.tgbotapi.requests.send.media.base.* import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList import dev.inmo.tgbotapi.types.message.ParseMode import dev.inmo.tgbotapi.types.message.parseModeField @@ -26,6 +27,7 @@ fun SendPhoto( parseMode: ParseMode? = null, spoilered: Boolean = false, threadId: MessageThreadId? = chatId.threadId, + businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, replyParameters: ReplyParameters? = null, @@ -39,6 +41,7 @@ fun SendPhoto( null, spoilered, threadId, + businessConnectionId, disableNotification, protectContent, replyParameters, @@ -60,6 +63,7 @@ fun SendPhoto( entities: TextSourcesList, spoilered: Boolean = false, threadId: MessageThreadId? = chatId.threadId, + businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, replyParameters: ReplyParameters? = null, @@ -73,6 +77,7 @@ fun SendPhoto( entities.toRawMessageEntities(), spoilered, threadId, + businessConnectionId, disableNotification, protectContent, replyParameters, @@ -108,6 +113,8 @@ data class SendPhotoData internal constructor( override val spoilered: Boolean = false, @SerialName(messageThreadIdField) override val threadId: MessageThreadId? = chatId.threadId, + @SerialName(businessConnectionIdField) + override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, @SerialName(disableNotificationField) override val disableNotification: Boolean = false, @SerialName(protectContentField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendSticker.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendSticker.kt index bba52d5470..060f146aef 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendSticker.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendSticker.kt @@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageRequest import dev.inmo.tgbotapi.requests.send.abstracts.SendMessageRequest import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass @@ -15,6 +16,7 @@ fun SendSticker( chatId: ChatIdentifier, sticker: InputFile, threadId: MessageThreadId? = chatId.threadId, + businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, emoji: String? = null, disableNotification: Boolean = false, protectContent: Boolean = false, @@ -24,6 +26,7 @@ fun SendSticker( chatId, sticker, threadId, + businessConnectionId, disableNotification, protectContent, replyParameters, @@ -49,6 +52,8 @@ data class SendStickerByFileId internal constructor( val sticker: InputFile, @SerialName(messageThreadIdField) override val threadId: MessageThreadId? = chatId.threadId, + @SerialName(businessConnectionIdField) + override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, @SerialName(disableNotificationField) override val disableNotification: Boolean = false, @SerialName(protectContentField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVideo.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVideo.kt index 80b17f8e70..c4319937f8 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVideo.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVideo.kt @@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest import dev.inmo.tgbotapi.requests.send.abstracts.* import dev.inmo.tgbotapi.requests.send.media.base.* import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList import dev.inmo.tgbotapi.types.message.ParseMode import dev.inmo.tgbotapi.types.message.parseModeField @@ -32,6 +33,7 @@ fun SendVideo( height: Int? = null, supportStreaming: Boolean? = null, threadId: MessageThreadId? = chatId.threadId, + businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, replyParameters: ReplyParameters? = null, @@ -53,6 +55,7 @@ fun SendVideo( height, supportStreaming, threadId, + businessConnectionId, disableNotification, protectContent, replyParameters, @@ -80,6 +83,7 @@ fun SendVideo( height: Int? = null, supportStreaming: Boolean? = null, threadId: MessageThreadId? = chatId.threadId, + businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, replyParameters: ReplyParameters? = null, @@ -101,6 +105,7 @@ fun SendVideo( height, supportStreaming, threadId, + businessConnectionId, disableNotification, protectContent, replyParameters, @@ -146,6 +151,8 @@ data class SendVideoData internal constructor( val supportStreaming: Boolean? = null, @SerialName(messageThreadIdField) override val threadId: MessageThreadId? = chatId.threadId, + @SerialName(businessConnectionIdField) + override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, @SerialName(disableNotificationField) override val disableNotification: Boolean = false, @SerialName(protectContentField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVideoNote.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVideoNote.kt index 9eb8cab82c..bc13b9e821 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVideoNote.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVideoNote.kt @@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest import dev.inmo.tgbotapi.requests.send.abstracts.* import dev.inmo.tgbotapi.requests.send.media.base.* import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass @@ -19,6 +20,7 @@ fun SendVideoNote( duration: Long? = null, size: Int? = null, // in documentation - length (size of video side) threadId: MessageThreadId? = chatId.threadId, + businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, replyParameters: ReplyParameters? = null, @@ -34,6 +36,7 @@ fun SendVideoNote( duration, size, threadId, + businessConnectionId, disableNotification, protectContent, replyParameters, @@ -67,6 +70,8 @@ data class SendVideoNoteData internal constructor( override val width: Int? = null, @SerialName(messageThreadIdField) override val threadId: MessageThreadId? = chatId.threadId, + @SerialName(businessConnectionIdField) + override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, @SerialName(disableNotificationField) override val disableNotification: Boolean = false, @SerialName(protectContentField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVoice.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVoice.kt index 1193f6dfb6..991f9bd88a 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVoice.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVoice.kt @@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest import dev.inmo.tgbotapi.requests.send.abstracts.* import dev.inmo.tgbotapi.requests.send.media.base.* import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList import dev.inmo.tgbotapi.types.message.ParseMode import dev.inmo.tgbotapi.types.message.parseModeField @@ -27,6 +28,7 @@ fun SendVoice( parseMode: ParseMode? = null, duration: Long? = null, threadId: MessageThreadId? = chatId.threadId, + businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, replyParameters: ReplyParameters? = null, @@ -42,6 +44,7 @@ fun SendVoice( null, duration, threadId, + businessConnectionId, disableNotification, protectContent, replyParameters, @@ -63,6 +66,7 @@ fun SendVoice( voice: InputFile, entities: TextSourcesList, threadId: MessageThreadId? = chatId.threadId, + businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, duration: Long? = null, disableNotification: Boolean = false, protectContent: Boolean = false, @@ -79,6 +83,7 @@ fun SendVoice( entities.toRawMessageEntities(), duration, threadId, + businessConnectionId, disableNotification, protectContent, replyParameters, @@ -114,6 +119,8 @@ data class SendVoiceData internal constructor( override val duration: Long? = null, @SerialName(messageThreadIdField) override val threadId: MessageThreadId? = chatId.threadId, + @SerialName(businessConnectionIdField) + override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, @SerialName(disableNotificationField) override val disableNotification: Boolean = false, @SerialName(protectContentField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/payments/SendInvoice.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/payments/SendInvoice.kt index c2ead144a7..796ff061a8 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/payments/SendInvoice.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/payments/SendInvoice.kt @@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.abstracts.CommonSendInvoiceData import dev.inmo.tgbotapi.abstracts.types.* import dev.inmo.tgbotapi.requests.send.abstracts.SendMessageRequest import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass @@ -60,6 +61,8 @@ data class SendInvoice( override val priceDependOnShipAddress: Boolean = false, @SerialName(messageThreadIdField) override val threadId: MessageThreadId? = chatId.threadId, + @SerialName(businessConnectionIdField) + override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, @SerialName(disableNotificationField) override val disableNotification: Boolean = false, @SerialName(protectContentField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/polls/SendPoll.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/polls/SendPoll.kt index 5d88eaa918..32b572d9ce 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/polls/SendPoll.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/polls/SendPoll.kt @@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.abstracts.TextedOutput import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageRequest import dev.inmo.tgbotapi.requests.send.abstracts.SendMessageRequest import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import dev.inmo.tgbotapi.types.message.textsources.TextSource import dev.inmo.tgbotapi.types.message.ParseMode import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup @@ -51,6 +52,7 @@ fun SendPoll( isAnonymous: Boolean = true, isClosed: Boolean = false, threadId: MessageThreadId? = chatId.threadId, + businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, replyParameters: ReplyParameters? = null, @@ -75,6 +77,7 @@ fun SendPoll( fun Poll.createRequest( chatId: ChatIdentifier, threadId: MessageThreadId? = chatId.threadId, + businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, replyParameters: ReplyParameters? = null, @@ -89,6 +92,7 @@ fun Poll.createRequest( allowMultipleAnswers, scheduledCloseInfo, threadId, + businessConnectionId, disableNotification, protectContent, replyParameters, @@ -119,6 +123,7 @@ fun Poll.createRequest( false, scheduledCloseInfo, threadId, + businessConnectionId, disableNotification, protectContent, replyParameters, @@ -133,6 +138,7 @@ fun Poll.createRequest( false, scheduledCloseInfo, threadId, + businessConnectionId, disableNotification, protectContent, replyParameters, @@ -198,6 +204,8 @@ data class SendRegularPoll( override val closeDate: LongSeconds?, @SerialName(messageThreadIdField) override val threadId: MessageThreadId? = chatId.threadId, + @SerialName(businessConnectionIdField) + override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, @SerialName(disableNotificationField) override val disableNotification: Boolean = false, @SerialName(protectContentField) @@ -226,6 +234,7 @@ fun SendRegularPoll( allowMultipleAnswers: Boolean = false, closeInfo: ScheduledCloseInfo? = null, threadId: MessageThreadId? = chatId.threadId, + businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, replyParameters: ReplyParameters? = null, @@ -240,6 +249,7 @@ fun SendRegularPoll( (closeInfo as? ApproximateScheduledCloseInfo) ?.openPeriod, (closeInfo as? ExactScheduledCloseInfo) ?.closeDate, threadId, + businessConnectionId, disableNotification, protectContent, replyParameters, @@ -257,6 +267,7 @@ fun SendQuizPoll( parseMode: ParseMode? = null, closeInfo: ScheduledCloseInfo? = null, threadId: MessageThreadId? = chatId.threadId, + businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, replyParameters: ReplyParameters? = null, @@ -273,6 +284,7 @@ fun SendQuizPoll( null, closeInfo, threadId, + businessConnectionId, disableNotification, protectContent, replyParameters, @@ -289,6 +301,7 @@ fun SendQuizPoll( entities: List, closeInfo: ScheduledCloseInfo? = null, threadId: MessageThreadId? = chatId.threadId, + businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, replyParameters: ReplyParameters? = null, @@ -305,6 +318,7 @@ fun SendQuizPoll( entities.toRawMessageEntities(), closeInfo, threadId, + businessConnectionId, disableNotification, protectContent, replyParameters, @@ -323,6 +337,7 @@ internal fun SendQuizPoll( rawEntities: List? = null, closeInfo: ScheduledCloseInfo? = null, threadId: MessageThreadId? = chatId.threadId, + businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, replyParameters: ReplyParameters? = null, @@ -340,6 +355,7 @@ internal fun SendQuizPoll( (closeInfo as? ApproximateScheduledCloseInfo) ?.openPeriod, (closeInfo as? ExactScheduledCloseInfo) ?.closeDate, threadId, + businessConnectionId, disableNotification, protectContent, replyParameters, @@ -372,6 +388,8 @@ data class SendQuizPoll internal constructor( override val closeDate: LongSeconds? = null, @SerialName(messageThreadIdField) override val threadId: MessageThreadId? = chatId.threadId, + @SerialName(businessConnectionIdField) + override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, @SerialName(disableNotificationField) override val disableNotification: Boolean = false, @SerialName(protectContentField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatIdentifier.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatIdentifier.kt index fe7591e076..c067dcc34a 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatIdentifier.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatIdentifier.kt @@ -72,6 +72,9 @@ value class BusinessChatId(val chatIdWithBusinessConnectionId: Pair this is ChatIdWithThreadId -> ChatId(chatId)