From d55253a81b98c281aa3274146e9e332033338765 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Mon, 8 Jan 2024 15:02:39 +0600 Subject: [PATCH] improvements in replies --- .../tgbotapi/extensions/api/send/Replies.kt | 342 ++++++++++--- .../api/send/RepliesWithChatsAndMessages.kt | 456 ++++++++++-------- 2 files changed, 524 insertions(+), 274 deletions(-) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/Replies.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/Replies.kt index cb05bb8b98..a05460af2c 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/Replies.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/Replies.kt @@ -47,16 +47,18 @@ suspend inline fun TelegramBot.reply( phoneNumber: String, firstName: String, lastName: String? = null, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null ) = sendContact( - to.chat, + replyInChat, phoneNumber, firstName, lastName, - to.threadIdOrNull, + replyInThreadId, disableNotification, protectContent, ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply), @@ -70,14 +72,16 @@ suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply( to: AccessibleMessage, contact: Contact, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null ) = sendContact( - to.chat, + replyInChat, contact, - to.threadIdOrNull, + replyInThreadId, disableNotification, protectContent, ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply), @@ -94,11 +98,13 @@ suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.replyWithDice( to: AccessibleMessage, animationType: DiceAnimationType? = null, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendDice(to.chat, animationType, to.threadIdOrNull, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendDice(replyInChat, animationType, replyInThreadId, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) /** * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or @@ -107,11 +113,13 @@ suspend inline fun TelegramBot.replyWithDice( suspend inline fun TelegramBot.reply( to: AccessibleMessage, animationType: DiceAnimationType, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = replyWithDice(to, animationType, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup) +) = replyWithDice(to, animationType, replyInChat, replyInThreadId, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup) // Location @@ -124,15 +132,17 @@ suspend inline fun TelegramBot.reply( to: AccessibleMessage, latitude: Double, longitude: Double, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null ) = sendLocation( - to.chat, + replyInChat, latitude, longitude, - to.threadIdOrNull, + replyInThreadId, disableNotification, protectContent, replyParameters = ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply), @@ -146,14 +156,16 @@ suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply( to: AccessibleMessage, location: StaticLocation, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null ) = sendLocation( - to.chat, + replyInChat, location, - to.threadIdOrNull, + replyInThreadId, disableNotification, protectContent, replyParameters = ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply), @@ -172,16 +184,18 @@ suspend inline fun TelegramBot.reply( text: String, parseMode: ParseMode? = null, linkPreviewOptions: LinkPreviewOptions? = null, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null ) = sendTextMessage( - to.chat, + replyInChat, text, parseMode, linkPreviewOptions, - to.threadIdOrNull, + replyInThreadId, disableNotification, protectContent, ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply), @@ -196,15 +210,17 @@ suspend inline fun TelegramBot.reply( to: AccessibleMessage, entities: TextSourcesList, linkPreviewOptions: LinkPreviewOptions? = null, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null ) = sendTextMessage( - to.chat, + replyInChat, entities, linkPreviewOptions, - to.threadIdOrNull, + replyInThreadId, disableNotification, protectContent, ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply), @@ -219,12 +235,14 @@ suspend fun TelegramBot.reply( to: AccessibleMessage, separator: TextSource? = null, linkPreviewOptions: LinkPreviewOptions? = null, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null, builderBody: EntitiesBuilderBody -) = reply(to, buildEntities(separator, builderBody), linkPreviewOptions, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup) +) = reply(to, buildEntities(separator, builderBody), linkPreviewOptions, replyInChat, replyInThreadId, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup) /** * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] @@ -234,12 +252,14 @@ suspend fun TelegramBot.reply( to: AccessibleMessage, separator: String, linkPreviewOptions: LinkPreviewOptions? = null, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null, builderBody: EntitiesBuilderBody -) = reply(to, buildEntities(separator, builderBody), linkPreviewOptions, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup) +) = reply(to, buildEntities(separator, builderBody), linkPreviewOptions, replyInChat, replyInThreadId, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup) // Venue @@ -258,12 +278,14 @@ suspend inline fun TelegramBot.reply( foursquareType: FoursquareType? = null, googlePlaceId: GooglePlaceId? = null, googlePlaceType: GooglePlaceType? = null, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null ) = sendVenue( - chat = to.chat, + chatId = replyInChat, latitude = latitude, longitude = longitude, title = title, @@ -272,7 +294,7 @@ suspend inline fun TelegramBot.reply( foursquareType = foursquareType, googlePlaceId = googlePlaceId, googlePlaceType = googlePlaceType, - threadId = to.threadIdOrNull, + threadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, replyParameters = ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), @@ -288,12 +310,14 @@ suspend inline fun TelegramBot.reply( foursquareType: FoursquareType? = null, googlePlaceId: GooglePlaceId? = null, googlePlaceType: GooglePlaceType? = null, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null ) = sendVenue( - chat = to.chat, + chatId = replyInChat, latitude = location.latitude, longitude = location.longitude, title = title, @@ -302,7 +326,7 @@ suspend inline fun TelegramBot.reply( foursquareType = foursquareType, googlePlaceId = googlePlaceId, googlePlaceType = googlePlaceType, - threadId = to.threadIdOrNull, + threadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, replyParameters = ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), @@ -312,14 +336,16 @@ suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply( to: AccessibleMessage, venue: Venue, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null ) = sendVenue( - chat = to.chat, + chatId = replyInChat, venue = venue, - threadId = to.threadIdOrNull, + threadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, replyParameters = ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), @@ -332,33 +358,39 @@ suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.replyWithGame( to: AccessibleMessage, gameShortName: String, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null ) = sendGame( - to.chat, gameShortName, to.threadIdOrNull, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup + replyInChat, gameShortName, replyInThreadId, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup ) suspend inline fun TelegramBot.replyWithGame( to: AccessibleMessage, game: Game, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null ) = sendGame( - to.chat, game.title, to.threadIdOrNull, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup + replyInChat, game.title, replyInThreadId, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup ) suspend inline fun TelegramBot.reply( to: AccessibleMessage, game: Game, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = replyWithGame(to, game, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup) +) = replyWithGame(to, game, replyInChat, replyInThreadId, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup) // Animation @@ -373,12 +405,14 @@ suspend inline fun TelegramBot.replyWithAnimation( duration: Long? = null, width: Int? = null, height: Int? = null, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null ) = sendAnimation( - to.chat, + replyInChat, animation, thumb, text, @@ -387,7 +421,7 @@ suspend inline fun TelegramBot.replyWithAnimation( duration, width, height, - to.threadIdOrNull, + replyInThreadId, disableNotification, protectContent, ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply), @@ -403,11 +437,13 @@ suspend inline fun TelegramBot.reply( duration: Long? = null, width: Int? = null, height: Int? = null, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendAnimation(to.chat, animation, text, parseMode, spoilered, duration, width, height, to.threadIdOrNull, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendAnimation(replyInChat, animation, text, parseMode, spoilered, duration, width, height, replyInThreadId, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) suspend inline fun TelegramBot.replyWithAnimation( to: AccessibleMessage, @@ -418,12 +454,14 @@ suspend inline fun TelegramBot.replyWithAnimation( duration: Long? = null, width: Int? = null, height: Int? = null, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null ) = sendAnimation( - to.chat, + replyInChat, animation, thumb, entities, @@ -431,7 +469,7 @@ suspend inline fun TelegramBot.replyWithAnimation( duration, width, height, - to.threadIdOrNull, + replyInThreadId, disableNotification, protectContent, ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply), @@ -446,11 +484,13 @@ suspend inline fun TelegramBot.reply( duration: Long? = null, width: Int? = null, height: Int? = null, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendAnimation(to.chat, animation, entities, spoilered, duration, width, height, to.threadIdOrNull, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendAnimation(replyInChat, animation, entities, spoilered, duration, width, height, replyInThreadId, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) // Audio @@ -464,11 +504,13 @@ suspend inline fun TelegramBot.replyWithAudio( duration: Long? = null, performer: String? = null, title: String? = null, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendAudio(to.chat, audio, thumb, text, parseMode, duration, performer, title, to.threadIdOrNull, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendAudio(replyInChat, audio, thumb, text, parseMode, duration, performer, title, replyInThreadId, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) suspend inline fun TelegramBot.reply( to: AccessibleMessage, @@ -476,11 +518,13 @@ suspend inline fun TelegramBot.reply( text: String? = null, parseMode: ParseMode? = null, title: String? = null, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendAudio(to.chat, audio, text, parseMode, title, to.threadIdOrNull, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendAudio(replyInChat, audio, text, parseMode, title, replyInThreadId, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) suspend inline fun TelegramBot.replyWithAudio( to: AccessibleMessage, @@ -490,22 +534,26 @@ suspend inline fun TelegramBot.replyWithAudio( duration: Long? = null, performer: String? = null, title: String? = null, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendAudio(to.chat, audio, thumb, entities, duration, performer, title, to.threadIdOrNull, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendAudio(replyInChat, audio, thumb, entities, duration, performer, title, replyInThreadId, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) suspend inline fun TelegramBot.reply( to: AccessibleMessage, audio: AudioFile, entities: TextSourcesList, title: String? = null, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendAudio(to.chat, audio, entities, title, to.threadIdOrNull, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendAudio(replyInChat, audio, entities, title, replyInThreadId, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) // Documents @@ -516,47 +564,55 @@ suspend inline fun TelegramBot.replyWithDocument( thumb: InputFile? = null, text: String? = null, parseMode: ParseMode? = null, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null, disableContentTypeDetection: Boolean? = null -) = sendDocument(to.chat, document, thumb, text, parseMode, to.threadIdOrNull, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup, disableContentTypeDetection) +) = sendDocument(replyInChat, document, thumb, text, parseMode, replyInThreadId, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup, disableContentTypeDetection) suspend inline fun TelegramBot.reply( to: AccessibleMessage, document: DocumentFile, text: String? = null, parseMode: ParseMode? = null, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null, disableContentTypeDetection: Boolean? = null -) = sendDocument(to.chat, document, text, parseMode, to.threadIdOrNull, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup, disableContentTypeDetection) +) = sendDocument(replyInChat, document, text, parseMode, replyInThreadId, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup, disableContentTypeDetection) suspend inline fun TelegramBot.replyWithDocument( to: AccessibleMessage, document: InputFile, thumb: InputFile? = null, entities: TextSourcesList, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null, disableContentTypeDetection: Boolean? = null -) = sendDocument(to.chat, document, thumb, entities, to.threadIdOrNull, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup, disableContentTypeDetection) +) = sendDocument(replyInChat, document, thumb, entities, replyInThreadId, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup, disableContentTypeDetection) suspend inline fun TelegramBot.reply( to: AccessibleMessage, document: DocumentFile, entities: TextSourcesList, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null, disableContentTypeDetection: Boolean? = null -) = sendDocument(to.chat, document, entities, to.threadIdOrNull, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup, disableContentTypeDetection) +) = sendDocument(replyInChat, document, entities, replyInThreadId, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup, disableContentTypeDetection) // Media Group @@ -565,34 +621,42 @@ suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.replyWithMediaGroup( to: AccessibleMessage, media: List, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null -) = sendMediaGroup(to.chat, media, to.threadIdOrNull, disableNotification, protectContent, replyParameters = ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply)) +) = sendMediaGroup(replyInChat, media, replyInThreadId, disableNotification, protectContent, replyParameters = ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply)) suspend inline fun TelegramBot.replyWithPlaylist( to: AccessibleMessage, media: List, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null -) = sendPlaylist(to.chat, media, to.threadIdOrNull, disableNotification, protectContent, replyParameters = ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply)) +) = sendPlaylist(replyInChat, media, replyInThreadId, disableNotification, protectContent, replyParameters = ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply)) suspend inline fun TelegramBot.replyWithDocuments( to: AccessibleMessage, media: List, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null -) = sendDocumentsGroup(to.chat, media, to.threadIdOrNull, disableNotification, protectContent, replyParameters = ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply)) +) = sendDocumentsGroup(replyInChat, media, replyInThreadId, disableNotification, protectContent, replyParameters = ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply)) suspend inline fun TelegramBot.replyWithGallery( to: AccessibleMessage, media: List, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null -) = sendVisualMediaGroup(to.chat, media, to.threadIdOrNull, disableNotification, protectContent, replyParameters = ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply)) +) = sendVisualMediaGroup(replyInChat, media, replyInThreadId, disableNotification, protectContent, replyParameters = ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply)) // Photo @@ -603,11 +667,13 @@ suspend inline fun TelegramBot.replyWithPhoto( text: String? = null, parseMode: ParseMode? = null, spoilered: Boolean = false, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendPhoto(to.chat, fileId, text, parseMode, spoilered, to.threadIdOrNull, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendPhoto(replyInChat, fileId, text, parseMode, spoilered, replyInThreadId, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) suspend inline fun TelegramBot.reply( to: AccessibleMessage, @@ -615,11 +681,13 @@ suspend inline fun TelegramBot.reply( text: String? = null, parseMode: ParseMode? = null, spoilered: Boolean = false, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendPhoto(to.chat, photo, text, parseMode, spoilered, to.threadIdOrNull, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendPhoto(replyInChat, photo, text, parseMode, spoilered, replyInThreadId, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) suspend inline fun TelegramBot.reply( to: AccessibleMessage, @@ -627,11 +695,13 @@ suspend inline fun TelegramBot.reply( text: String? = null, parseMode: ParseMode? = null, spoilered: Boolean = false, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendPhoto(to.chat, photoSize, text, parseMode, spoilered, to.threadIdOrNull, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendPhoto(replyInChat, photoSize, text, parseMode, spoilered, replyInThreadId, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) suspend inline fun TelegramBot.replyWithPhoto( @@ -639,33 +709,39 @@ suspend inline fun TelegramBot.replyWithPhoto( fileId: InputFile, entities: TextSourcesList, spoilered: Boolean = false, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendPhoto(to.chat, fileId, entities, spoilered, to.threadIdOrNull, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendPhoto(replyInChat, fileId, entities, spoilered, replyInThreadId, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) suspend inline fun TelegramBot.reply( to: AccessibleMessage, photo: Photo, entities: TextSourcesList, spoilered: Boolean = false, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendPhoto(to.chat, photo, entities, spoilered, to.threadIdOrNull, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendPhoto(replyInChat, photo, entities, spoilered, replyInThreadId, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) suspend inline fun TelegramBot.reply( to: AccessibleMessage, photoSize: PhotoSize, entities: TextSourcesList, spoilered: Boolean = false, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendPhoto(to.chat, photoSize, entities, spoilered, to.threadIdOrNull, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendPhoto(replyInChat, photoSize, entities, spoilered, replyInThreadId, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) // Sticker @@ -674,21 +750,25 @@ suspend inline fun TelegramBot.replyWithSticker( to: AccessibleMessage, sticker: InputFile, emoji: String? = null, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendSticker(to.chat, sticker, to.threadIdOrNull, emoji, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendSticker(replyInChat, sticker, replyInThreadId, emoji, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) suspend inline fun TelegramBot.reply( to: AccessibleMessage, sticker: Sticker, emoji: String? = null, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendSticker(to.chat, sticker, to.threadIdOrNull, emoji, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendSticker(replyInChat, sticker, replyInThreadId, emoji, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) // Videos @@ -703,11 +783,13 @@ suspend inline fun TelegramBot.replyWithVideo( duration: Long? = null, width: Int? = null, height: Int? = null, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendVideo(to.chat, video, thumb, text, parseMode, spoilered, duration, width, height, to.threadIdOrNull, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendVideo(replyInChat, video, thumb, text, parseMode, spoilered, duration, width, height, replyInThreadId, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) suspend inline fun TelegramBot.reply( to: AccessibleMessage, @@ -715,11 +797,13 @@ suspend inline fun TelegramBot.reply( text: String? = null, parseMode: ParseMode? = null, spoilered: Boolean = false, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendVideo(to.chat, video, text, parseMode, spoilered, to.threadIdOrNull, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendVideo(replyInChat, video, text, parseMode, spoilered, replyInThreadId, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) suspend inline fun TelegramBot.replyWithVideo( to: AccessibleMessage, @@ -730,22 +814,26 @@ suspend inline fun TelegramBot.replyWithVideo( duration: Long? = null, width: Int? = null, height: Int? = null, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendVideo(to.chat, video, thumb, entities, spoilered, duration, width, height, to.threadIdOrNull, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendVideo(replyInChat, video, thumb, entities, spoilered, duration, width, height, replyInThreadId, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) suspend inline fun TelegramBot.reply( to: AccessibleMessage, video: VideoFile, entities: TextSourcesList, spoilered: Boolean = false, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendVideo(to.chat, video, entities, spoilered, to.threadIdOrNull, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true), replyMarkup) +) = sendVideo(replyInChat, video, entities, spoilered, replyInThreadId, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true), replyMarkup) // VideoNotes @@ -756,20 +844,24 @@ suspend inline fun TelegramBot.replyWithVideoNote( thumb: InputFile? = null, duration: Long? = null, size: Int? = null, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendVideoNote(to.chat, videoNote, thumb, duration, size, to.threadIdOrNull, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true), replyMarkup) +) = sendVideoNote(replyInChat, videoNote, thumb, duration, size, replyInThreadId, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true), replyMarkup) suspend inline fun TelegramBot.reply( to: AccessibleMessage, videoNote: VideoNoteFile, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendVideoNote(to.chat, videoNote, to.threadIdOrNull, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true), replyMarkup) +) = sendVideoNote(replyInChat, videoNote, replyInThreadId, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true), replyMarkup) // Voice @@ -780,22 +872,26 @@ suspend inline fun TelegramBot.replyWithVoice( text: String? = null, parseMode: ParseMode? = null, duration: Long? = null, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendVoice(to.chat, voice, text, parseMode, duration, to.threadIdOrNull, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true), replyMarkup) +) = sendVoice(replyInChat, voice, text, parseMode, duration, replyInThreadId, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true), replyMarkup) suspend inline fun TelegramBot.reply( to: AccessibleMessage, voice: VoiceFile, text: String? = null, parseMode: ParseMode? = null, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendVoice(to.chat, voice, text, parseMode, to.threadIdOrNull, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true), replyMarkup) +) = sendVoice(replyInChat, voice, text, parseMode, replyInThreadId, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true), replyMarkup) suspend inline fun TelegramBot.replyWithVoice( @@ -803,21 +899,25 @@ suspend inline fun TelegramBot.replyWithVoice( voice: InputFile, entities: TextSourcesList, duration: Long? = null, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendVoice(to.chat, voice, entities, duration, to.threadIdOrNull, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true), replyMarkup) +) = sendVoice(replyInChat, voice, entities, duration, replyInThreadId, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true), replyMarkup) suspend inline fun TelegramBot.reply( to: AccessibleMessage, voice: VoiceFile, entities: TextSourcesList, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendVoice(to.chat, voice, entities, to.threadIdOrNull, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true), replyMarkup) +) = sendVoice(replyInChat, voice, entities, replyInThreadId, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true), replyMarkup) // Invoice @@ -845,11 +945,13 @@ suspend inline fun TelegramBot.reply( shouldSendPhoneNumberToProvider: Boolean = false, shouldSendEmailToProvider: Boolean = false, priceDependOnShipAddress: Boolean = false, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: InlineKeyboardMarkup? = null -) = sendInvoice(to.chat.id, title, description, payload, providerToken, currency, prices, maxTipAmount, suggestedTipAmounts, startParameter, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, to.threadIdOrNull, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true), replyMarkup) +) = sendInvoice(replyInChat, title, description, payload, providerToken, currency, prices, maxTipAmount, suggestedTipAmounts, startParameter, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, replyInThreadId, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true), replyMarkup) // Polls @@ -862,11 +964,13 @@ suspend inline fun TelegramBot.reply( isClosed: Boolean = false, allowMultipleAnswers: Boolean = false, closeInfo: ScheduledCloseInfo? = null, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendRegularPoll(to.chat, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, to.threadIdOrNull, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true), replyMarkup) +) = sendRegularPoll(replyInChat, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, replyInThreadId, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true), replyMarkup) suspend inline fun TelegramBot.reply( to: AccessibleMessage, @@ -877,11 +981,13 @@ suspend inline fun TelegramBot.reply( isAnonymous: Boolean = poll.isAnonymous, allowMultipleAnswers: Boolean = poll.allowMultipleAnswers, closeInfo: ScheduledCloseInfo? = null, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendRegularPoll(to.chat, poll, isClosed, question, options, isAnonymous, allowMultipleAnswers, closeInfo, to.threadIdOrNull, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true), replyMarkup) +) = sendRegularPoll(replyInChat, poll, isClosed, question, options, isAnonymous, allowMultipleAnswers, closeInfo, replyInThreadId, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true), replyMarkup) suspend inline fun TelegramBot.reply( to: AccessibleMessage, @@ -893,11 +999,13 @@ suspend inline fun TelegramBot.reply( explanation: String? = null, parseMode: ParseMode? = null, closeInfo: ScheduledCloseInfo? = null, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendQuizPoll(to.chat, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, to.threadIdOrNull, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true), replyMarkup) +) = sendQuizPoll(replyInChat, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, replyInThreadId, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true), replyMarkup) suspend inline fun TelegramBot.reply( to: AccessibleMessage, @@ -910,11 +1018,13 @@ suspend inline fun TelegramBot.reply( explanation: String? = null, parseMode: ParseMode? = null, closeInfo: ScheduledCloseInfo? = null, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendQuizPoll(to.chat, isClosed, quizPoll, question, options, correctOptionId, isAnonymous, explanation, parseMode, closeInfo, to.threadIdOrNull, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true), replyMarkup) +) = sendQuizPoll(replyInChat, isClosed, quizPoll, question, options, correctOptionId, isAnonymous, explanation, parseMode, closeInfo, replyInThreadId, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true), replyMarkup) suspend inline fun TelegramBot.reply( to: AccessibleMessage, @@ -925,11 +1035,13 @@ suspend inline fun TelegramBot.reply( isAnonymous: Boolean = true, isClosed: Boolean = false, closeInfo: ScheduledCloseInfo? = null, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendQuizPoll(to.chat, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, to.threadIdOrNull, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true), replyMarkup) +) = sendQuizPoll(replyInChat, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, replyInThreadId, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true), replyMarkup) suspend inline fun TelegramBot.reply( to: AccessibleMessage, @@ -941,11 +1053,13 @@ suspend inline fun TelegramBot.reply( correctOptionId: Int = quizPoll.correctOptionId ?: error("Correct option ID must be provided by income QuizPoll or by developer"), isAnonymous: Boolean = quizPoll.isAnonymous, closeInfo: ScheduledCloseInfo? = null, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendQuizPoll(to.chat, isClosed, quizPoll, question, options, correctOptionId, isAnonymous, entities, closeInfo, to.threadIdOrNull, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true), replyMarkup) +) = sendQuizPoll(replyInChat, isClosed, quizPoll, question, options, correctOptionId, isAnonymous, entities, closeInfo, replyInThreadId, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true), replyMarkup) suspend inline fun TelegramBot.reply( @@ -956,6 +1070,8 @@ suspend inline fun TelegramBot.reply( options: List = poll.options.map { it.text }, isAnonymous: Boolean = poll.isAnonymous, closeInfo: ScheduledCloseInfo? = null, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, @@ -970,6 +1086,8 @@ suspend inline fun TelegramBot.reply( isAnonymous = isAnonymous, allowMultipleAnswers = isAnonymous, closeInfo = closeInfo, + replyInChat = replyInChat, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, @@ -985,6 +1103,8 @@ suspend inline fun TelegramBot.reply( options = options, isAnonymous = isAnonymous, closeInfo = closeInfo, + replyInChat = replyInChat, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, @@ -999,17 +1119,19 @@ suspend inline fun TelegramBot.reply( messageId: MessageId, text: String? = null, parseMode: ParseMode? = null, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null ) = copyMessage( - to.chat.id, + replyInChat, fromChatId, messageId, text, parseMode, - to.threadIdOrNull, + replyInThreadId, disableNotification, protectContent, ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply == true), @@ -1022,34 +1144,40 @@ suspend inline fun TelegramBot.reply( messageId: MessageId, text: String? = null, parseMode: ParseMode? = null, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = reply(to, fromChat.id, messageId, text, parseMode, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup) +) = reply(to, fromChat.id, messageId, text, parseMode, replyInChat, replyInThreadId, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup) suspend inline fun TelegramBot.reply( to: AccessibleMessage, copy: AccessibleMessage, text: String? = null, parseMode: ParseMode? = null, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = reply(to, copy.chat.id, copy.messageId, text, parseMode, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup) +) = reply(to, copy.chat.id, copy.messageId, text, parseMode, replyInChat, replyInThreadId, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup) suspend fun TelegramBot.reply( to: AccessibleMessage, content: MessageContent, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null ): AccessibleMessage = execute( content.createResend( - to.chat.id, - to.threadIdOrNull, + replyInChat, + replyInThreadId, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true), @@ -1066,14 +1194,16 @@ suspend fun TelegramBot.reply( to: AccessibleMessage, locationsFlow: Flow, liveTimeMillis: Long = defaultLivePeriodDelayMillis, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null ) = handleLiveLocation( - to.chat.id, + replyInChat, locationsFlow, liveTimeMillis, - to.threadIdOrNull, + replyInThreadId, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true) @@ -1090,15 +1220,17 @@ suspend fun TelegramBot.reply( to: AccessibleMessage, locationsFlow: Flow, liveTimeMillis: Long = defaultLivePeriodDelayMillis, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null ) { handleLiveLocation( - to.chat.id, + replyInChat, locationsFlow, liveTimeMillis, - to.threadIdOrNull, + replyInThreadId, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true) @@ -1116,15 +1248,17 @@ suspend fun TelegramBot.reply( to: AccessibleMessage, locationsFlow: Flow>, liveTimeMillis: Long = defaultLivePeriodDelayMillis, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null ) { handleLiveLocation( - to.chat.id, + replyInChat, locationsFlow, liveTimeMillis, - to.threadIdOrNull, + replyInThreadId, disableNotification, protectContent, ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true) @@ -1134,6 +1268,8 @@ suspend fun TelegramBot.reply( suspend fun TelegramBot.reply( to: AccessibleMessage, mediaFile: TelegramMediaFile, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, @@ -1143,6 +1279,8 @@ suspend fun TelegramBot.reply( is AudioFile -> reply( to = to, audio = mediaFile, + replyInChat = replyInChat, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, @@ -1151,6 +1289,8 @@ suspend fun TelegramBot.reply( is AnimationFile -> reply( to = to, animation = mediaFile, + replyInChat = replyInChat, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, @@ -1159,6 +1299,8 @@ suspend fun TelegramBot.reply( is VoiceFile -> reply( to = to, voice = mediaFile, + replyInChat = replyInChat, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, @@ -1167,6 +1309,8 @@ suspend fun TelegramBot.reply( is VideoFile -> reply( to = to, video = mediaFile, + replyInChat = replyInChat, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, @@ -1175,6 +1319,8 @@ suspend fun TelegramBot.reply( is VideoNoteFile -> reply( to = to, videoNote = mediaFile, + replyInChat = replyInChat, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, @@ -1183,6 +1329,8 @@ suspend fun TelegramBot.reply( is DocumentFile -> reply( to = to, document = mediaFile, + replyInChat = replyInChat, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, @@ -1191,6 +1339,8 @@ suspend fun TelegramBot.reply( is Sticker -> reply( to = to, sticker = mediaFile, + replyInChat = replyInChat, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, @@ -1199,6 +1349,8 @@ suspend fun TelegramBot.reply( is PhotoSize -> reply( to = to, photoSize = mediaFile, + replyInChat = replyInChat, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, @@ -1207,6 +1359,8 @@ suspend fun TelegramBot.reply( else -> reply( to = to, document = mediaFile.asDocumentFile(), + replyInChat = replyInChat, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, @@ -1220,6 +1374,8 @@ suspend fun TelegramBot.reply( content: TextedMediaContent, text: String?, parseMode: ParseMode? = null, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, @@ -1231,6 +1387,8 @@ suspend fun TelegramBot.reply( voice = content.media, text = text, parseMode = parseMode, + replyInChat = replyInChat, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, @@ -1241,6 +1399,8 @@ suspend fun TelegramBot.reply( audio = content.media, text = text, parseMode = parseMode, + replyInChat = replyInChat, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, @@ -1251,6 +1411,8 @@ suspend fun TelegramBot.reply( photoSize = content.media, text = text, parseMode = parseMode, + replyInChat = replyInChat, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, @@ -1261,6 +1423,8 @@ suspend fun TelegramBot.reply( video = content.media, text = text, parseMode = parseMode, + replyInChat = replyInChat, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, @@ -1271,6 +1435,8 @@ suspend fun TelegramBot.reply( animation = content.media, text = text, parseMode = parseMode, + replyInChat = replyInChat, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, @@ -1281,6 +1447,8 @@ suspend fun TelegramBot.reply( document = content.media.asDocumentFile(), text = text, parseMode = parseMode, + replyInChat = replyInChat, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, @@ -1293,6 +1461,8 @@ suspend fun TelegramBot.reply( to: AccessibleMessage, content: TextedMediaContent, entities: TextSourcesList, + replyInChat: IdChatIdentifier = to.chat.id, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, @@ -1303,6 +1473,8 @@ suspend fun TelegramBot.reply( to = to, voice = content.media, entities = entities, + replyInChat = replyInChat, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, @@ -1312,6 +1484,8 @@ suspend fun TelegramBot.reply( to = to, audio = content.media, entities = entities, + replyInChat = replyInChat, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, @@ -1321,6 +1495,8 @@ suspend fun TelegramBot.reply( to = to, photoSize = content.media, entities = entities, + replyInChat = replyInChat, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, @@ -1330,6 +1506,8 @@ suspend fun TelegramBot.reply( to = to, video = content.media, entities = entities, + replyInChat = replyInChat, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, @@ -1339,6 +1517,8 @@ suspend fun TelegramBot.reply( to = to, animation = content.media, entities = entities, + replyInChat = replyInChat, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, @@ -1348,6 +1528,8 @@ suspend fun TelegramBot.reply( to = to, document = content.media.asDocumentFile(), entities = entities, + replyInChat = replyInChat, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/RepliesWithChatsAndMessages.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/RepliesWithChatsAndMessages.kt index 663608d1dd..933dd258eb 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/RepliesWithChatsAndMessages.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/RepliesWithChatsAndMessages.kt @@ -47,17 +47,18 @@ suspend inline fun TelegramBot.reply( phoneNumber: String, firstName: String, lastName: String? = null, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null ) = sendContact( - toChatId, + replyInChat, phoneNumber, firstName, lastName, - threadId, + replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), @@ -72,15 +73,16 @@ suspend inline fun TelegramBot.reply( toChatId: IdChatIdentifier, toMessageId: MessageId, contact: Contact, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null ) = sendContact( - toChatId, + replyInChat, contact, - threadId, + replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), @@ -98,12 +100,13 @@ suspend inline fun TelegramBot.replyWithDice( toChatId: IdChatIdentifier, toMessageId: MessageId, animationType: DiceAnimationType? = null, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendDice(toChatId, animationType, threadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendDice(replyInChat, animationType, replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) /** * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or @@ -113,12 +116,13 @@ suspend inline fun TelegramBot.reply( toChatId: IdChatIdentifier, toMessageId: MessageId, animationType: DiceAnimationType, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = replyWithDice(toChatId, toMessageId, animationType, threadId, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup) +) = replyWithDice(replyInChat, toMessageId, animationType, replyInChat, replyInThreadId, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup) // Location @@ -132,16 +136,17 @@ suspend inline fun TelegramBot.reply( toMessageId: MessageId, latitude: Double, longitude: Double, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null ) = sendLocation( - toChatId, + replyInChat, latitude, longitude, - threadId, + replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), @@ -156,15 +161,16 @@ suspend inline fun TelegramBot.reply( toChatId: IdChatIdentifier, toMessageId: MessageId, location: StaticLocation, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null ) = sendLocation( - toChatId, + replyInChat, location, - threadId, + replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), @@ -184,17 +190,18 @@ suspend inline fun TelegramBot.reply( text: String, parseMode: ParseMode? = null, linkPreviewOptions: LinkPreviewOptions? = null, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null ) = sendTextMessage( - toChatId, + replyInChat, text, parseMode, linkPreviewOptions, - threadId, + replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), @@ -210,16 +217,17 @@ suspend inline fun TelegramBot.reply( toMessageId: MessageId, entities: TextSourcesList, linkPreviewOptions: LinkPreviewOptions? = null, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null ) = sendTextMessage( - toChatId, + replyInChat, entities, linkPreviewOptions, - threadId, + replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), @@ -235,13 +243,14 @@ suspend fun TelegramBot.reply( toMessageId: MessageId, separator: TextSource? = null, linkPreviewOptions: LinkPreviewOptions? = null, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null, builderBody: EntitiesBuilderBody -) = reply(toChatId, toMessageId, buildEntities(separator, builderBody), linkPreviewOptions, threadId, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup) +) = reply(replyInChat, toMessageId, buildEntities(separator, builderBody), linkPreviewOptions, replyInChat, replyInThreadId, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup) /** * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] @@ -252,13 +261,14 @@ suspend fun TelegramBot.reply( toMessageId: MessageId, separator: String, linkPreviewOptions: LinkPreviewOptions? = null, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null, builderBody: EntitiesBuilderBody -) = reply(toChatId, toMessageId, buildEntities(separator, builderBody), linkPreviewOptions, threadId, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup) +) = reply(replyInChat, toMessageId, buildEntities(separator, builderBody), linkPreviewOptions, replyInChat, replyInThreadId, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup) // Venue @@ -278,13 +288,14 @@ suspend inline fun TelegramBot.reply( foursquareType: FoursquareType? = null, googlePlaceId: GooglePlaceId? = null, googlePlaceType: GooglePlaceType? = null, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null ) = sendVenue( - chatId = toChatId, + chatId = replyInChat, latitude = latitude, longitude = longitude, title = title, @@ -293,7 +304,7 @@ suspend inline fun TelegramBot.reply( foursquareType = foursquareType, googlePlaceId = googlePlaceId, googlePlaceType = googlePlaceType, - threadId = threadId, + threadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), @@ -310,13 +321,14 @@ suspend inline fun TelegramBot.reply( foursquareType: FoursquareType? = null, googlePlaceId: GooglePlaceId? = null, googlePlaceType: GooglePlaceType? = null, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null ) = sendVenue( - chatId = toChatId, + chatId = replyInChat, latitude = location.latitude, longitude = location.longitude, title = title, @@ -325,7 +337,7 @@ suspend inline fun TelegramBot.reply( foursquareType = foursquareType, googlePlaceId = googlePlaceId, googlePlaceType = googlePlaceType, - threadId = threadId, + threadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), @@ -336,15 +348,16 @@ suspend inline fun TelegramBot.reply( toChatId: IdChatIdentifier, toMessageId: MessageId, venue: Venue, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null ) = sendVenue( - chatId = toChatId, + chatId = replyInChat, venue = venue, - threadId = threadId, + threadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), @@ -358,38 +371,41 @@ suspend inline fun TelegramBot.replyWithGame( toChatId: IdChatIdentifier, toMessageId: MessageId, gameShortName: String, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null ) = sendGame( - toChatId, gameShortName, threadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup + replyInChat, gameShortName, replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup ) suspend inline fun TelegramBot.replyWithGame( toChatId: IdChatIdentifier, toMessageId: MessageId, game: Game, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null ) = sendGame( - toChatId, game.title, threadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup + replyInChat, game.title, replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup ) suspend inline fun TelegramBot.reply( toChatId: IdChatIdentifier, toMessageId: MessageId, game: Game, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = replyWithGame(toChatId, toMessageId, game, threadId, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup) +) = replyWithGame(replyInChat, toMessageId, game, replyInChat, replyInThreadId, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup) // Animation @@ -405,13 +421,14 @@ suspend inline fun TelegramBot.replyWithAnimation( duration: Long? = null, width: Int? = null, height: Int? = null, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null ) = sendAnimation( - toChatId, + replyInChat, animation, thumb, text, @@ -420,7 +437,7 @@ suspend inline fun TelegramBot.replyWithAnimation( duration, width, height, - threadId, + replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), @@ -437,12 +454,13 @@ suspend inline fun TelegramBot.reply( duration: Long? = null, width: Int? = null, height: Int? = null, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendAnimation(toChatId, animation, text, parseMode, spoilered, duration, width, height, threadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendAnimation(replyInChat, animation, text, parseMode, spoilered, duration, width, height, replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) suspend inline fun TelegramBot.replyWithAnimation( toChatId: IdChatIdentifier, @@ -454,13 +472,14 @@ suspend inline fun TelegramBot.replyWithAnimation( duration: Long? = null, width: Int? = null, height: Int? = null, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null ) = sendAnimation( - toChatId, + replyInChat, animation, thumb, entities, @@ -468,7 +487,7 @@ suspend inline fun TelegramBot.replyWithAnimation( duration, width, height, - threadId, + replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), @@ -484,12 +503,13 @@ suspend inline fun TelegramBot.reply( duration: Long? = null, width: Int? = null, height: Int? = null, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendAnimation(toChatId, animation, entities, spoilered, duration, width, height, threadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendAnimation(replyInChat, animation, entities, spoilered, duration, width, height, replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) // Audio @@ -504,12 +524,13 @@ suspend inline fun TelegramBot.replyWithAudio( duration: Long? = null, performer: String? = null, title: String? = null, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendAudio(toChatId, audio, thumb, text, parseMode, duration, performer, title, threadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendAudio(replyInChat, audio, thumb, text, parseMode, duration, performer, title, replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) suspend inline fun TelegramBot.reply( toChatId: IdChatIdentifier, @@ -518,12 +539,13 @@ suspend inline fun TelegramBot.reply( text: String? = null, parseMode: ParseMode? = null, title: String? = null, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendAudio(toChatId, audio, text, parseMode, title, threadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendAudio(replyInChat, audio, text, parseMode, title, replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) suspend inline fun TelegramBot.replyWithAudio( toChatId: IdChatIdentifier, @@ -534,12 +556,13 @@ suspend inline fun TelegramBot.replyWithAudio( duration: Long? = null, performer: String? = null, title: String? = null, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendAudio(toChatId, audio, thumb, entities, duration, performer, title, threadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendAudio(replyInChat, audio, thumb, entities, duration, performer, title, replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) suspend inline fun TelegramBot.reply( toChatId: IdChatIdentifier, @@ -547,12 +570,13 @@ suspend inline fun TelegramBot.reply( audio: AudioFile, entities: TextSourcesList, title: String? = null, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendAudio(toChatId, audio, entities, title, threadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendAudio(replyInChat, audio, entities, title, replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) // Documents @@ -564,13 +588,14 @@ suspend inline fun TelegramBot.replyWithDocument( thumb: InputFile? = null, text: String? = null, parseMode: ParseMode? = null, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null, disableContentTypeDetection: Boolean? = null -) = sendDocument(toChatId, document, thumb, text, parseMode, threadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup, disableContentTypeDetection) +) = sendDocument(replyInChat, document, thumb, text, parseMode, replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup, disableContentTypeDetection) suspend inline fun TelegramBot.reply( toChatId: IdChatIdentifier, @@ -578,13 +603,14 @@ suspend inline fun TelegramBot.reply( document: DocumentFile, text: String? = null, parseMode: ParseMode? = null, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null, disableContentTypeDetection: Boolean? = null -) = sendDocument(toChatId, document, text, parseMode, threadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup, disableContentTypeDetection) +) = sendDocument(replyInChat, document, text, parseMode, replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup, disableContentTypeDetection) suspend inline fun TelegramBot.replyWithDocument( toChatId: IdChatIdentifier, @@ -592,26 +618,28 @@ suspend inline fun TelegramBot.replyWithDocument( document: InputFile, thumb: InputFile? = null, entities: TextSourcesList, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null, disableContentTypeDetection: Boolean? = null -) = sendDocument(toChatId, document, thumb, entities, threadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup, disableContentTypeDetection) +) = sendDocument(replyInChat, document, thumb, entities, replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup, disableContentTypeDetection) suspend inline fun TelegramBot.reply( toChatId: IdChatIdentifier, toMessageId: MessageId, document: DocumentFile, entities: TextSourcesList, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null, disableContentTypeDetection: Boolean? = null -) = sendDocument(toChatId, document, entities, threadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup, disableContentTypeDetection) +) = sendDocument(replyInChat, document, entities, replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup, disableContentTypeDetection) // Media Group @@ -621,41 +649,45 @@ suspend inline fun TelegramBot.replyWithMediaGroup( toChatId: IdChatIdentifier, toMessageId: MessageId, media: List, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null -) = sendMediaGroup(toChatId, media, threadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply)) +) = sendMediaGroup(replyInChat, media, replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply)) suspend inline fun TelegramBot.replyWithPlaylist( toChatId: IdChatIdentifier, toMessageId: MessageId, media: List, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null -) = sendPlaylist(toChatId, media, threadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply)) +) = sendPlaylist(replyInChat, media, replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply)) suspend inline fun TelegramBot.replyWithDocuments( toChatId: IdChatIdentifier, toMessageId: MessageId, media: List, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null -) = sendDocumentsGroup(toChatId, media, threadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply)) +) = sendDocumentsGroup(replyInChat, media, replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply)) suspend inline fun TelegramBot.replyWithGallery( toChatId: IdChatIdentifier, toMessageId: MessageId, media: List, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null -) = sendVisualMediaGroup(toChatId, media, threadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply)) +) = sendVisualMediaGroup(replyInChat, media, replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply)) // Photo @@ -667,12 +699,13 @@ suspend inline fun TelegramBot.replyWithPhoto( text: String? = null, parseMode: ParseMode? = null, spoilered: Boolean = false, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendPhoto(toChatId, fileId, text, parseMode, spoilered, threadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendPhoto(replyInChat, fileId, text, parseMode, spoilered, replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) suspend inline fun TelegramBot.reply( toChatId: IdChatIdentifier, @@ -681,12 +714,13 @@ suspend inline fun TelegramBot.reply( text: String? = null, parseMode: ParseMode? = null, spoilered: Boolean = false, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendPhoto(toChatId, photo, text, parseMode, spoilered, threadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendPhoto(replyInChat, photo, text, parseMode, spoilered, replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) suspend inline fun TelegramBot.reply( toChatId: IdChatIdentifier, @@ -695,12 +729,13 @@ suspend inline fun TelegramBot.reply( text: String? = null, parseMode: ParseMode? = null, spoilered: Boolean = false, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendPhoto(toChatId, photoSize, text, parseMode, spoilered, threadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendPhoto(replyInChat, photoSize, text, parseMode, spoilered, replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) suspend inline fun TelegramBot.replyWithPhoto( @@ -709,12 +744,13 @@ suspend inline fun TelegramBot.replyWithPhoto( fileId: InputFile, entities: TextSourcesList, spoilered: Boolean = false, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendPhoto(toChatId, fileId, entities, spoilered, threadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendPhoto(replyInChat, fileId, entities, spoilered, replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) suspend inline fun TelegramBot.reply( toChatId: IdChatIdentifier, @@ -722,12 +758,13 @@ suspend inline fun TelegramBot.reply( photo: Photo, entities: TextSourcesList, spoilered: Boolean = false, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendPhoto(toChatId, photo, entities, spoilered, threadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendPhoto(replyInChat, photo, entities, spoilered, replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) suspend inline fun TelegramBot.reply( toChatId: IdChatIdentifier, @@ -735,12 +772,13 @@ suspend inline fun TelegramBot.reply( photoSize: PhotoSize, entities: TextSourcesList, spoilered: Boolean = false, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendPhoto(toChatId, photoSize, entities, spoilered, threadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendPhoto(replyInChat, photoSize, entities, spoilered, replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) // Sticker @@ -749,25 +787,27 @@ suspend inline fun TelegramBot.replyWithSticker( toChatId: IdChatIdentifier, toMessageId: MessageId, sticker: InputFile, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, emoji: String? = null, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendSticker(toChatId, sticker, threadId, emoji, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendSticker(replyInChat, sticker, replyInThreadId, emoji, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) suspend inline fun TelegramBot.reply( toChatId: IdChatIdentifier, toMessageId: MessageId, sticker: Sticker, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, emoji: String? = null, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendSticker(toChatId, sticker, threadId, emoji, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendSticker(replyInChat, sticker, replyInThreadId, emoji, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) // Videos @@ -783,12 +823,13 @@ suspend inline fun TelegramBot.replyWithVideo( duration: Long? = null, width: Int? = null, height: Int? = null, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendVideo(toChatId, video, thumb, text, parseMode, spoilered, duration, width, height, threadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendVideo(replyInChat, video, thumb, text, parseMode, spoilered, duration, width, height, replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) suspend inline fun TelegramBot.reply( toChatId: IdChatIdentifier, @@ -797,12 +838,13 @@ suspend inline fun TelegramBot.reply( text: String? = null, parseMode: ParseMode? = null, spoilered: Boolean = false, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendVideo(toChatId, video, text, parseMode, spoilered, threadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendVideo(replyInChat, video, text, parseMode, spoilered, replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) suspend inline fun TelegramBot.replyWithVideo( toChatId: IdChatIdentifier, @@ -814,12 +856,13 @@ suspend inline fun TelegramBot.replyWithVideo( duration: Long? = null, width: Int? = null, height: Int? = null, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendVideo(toChatId, video, thumb, entities, spoilered, duration, width, height, threadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendVideo(replyInChat, video, thumb, entities, spoilered, duration, width, height, replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) suspend inline fun TelegramBot.reply( toChatId: IdChatIdentifier, @@ -827,12 +870,13 @@ suspend inline fun TelegramBot.reply( video: VideoFile, entities: TextSourcesList, spoilered: Boolean = false, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendVideo(toChatId, video, entities, spoilered, threadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendVideo(replyInChat, video, entities, spoilered, replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) // VideoNotes @@ -844,23 +888,25 @@ suspend inline fun TelegramBot.replyWithVideoNote( thumb: InputFile? = null, duration: Long? = null, size: Int? = null, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendVideoNote(toChatId, videoNote, thumb, duration, size, threadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendVideoNote(replyInChat, videoNote, thumb, duration, size, replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) suspend inline fun TelegramBot.reply( toChatId: IdChatIdentifier, toMessageId: MessageId, videoNote: VideoNoteFile, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendVideoNote(toChatId, videoNote, threadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendVideoNote(replyInChat, videoNote, replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) // Voice @@ -872,12 +918,13 @@ suspend inline fun TelegramBot.replyWithVoice( text: String? = null, parseMode: ParseMode? = null, duration: Long? = null, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendVoice(toChatId, voice, text, parseMode, duration, threadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendVoice(replyInChat, voice, text, parseMode, duration, replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) suspend inline fun TelegramBot.reply( toChatId: IdChatIdentifier, @@ -885,12 +932,13 @@ suspend inline fun TelegramBot.reply( voice: VoiceFile, text: String? = null, parseMode: ParseMode? = null, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendVoice(toChatId, voice, text, parseMode, threadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendVoice(replyInChat, voice, text, parseMode, replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) suspend inline fun TelegramBot.replyWithVoice( @@ -899,24 +947,26 @@ suspend inline fun TelegramBot.replyWithVoice( voice: InputFile, entities: TextSourcesList, duration: Long? = null, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendVoice(toChatId, voice, entities, duration, threadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendVoice(replyInChat, voice, entities, duration, replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) suspend inline fun TelegramBot.reply( toChatId: IdChatIdentifier, toMessageId: MessageId, voice: VoiceFile, entities: TextSourcesList, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendVoice(toChatId, voice, entities, threadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendVoice(replyInChat, voice, entities, replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) // Invoice @@ -945,12 +995,13 @@ suspend inline fun TelegramBot.reply( shouldSendPhoneNumberToProvider: Boolean = false, shouldSendEmailToProvider: Boolean = false, priceDependOnShipAddress: Boolean = false, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: InlineKeyboardMarkup? = null -) = sendInvoice(toChatId, title, description, payload, providerToken, currency, prices, maxTipAmount, suggestedTipAmounts, startParameter, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, threadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendInvoice(replyInChat, title, description, payload, providerToken, currency, prices, maxTipAmount, suggestedTipAmounts, startParameter, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) // Polls @@ -964,12 +1015,13 @@ suspend inline fun TelegramBot.reply( isClosed: Boolean = false, allowMultipleAnswers: Boolean = false, closeInfo: ScheduledCloseInfo? = null, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendRegularPoll(toChatId, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, threadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendRegularPoll(replyInChat, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) suspend inline fun TelegramBot.reply( toChatId: IdChatIdentifier, @@ -981,12 +1033,13 @@ suspend inline fun TelegramBot.reply( isAnonymous: Boolean = poll.isAnonymous, allowMultipleAnswers: Boolean = poll.allowMultipleAnswers, closeInfo: ScheduledCloseInfo? = null, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendRegularPoll(toChatId, poll, isClosed, question, options, isAnonymous, allowMultipleAnswers, closeInfo, threadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendRegularPoll(replyInChat, poll, isClosed, question, options, isAnonymous, allowMultipleAnswers, closeInfo, replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) suspend inline fun TelegramBot.reply( toChatId: IdChatIdentifier, @@ -999,12 +1052,13 @@ suspend inline fun TelegramBot.reply( explanation: String? = null, parseMode: ParseMode? = null, closeInfo: ScheduledCloseInfo? = null, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendQuizPoll(toChatId, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, threadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendQuizPoll(replyInChat, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) suspend inline fun TelegramBot.reply( toChatId: IdChatIdentifier, @@ -1018,12 +1072,13 @@ suspend inline fun TelegramBot.reply( explanation: String? = null, parseMode: ParseMode? = null, closeInfo: ScheduledCloseInfo? = null, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendQuizPoll(toChatId, isClosed, quizPoll, question, options, correctOptionId, isAnonymous, explanation, parseMode, closeInfo, threadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendQuizPoll(replyInChat, isClosed, quizPoll, question, options, correctOptionId, isAnonymous, explanation, parseMode, closeInfo, replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) suspend inline fun TelegramBot.reply( toChatId: IdChatIdentifier, @@ -1035,12 +1090,13 @@ suspend inline fun TelegramBot.reply( isAnonymous: Boolean = true, isClosed: Boolean = false, closeInfo: ScheduledCloseInfo? = null, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendQuizPoll(toChatId, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, threadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendQuizPoll(replyInChat, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) suspend inline fun TelegramBot.reply( toChatId: IdChatIdentifier, @@ -1053,12 +1109,13 @@ suspend inline fun TelegramBot.reply( correctOptionId: Int = quizPoll.correctOptionId ?: error("Correct option ID must be provided by income QuizPoll or by developer"), isAnonymous: Boolean = quizPoll.isAnonymous, closeInfo: ScheduledCloseInfo? = null, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendQuizPoll(toChatId, isClosed, quizPoll, question, options, correctOptionId, isAnonymous, entities, closeInfo, threadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) +) = sendQuizPoll(replyInChat, isClosed, quizPoll, question, options, correctOptionId, isAnonymous, entities, closeInfo, replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup) suspend inline fun TelegramBot.reply( @@ -1070,14 +1127,15 @@ suspend inline fun TelegramBot.reply( options: List = poll.options.map { it.text }, isAnonymous: Boolean = poll.isAnonymous, closeInfo: ScheduledCloseInfo? = null, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null ) = when (poll) { is RegularPoll -> reply( - toChatId = toChatId, + toChatId = replyInChat, toMessageId = toMessageId, poll = poll, isClosed = isClosed, @@ -1086,7 +1144,7 @@ suspend inline fun TelegramBot.reply( isAnonymous = isAnonymous, allowMultipleAnswers = isAnonymous, closeInfo = closeInfo, - threadId = threadId, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, @@ -1094,7 +1152,7 @@ suspend inline fun TelegramBot.reply( ) is UnknownPollType -> error("Unable to send poll with unknown type ($poll)") is QuizPoll -> reply( - toChatId = toChatId, + toChatId = replyInChat, toMessageId = toMessageId, quizPoll = poll, entities = poll.textSources, @@ -1103,7 +1161,7 @@ suspend inline fun TelegramBot.reply( options = options, isAnonymous = isAnonymous, closeInfo = closeInfo, - threadId = threadId, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, @@ -1119,18 +1177,19 @@ suspend inline fun TelegramBot.reply( messageId: MessageId, text: String? = null, parseMode: ParseMode? = null, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null ) = copyMessage( - toChatId, + replyInChat, fromChatId, messageId, text, parseMode, - threadId, + replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), @@ -1144,12 +1203,13 @@ suspend inline fun TelegramBot.reply( messageId: MessageId, text: String? = null, parseMode: ParseMode? = null, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = reply(toChatId, toMessageId, fromChat.id, messageId, text, parseMode, threadId, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup) +) = reply(replyInChat, toMessageId, fromChat.id, messageId, text, parseMode, replyInChat, replyInThreadId, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup) suspend inline fun TelegramBot.reply( toChatId: IdChatIdentifier, @@ -1157,18 +1217,20 @@ suspend inline fun TelegramBot.reply( copy: AccessibleMessage, text: String? = null, parseMode: ParseMode? = null, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = reply(toChatId, toMessageId, copy.chat.id, copy.messageId, text, parseMode, threadId, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup) +) = reply(replyInChat, toMessageId, copy.chat.id, copy.messageId, text, parseMode, replyInChat, replyInThreadId, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup) suspend fun TelegramBot.reply( toChatId: IdChatIdentifier, toMessageId: MessageId, content: MessageContent, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, @@ -1176,8 +1238,8 @@ suspend fun TelegramBot.reply( ) { execute( content.createResend( - toChatId, - threadId, + replyInChat, + replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply), @@ -1196,15 +1258,16 @@ suspend fun TelegramBot.reply( toMessageId: MessageId, locationsFlow: Flow, liveTimeMillis: Long = defaultLivePeriodDelayMillis, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null ) = handleLiveLocation( - toChatId, + replyInChat, locationsFlow, liveTimeMillis, - threadId, + replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply) @@ -1222,16 +1285,17 @@ suspend fun TelegramBot.reply( toMessageId: MessageId, locationsFlow: Flow, liveTimeMillis: Long = defaultLivePeriodDelayMillis, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null ) { handleLiveLocation( - toChatId, + replyInChat, locationsFlow, liveTimeMillis, - threadId, + replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply) @@ -1250,16 +1314,17 @@ suspend fun TelegramBot.reply( toMessageId: MessageId, locationsFlow: Flow>, liveTimeMillis: Long = defaultLivePeriodDelayMillis, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null ) { handleLiveLocation( - toChatId, + replyInChat, locationsFlow, liveTimeMillis, - threadId, + replyInThreadId, disableNotification, protectContent, ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply) @@ -1270,7 +1335,8 @@ suspend fun TelegramBot.reply( toChatId: IdChatIdentifier, toMessageId: MessageId, mediaFile: TelegramMediaFile, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, @@ -1278,90 +1344,90 @@ suspend fun TelegramBot.reply( ) { when (mediaFile) { is AudioFile -> reply( - toChatId = toChatId, + toChatId = replyInChat, toMessageId = toMessageId, audio = mediaFile, - threadId = threadId, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, replyMarkup = replyMarkup ) is AnimationFile -> reply( - toChatId = toChatId, + toChatId = replyInChat, toMessageId = toMessageId, animation = mediaFile, - threadId = threadId, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, replyMarkup = replyMarkup ) is VoiceFile -> reply( - toChatId = toChatId, + toChatId = replyInChat, toMessageId = toMessageId, voice = mediaFile, - threadId = threadId, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, replyMarkup = replyMarkup ) is VideoFile -> reply( - toChatId = toChatId, + toChatId = replyInChat, toMessageId = toMessageId, video = mediaFile, - threadId = threadId, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, replyMarkup = replyMarkup ) is VideoNoteFile -> reply( - toChatId = toChatId, + toChatId = replyInChat, toMessageId = toMessageId, videoNote = mediaFile, - threadId = threadId, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, replyMarkup = replyMarkup ) is DocumentFile -> reply( - toChatId = toChatId, + toChatId = replyInChat, toMessageId = toMessageId, document = mediaFile, - threadId = threadId, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, replyMarkup = replyMarkup ) is Sticker -> reply( - toChatId = toChatId, + toChatId = replyInChat, toMessageId = toMessageId, sticker = mediaFile, - threadId = threadId, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, replyMarkup = replyMarkup ) is PhotoSize -> reply( - toChatId = toChatId, + toChatId = replyInChat, toMessageId = toMessageId, photoSize = mediaFile, - threadId = threadId, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, replyMarkup = replyMarkup ) else -> reply( - toChatId = toChatId, + toChatId = replyInChat, toMessageId = toMessageId, document = mediaFile.asDocumentFile(), - threadId = threadId, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, @@ -1376,7 +1442,8 @@ suspend fun TelegramBot.reply( content: TextedMediaContent, text: String?, parseMode: ParseMode? = null, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, @@ -1384,72 +1451,72 @@ suspend fun TelegramBot.reply( ) { when (content) { is VoiceContent -> reply( - toChatId = toChatId, + toChatId = replyInChat, toMessageId = toMessageId, voice = content.media, text = text, parseMode = parseMode, - threadId = threadId, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, replyMarkup = replyMarkup ) is AudioMediaGroupPartContent -> reply( - toChatId = toChatId, + toChatId = replyInChat, toMessageId = toMessageId, audio = content.media, text = text, parseMode = parseMode, - threadId = threadId, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, replyMarkup = replyMarkup ) is PhotoContent -> reply( - toChatId = toChatId, + toChatId = replyInChat, toMessageId = toMessageId, photoSize = content.media, text = text, parseMode = parseMode, - threadId = threadId, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, replyMarkup = replyMarkup ) is VideoContent -> reply( - toChatId = toChatId, + toChatId = replyInChat, toMessageId = toMessageId, video = content.media, text = text, parseMode = parseMode, - threadId = threadId, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, replyMarkup = replyMarkup ) is AnimationContent -> reply( - toChatId = toChatId, + toChatId = replyInChat, toMessageId = toMessageId, animation = content.media, text = text, parseMode = parseMode, - threadId = threadId, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, replyMarkup = replyMarkup ) else -> reply( - toChatId = toChatId, + toChatId = replyInChat, toMessageId = toMessageId, document = content.media.asDocumentFile(), text = text, parseMode = parseMode, - threadId = threadId, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, @@ -1463,7 +1530,8 @@ suspend fun TelegramBot.reply( toMessageId: MessageId, content: TextedMediaContent, entities: List, - threadId: MessageThreadId? = toChatId.threadId, + replyInChat: IdChatIdentifier = toChatId, + replyInThreadId: MessageThreadId? = replyInChat.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, allowSendingWithoutReply: Boolean? = null, @@ -1471,66 +1539,66 @@ suspend fun TelegramBot.reply( ) { when (content) { is VoiceContent -> reply( - toChatId = toChatId, + toChatId = replyInChat, toMessageId = toMessageId, voice = content.media, entities = entities, - threadId = threadId, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, replyMarkup = replyMarkup ) is AudioMediaGroupPartContent -> reply( - toChatId = toChatId, + toChatId = replyInChat, toMessageId = toMessageId, audio = content.media, entities = entities, - threadId = threadId, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, replyMarkup = replyMarkup ) is PhotoContent -> reply( - toChatId = toChatId, + toChatId = replyInChat, toMessageId = toMessageId, photoSize = content.media, entities = entities, - threadId = threadId, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, replyMarkup = replyMarkup ) is VideoContent -> reply( - toChatId = toChatId, + toChatId = replyInChat, toMessageId = toMessageId, video = content.media, entities = entities, - threadId = threadId, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, replyMarkup = replyMarkup ) is AnimationContent -> reply( - toChatId = toChatId, + toChatId = replyInChat, toMessageId = toMessageId, animation = content.media, entities = entities, - threadId = threadId, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply, replyMarkup = replyMarkup ) else -> reply( - toChatId = toChatId, + toChatId = replyInChat, toMessageId = toMessageId, document = content.media.asDocumentFile(), entities = entities, - threadId = threadId, + replyInThreadId = replyInThreadId, disableNotification = disableNotification, protectContent = protectContent, allowSendingWithoutReply = allowSendingWithoutReply,