diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/ForwardMessage.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/ForwardMessage.kt index 493f510c08..936d96f5ec 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/ForwardMessage.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/ForwardMessage.kt @@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.requests import dev.inmo.tgbotapi.abstracts.types.MessageAction 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.message.abstracts.PossiblyForwardedMessage import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass @@ -16,13 +17,15 @@ data class ForwardMessage( val fromChatId: ChatIdentifier, @SerialName(chatIdField) val toChatId: ChatIdentifier, + @SerialName(messageThreadIdField) + override val threadId: MessageThreadId? = null, @SerialName(messageIdField) override val messageId: MessageId, @SerialName(disableNotificationField) val disableNotification: Boolean = false, @SerialName(protectContentField) override val protectContent: Boolean = false -): SimpleRequest, MessageAction, ProtectContent { +): SimpleRequest, MessageAction, ProtectContent, OptionallyMessageThreadRequest { override val chatId: ChatIdentifier get() = fromChatId 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 e6f542eb6e..39a9def570 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 @@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.abstracts.TextedOutput import dev.inmo.tgbotapi.abstracts.types.MessageAction 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.requests.send.abstracts.ReplyingMarkupSendMessageRequest import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.message.textsources.TextSource @@ -26,6 +27,7 @@ fun CopyMessage( messageId: MessageId, text: String? = null, parseMode: ParseMode? = null, + threadId: MessageThreadId? = null, disableNotification: Boolean = false, protectContent: Boolean = false, replyToMessageId: MessageId? = null, @@ -38,6 +40,7 @@ fun CopyMessage( text, parseMode, null, + threadId, disableNotification, protectContent, replyToMessageId, @@ -50,6 +53,7 @@ fun CopyMessage( fromChatId: ChatIdentifier, messageId: MessageId, entities: List, + threadId: MessageThreadId? = null, disableNotification: Boolean = false, protectContent: Boolean = false, replyToMessageId: MessageId? = null, @@ -62,6 +66,7 @@ fun CopyMessage( entities.makeString(), null, entities.toRawMessageEntities(), + threadId, disableNotification, protectContent, replyToMessageId, @@ -75,6 +80,7 @@ fun CopyMessage( toChatId: ChatIdentifier, text: String? = null, parseMode: ParseMode? = null, + threadId: MessageThreadId? = null, disableNotification: Boolean = false, protectContent: Boolean = false, replyToMessageId: MessageId? = null, @@ -87,6 +93,7 @@ fun CopyMessage( text, parseMode, null, + threadId, disableNotification, protectContent, replyToMessageId, @@ -99,6 +106,7 @@ fun CopyMessage( messageId: MessageId, toChatId: ChatIdentifier, entities: List, + threadId: MessageThreadId? = null, disableNotification: Boolean = false, protectContent: Boolean = false, replyToMessageId: MessageId? = null, @@ -111,6 +119,7 @@ fun CopyMessage( entities.makeString(), null, entities.toRawMessageEntities(), + threadId, disableNotification, protectContent, replyToMessageId, @@ -132,6 +141,8 @@ data class CopyMessage internal constructor( override val parseMode: ParseMode? = null, @SerialName(captionEntitiesField) private val rawEntities: List? = null, + @SerialName(messageThreadIdField) + override val threadId: MessageThreadId? = null, @SerialName(disableNotificationField) override val disableNotification: Boolean = false, @SerialName(protectContentField) @@ -146,7 +157,8 @@ data class CopyMessage internal constructor( ReplyingMarkupSendMessageRequest, MessageAction, TextedOutput, - ProtectContent { + ProtectContent, + OptionallyMessageThreadRequest { override val chatId: ChatIdentifier get() = fromChatId override val textSources: List? by lazy { 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 2bef286363..cf12d44db3 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 @@ -22,6 +22,8 @@ data class SendContact( val firstName: String, @SerialName(lastNameField) val lastName: String? = null, + @SerialName(messageThreadIdField) + override val threadId: MessageThreadId? = null, @SerialName(disableNotificationField) override val disableNotification: Boolean = false, @SerialName(protectContentField) @@ -38,6 +40,7 @@ data class SendContact( constructor( chatId: ChatIdentifier, contact: Contact, + threadId: MessageThreadId? = null, disableNotification: Boolean = false, protectContent: Boolean = false, replyToMessageId: MessageId? = null, @@ -48,6 +51,7 @@ data class SendContact( contact.phoneNumber, contact.firstName, contact.lastName, + threadId, disableNotification, protectContent, replyToMessageId, @@ -64,6 +68,7 @@ data class SendContact( fun Contact.toRequest( chatId: ChatIdentifier, + threadId: MessageThreadId? = null, disableNotification: Boolean = false, protectContent: Boolean = false, replyToMessageId: MessageId? = null, @@ -72,6 +77,7 @@ fun Contact.toRequest( ): SendContact = SendContact( chatId, this, + threadId, disableNotification, protectContent, replyToMessageId, 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 685a024be0..5225d3a5fe 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 @@ -20,6 +20,8 @@ data class SendDice( override val chatId: ChatIdentifier, @SerialName(emojiField) val animationType: DiceAnimationType? = null, + @SerialName(messageThreadIdField) + override val threadId: MessageThreadId?, @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 193711c98f..8631b754e2 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 @@ -18,6 +18,7 @@ fun SendLocation( chatId: ChatIdentifier, latitude: Double, longitude: Double, + threadId: MessageThreadId? = null, disableNotification: Boolean = false, protectContent: Boolean = false, replyToMessageId: MessageId? = null, @@ -31,6 +32,7 @@ fun SendLocation( null, null, null, + threadId, disableNotification, protectContent, replyToMessageId, @@ -42,12 +44,13 @@ fun SendStaticLocation( chatId: ChatIdentifier, latitude: Double, longitude: Double, + threadId: MessageThreadId? = null, disableNotification: Boolean = false, protectContent: Boolean = false, replyToMessageId: MessageId? = null, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = SendLocation(chatId, latitude, longitude, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) +) = SendLocation(chatId, latitude, longitude, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) fun SendLiveLocation( chatId: ChatIdentifier, @@ -57,6 +60,7 @@ fun SendLiveLocation( horizontalAccuracy: Meters? = null, heading: Degrees? = null, proximityAlertRadius: Meters? = null, + threadId: MessageThreadId? = null, disableNotification: Boolean = false, protectContent: Boolean = false, replyToMessageId: MessageId? = null, @@ -70,6 +74,7 @@ fun SendLiveLocation( horizontalAccuracy, heading, proximityAlertRadius, + threadId, disableNotification, protectContent, replyToMessageId, @@ -93,6 +98,8 @@ data class SendLocation internal constructor( override val heading: Degrees? = null, @SerialName(proximityAlertRadiusField) override val proximityAlertRadius: Meters? = null, + @SerialName(messageThreadIdField) + override val threadId: MessageThreadId? = null, @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 d702726186..94cdd99c8d 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 @@ -24,6 +24,7 @@ fun SendTextMessage( chatId: ChatIdentifier, text: String, parseMode: ParseMode? = null, + threadId: MessageThreadId? = null, disableWebPagePreview: Boolean? = null, disableNotification: Boolean = false, protectContent: Boolean = false, @@ -35,6 +36,7 @@ fun SendTextMessage( text, parseMode, null, + threadId, disableWebPagePreview, disableNotification, protectContent, @@ -46,6 +48,7 @@ fun SendTextMessage( fun SendTextMessage( chatId: ChatIdentifier, entities: TextSourcesList, + threadId: MessageThreadId? = null, disableWebPagePreview: Boolean? = null, disableNotification: Boolean = false, protectContent: Boolean = false, @@ -57,6 +60,7 @@ fun SendTextMessage( entities.makeString(), null, entities.toRawMessageEntities(), + threadId, disableWebPagePreview, disableNotification, protectContent, @@ -75,6 +79,8 @@ data class SendTextMessage internal constructor( override val parseMode: ParseMode? = null, @SerialName(entitiesField) private val rawEntities: List? = null, + @SerialName(messageThreadIdField) + override val threadId: MessageThreadId? = null, @SerialName(disableWebPagePreviewField) override val disableWebPagePreview: Boolean? = 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 2df4e80018..d99a5b6197 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 @@ -32,6 +32,8 @@ data class SendVenue( val googlePlaceId: GooglePlaceId? = null, @SerialName(googlePlaceTypeField) val googlePlaceType: GooglePlaceType? = null, + @SerialName(messageThreadIdField) + override val threadId: MessageThreadId? = null, @SerialName(disableNotificationField) override val disableNotification: Boolean = false, @SerialName(protectContentField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/abstracts/OptionallyMessageThreadRequest.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/abstracts/OptionallyMessageThreadRequest.kt new file mode 100644 index 0000000000..8fbacbaac9 --- /dev/null +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/abstracts/OptionallyMessageThreadRequest.kt @@ -0,0 +1,7 @@ +package dev.inmo.tgbotapi.requests.send.abstracts + +import dev.inmo.tgbotapi.types.MessageThreadId + +interface OptionallyMessageThreadRequest { + val threadId: MessageThreadId? +} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/abstracts/SendChatMessageRequest.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/abstracts/SendChatMessageRequest.kt index ffc9818312..46c9896d6d 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/abstracts/SendChatMessageRequest.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/abstracts/SendChatMessageRequest.kt @@ -2,5 +2,6 @@ package dev.inmo.tgbotapi.requests.send.abstracts import dev.inmo.tgbotapi.abstracts.types.ChatRequest import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest +import dev.inmo.tgbotapi.types.MessageThreadId interface SendChatMessageRequest : SimpleRequest, ChatRequest 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 27a8a7beb6..b3dbca83a2 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 @@ -2,4 +2,8 @@ package dev.inmo.tgbotapi.requests.send.abstracts import dev.inmo.tgbotapi.abstracts.types.* -interface SendMessageRequest : SendChatMessageRequest, ReplyMessageId, DisableNotification, ProtectContent +interface SendMessageRequest : SendChatMessageRequest, + ReplyMessageId, + DisableNotification, + ProtectContent, + OptionallyMessageThreadRequest 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 0bec6ea1e2..b73451db82 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 @@ -18,6 +18,8 @@ data class SendGame ( override val chatId: ChatIdentifier, @SerialName(gameShortNameField) val gameShortName: String, + @SerialName(messageThreadIdField) + override val threadId: MessageThreadId? = null, @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 f9ceb727f5..b8a93d83fd 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 @@ -25,6 +25,7 @@ fun SendAnimation( thumb: InputFile? = null, text: String? = null, parseMode: ParseMode? = null, + threadId: MessageThreadId? = null, duration: Long? = null, width: Int? = null, height: Int? = null, @@ -46,6 +47,7 @@ fun SendAnimation( text, parseMode, null, + threadId, duration, width, height, @@ -71,6 +73,7 @@ fun SendAnimation( animation: InputFile, thumb: InputFile? = null, entities: TextSourcesList, + threadId: MessageThreadId? = null, duration: Long? = null, width: Int? = null, height: Int? = null, @@ -92,6 +95,7 @@ fun SendAnimation( entities.makeString(), null, entities.toRawMessageEntities(), + threadId, duration, width, height, @@ -129,6 +133,8 @@ data class SendAnimationData internal constructor( override val parseMode: ParseMode? = null, @SerialName(captionEntitiesField) private val rawEntities: List? = null, + @SerialName(messageThreadIdField) + override val threadId: MessageThreadId? = null, @SerialName(durationField) override val duration: Long? = null, @SerialName(widthField) 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 3b438608af..11174163ce 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 @@ -26,6 +26,7 @@ fun SendAudio( thumb: InputFile? = null, text: String? = null, parseMode: ParseMode? = null, + threadId: MessageThreadId? = null, duration: Long? = null, performer: String? = null, title: String? = null, @@ -47,6 +48,7 @@ fun SendAudio( text, parseMode, null, + threadId, duration, performer, title, @@ -72,6 +74,7 @@ fun SendAudio( audio: InputFile, thumb: InputFile? = null, entities: List, + threadId: MessageThreadId? = null, duration: Long? = null, performer: String? = null, title: String? = null, @@ -93,6 +96,7 @@ fun SendAudio( entities.makeString(), null, entities.toRawMessageEntities(), + threadId, duration, performer, title, @@ -130,6 +134,8 @@ data class SendAudioData internal constructor( override val parseMode: ParseMode? = null, @SerialName(captionEntitiesField) private val rawEntities: List? = null, + @SerialName(messageThreadIdField) + override val threadId: MessageThreadId? = null, @SerialName(durationField) override val duration: Long? = null, @SerialName(performerField) 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 8960ac5bb4..977ac85e49 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 @@ -34,6 +34,7 @@ fun SendDocument( thumb: InputFile? = null, text: String? = null, parseMode: ParseMode? = null, + threadId: MessageThreadId? = null, disableNotification: Boolean = false, protectContent: Boolean = false, replyToMessageId: MessageId? = null, @@ -53,6 +54,7 @@ fun SendDocument( text, parseMode, null, + threadId, disableNotification, protectContent, replyToMessageId, @@ -85,6 +87,7 @@ fun SendDocument( document: InputFile, thumb: InputFile? = null, entities: TextSourcesList, + threadId: MessageThreadId? = null, disableNotification: Boolean = false, protectContent: Boolean = false, replyToMessageId: MessageId? = null, @@ -104,6 +107,7 @@ fun SendDocument( entities.makeString(), null, entities.toRawMessageEntities(), + threadId, disableNotification, protectContent, replyToMessageId, @@ -148,6 +152,8 @@ data class SendDocumentData internal constructor( override val parseMode: ParseMode? = null, @SerialName(captionEntitiesField) private val rawEntities: List? = null, + @SerialName(messageThreadIdField) + override val threadId: MessageThreadId? = null, @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 c19ff31c0f..b213fb7aa3 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 @@ -24,6 +24,7 @@ const val rawSendingMediaGroupsWarning = "Media groups contains restrictions rel fun SendMediaGroup( chatId: ChatIdentifier, media: List, + threadId: MessageThreadId? = null, disableNotification: Boolean = false, protectContent: Boolean = false, replyToMessageId: MessageId? = null, @@ -47,6 +48,7 @@ fun SendMediaGroup( val data = SendMediaGroupData( chatId, media, + threadId, disableNotification, protectContent, replyToMessageId, @@ -72,11 +74,12 @@ fun SendMediaGroup( inline fun SendPlaylist( chatId: ChatIdentifier, media: List, + threadId: MessageThreadId? = null, disableNotification: Boolean = false, protectContent: Boolean = false, replyToMessageId: MessageId? = null, allowSendingWithoutReply: Boolean? = null -) = SendMediaGroup(chatId, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply) +) = SendMediaGroup(chatId, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply) /** * Use this method to be sure that you are correctly sending documents media group @@ -87,11 +90,12 @@ inline fun SendPlaylist( inline fun SendDocumentsGroup( chatId: ChatIdentifier, media: List, + threadId: MessageThreadId? = null, disableNotification: Boolean = false, protectContent: Boolean = false, replyToMessageId: MessageId? = null, allowSendingWithoutReply: Boolean? = null -) = SendMediaGroup(chatId, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply) +) = SendMediaGroup(chatId, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply) /** * Use this method to be sure that you are correctly sending visual media group @@ -103,11 +107,12 @@ inline fun SendDocumentsGroup( inline fun SendVisualMediaGroup( chatId: ChatIdentifier, media: List, + threadId: MessageThreadId? = null, disableNotification: Boolean = false, protectContent: Boolean = false, replyToMessageId: MessageId? = null, allowSendingWithoutReply: Boolean? = null -) = SendMediaGroup(chatId, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply) +) = SendMediaGroup(chatId, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply) private val messagesListSerializer: KSerializer>> = ListSerializer(TelegramBotAPIMessageDeserializeOnlySerializerClass()) @@ -117,6 +122,8 @@ data class SendMediaGroupData internal constructor( @SerialName(chatIdField) override val chatId: ChatIdentifier, val media: List = emptyList(), + @SerialName(messageThreadIdField) + override val threadId: MessageThreadId? = null, @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 3c99d91311..6a65961780 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 @@ -23,6 +23,7 @@ fun SendPhoto( photo: InputFile, text: String? = null, parseMode: ParseMode? = null, + threadId: MessageThreadId? = null, disableNotification: Boolean = false, protectContent: Boolean = false, replyToMessageId: MessageId? = null, @@ -35,6 +36,7 @@ fun SendPhoto( text, parseMode, null, + threadId, disableNotification, protectContent, replyToMessageId, @@ -53,6 +55,7 @@ fun SendPhoto( chatId: ChatIdentifier, photo: InputFile, entities: TextSourcesList, + threadId: MessageThreadId? = null, disableNotification: Boolean = false, protectContent: Boolean = false, replyToMessageId: MessageId? = null, @@ -65,6 +68,7 @@ fun SendPhoto( entities.makeString(), null, entities.toRawMessageEntities(), + threadId, disableNotification, protectContent, replyToMessageId, @@ -94,6 +98,8 @@ data class SendPhotoData internal constructor( override val parseMode: ParseMode? = null, @SerialName(captionEntitiesField) private val rawEntities: List? = null, + @SerialName(messageThreadIdField) + override val threadId: MessageThreadId? = null, @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 44ed930193..a29ccb529b 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 @@ -15,6 +15,7 @@ import kotlinx.serialization.json.JsonObject fun SendSticker( chatId: ChatIdentifier, sticker: InputFile, + threadId: MessageThreadId? = null, disableNotification: Boolean = false, protectContent: Boolean = false, replyToMessageId: MessageId? = null, @@ -23,6 +24,7 @@ fun SendSticker( ): Request> = SendStickerByFileId( chatId, sticker as? FileId, + threadId, disableNotification, protectContent, replyToMessageId, @@ -44,6 +46,8 @@ data class SendStickerByFileId internal constructor( override val chatId: ChatIdentifier, @SerialName(stickerField) val sticker: FileId? = null, + @SerialName(messageThreadIdField) + override val threadId: MessageThreadId? = null, @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 88c0a12655..3e455de454 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 @@ -25,6 +25,7 @@ fun SendVideo( thumb: InputFile? = null, text: String? = null, parseMode: ParseMode? = null, + threadId: MessageThreadId? = null, duration: Long? = null, width: Int? = null, height: Int? = null, @@ -47,6 +48,7 @@ fun SendVideo( text, parseMode, null, + threadId, duration, width, height, @@ -73,6 +75,7 @@ fun SendVideo( video: InputFile, thumb: InputFile? = null, entities: TextSourcesList, + threadId: MessageThreadId? = null, duration: Long? = null, width: Int? = null, height: Int? = null, @@ -95,6 +98,7 @@ fun SendVideo( entities.makeString(), null, entities.toRawMessageEntities(), + threadId, duration, width, height, @@ -133,6 +137,8 @@ data class SendVideoData internal constructor( override val parseMode: ParseMode? = null, @SerialName(captionEntitiesField) private val rawEntities: List? = null, + @SerialName(messageThreadIdField) + override val threadId: MessageThreadId? = null, @SerialName(durationField) override val duration: Long? = null, @SerialName(widthField) 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 5e69d17ecf..d23c498bd2 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 @@ -14,6 +14,7 @@ import kotlinx.serialization.* fun SendVideoNote( chatId: ChatIdentifier, videoNote: InputFile, + threadId: MessageThreadId? = null, thumb: InputFile? = null, duration: Long? = null, size: Int? = null, // in documentation - length (size of video side) @@ -31,6 +32,7 @@ fun SendVideoNote( val data = SendVideoNoteData( chatId, videoNoteAsFileId, + threadId, thumbAsFileId, duration, size, @@ -60,6 +62,8 @@ data class SendVideoNoteData internal constructor( override val chatId: ChatIdentifier, @SerialName(videoNoteField) val videoNote: String? = null, + @SerialName(messageThreadIdField) + override val threadId: MessageThreadId? = null, @SerialName(thumbField) override val thumb: String? = null, @SerialName(durationField) 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 216d854594..c403e30e36 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 @@ -24,6 +24,7 @@ fun SendVoice( voice: InputFile, text: String? = null, parseMode: ParseMode? = null, + threadId: MessageThreadId? = null, duration: Long? = null, disableNotification: Boolean = false, protectContent: Boolean = false, @@ -40,6 +41,7 @@ fun SendVoice( text, parseMode, null, + threadId, duration, disableNotification, protectContent, @@ -62,6 +64,7 @@ fun SendVoice( chatId: ChatIdentifier, voice: InputFile, entities: TextSourcesList, + threadId: MessageThreadId? = null, duration: Long? = null, disableNotification: Boolean = false, protectContent: Boolean = false, @@ -78,6 +81,7 @@ fun SendVoice( entities.makeString(), null, entities.toRawMessageEntities(), + threadId, duration, disableNotification, protectContent, @@ -111,6 +115,8 @@ data class SendVoiceData internal constructor( override val parseMode: ParseMode? = null, @SerialName(captionEntitiesField) private val rawEntities: List? = null, + @SerialName(messageThreadIdField) + override val threadId: MessageThreadId? = null, @SerialName(durationField) override val duration: Long? = null, @SerialName(disableNotificationField) 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 aace9e8806..89bede996a 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 @@ -36,6 +36,8 @@ data class SendInvoice( @Serializable(LabeledPricesSerializer::class) @SerialName(pricesField) override val prices: List, + @SerialName(messageThreadIdField) + override val threadId: MessageThreadId? = null, @SerialName(maxTipAmountField) override val maxTipAmount: Int? = null, @SerialName(suggestedTipAmountsField) 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 dd9d3a1e31..6b4ab9092f 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 @@ -46,6 +46,7 @@ fun SendPoll( chatId: ChatIdentifier, question: String, options: List, + threadId: MessageThreadId? = null, isAnonymous: Boolean = true, isClosed: Boolean = false, disableNotification: Boolean = false, @@ -57,6 +58,7 @@ fun SendPoll( chatId, question, options, + threadId, isAnonymous, isClosed, allowSendingWithoutReply = allowSendingWithoutReply, @@ -71,6 +73,7 @@ fun SendPoll( */ fun Poll.createRequest( chatId: ChatIdentifier, + threadId: MessageThreadId? = null, disableNotification: Boolean = false, protectContent: Boolean = false, replyToMessageId: MessageId? = null, @@ -81,6 +84,7 @@ fun Poll.createRequest( chatId, question, options.map { it.text }, + threadId, isAnonymous, isClosed, allowMultipleAnswers, @@ -97,6 +101,7 @@ fun Poll.createRequest( question, options.map { it.text }, correctOptionId, + threadId, isAnonymous, isClosed, textSources, @@ -111,6 +116,7 @@ fun Poll.createRequest( chatId, question, options.map { it.text }, + threadId, isAnonymous, isClosed, false, @@ -125,6 +131,7 @@ fun Poll.createRequest( chatId, question, options.map { it.text }, + threadId, isAnonymous, isClosed, false, @@ -183,6 +190,8 @@ data class SendRegularPoll( override val question: String, @SerialName(optionsField) override val options: List, + @SerialName(messageThreadIdField) + override val threadId: MessageThreadId? = null, @SerialName(isAnonymousField) override val isAnonymous: Boolean = true, @SerialName(isClosedField) @@ -218,6 +227,7 @@ fun SendRegularPoll( chatId: ChatIdentifier, question: String, options: List, + threadId: MessageThreadId? = null, isAnonymous: Boolean = true, isClosed: Boolean = false, allowMultipleAnswers: Boolean = false, @@ -231,6 +241,7 @@ fun SendRegularPoll( chatId, question, options, + threadId, isAnonymous, isClosed, allowMultipleAnswers, @@ -248,6 +259,7 @@ fun SendQuizPoll( question: String, options: List, correctOptionId: Int, + threadId: MessageThreadId? = null, isAnonymous: Boolean = true, isClosed: Boolean = false, explanation: String? = null, @@ -263,6 +275,7 @@ fun SendQuizPoll( question, options, correctOptionId, + threadId, isAnonymous, isClosed, explanation, @@ -281,6 +294,7 @@ fun SendQuizPoll( question: String, options: List, correctOptionId: Int, + threadId: MessageThreadId? = null, isAnonymous: Boolean = true, isClosed: Boolean = false, entities: List, @@ -295,6 +309,7 @@ fun SendQuizPoll( question, options, correctOptionId, + threadId, isAnonymous, isClosed, entities.makeString(), @@ -313,6 +328,7 @@ internal fun SendQuizPoll( question: String, options: List, correctOptionId: Int, + threadId: MessageThreadId? = null, isAnonymous: Boolean = true, isClosed: Boolean = false, explanation: String? = null, @@ -329,6 +345,7 @@ internal fun SendQuizPoll( question, options, correctOptionId, + threadId, isAnonymous, isClosed, explanation, @@ -353,6 +370,8 @@ data class SendQuizPoll internal constructor( override val options: List, @SerialName(correctOptionIdField) val correctOptionId: Int, + @SerialName(messageThreadIdField) + override val threadId: MessageThreadId? = null, @SerialName(isAnonymousField) override val isAnonymous: Boolean = true, @SerialName(isClosedField)