From 6db88eb8bd8b4fa686c3a37a0f3c56a292e6a71b Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Mon, 6 May 2024 21:51:24 +0600 Subject: [PATCH] add live_period in editing of live location --- .../inmo/tgbotapi/extensions/api/edit/Edits.kt | 5 ++++- .../location/live/EditChatMessageLiveLocation.kt | 15 +++++++++------ .../location/live/EditChatMessageLiveLocation.kt | 3 +++ 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/Edits.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/Edits.kt index c08d54d625..f497b944cd 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/Edits.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/Edits.kt @@ -55,6 +55,7 @@ suspend fun TelegramBot.edit( messageId: MessageId, latitude: Double, longitude: Double, + livePeriod: Seconds? = null, horizontalAccuracy: Meters? = null, heading: Degrees? = null, proximityAlertRadius: Meters? = null, @@ -70,6 +71,7 @@ suspend fun TelegramBot.edit( messageId: MessageId, latitude: Double, longitude: Double, + livePeriod: Seconds? = null, horizontalAccuracy: Meters? = null, heading: Degrees? = null, proximityAlertRadius: Meters? = null, @@ -84,11 +86,12 @@ suspend fun TelegramBot.edit( message: ContentMessage, latitude: Double, longitude: Double, + livePeriod: Seconds? = null, horizontalAccuracy: Meters? = null, heading: Degrees? = null, proximityAlertRadius: Meters? = null, replyMarkup: InlineKeyboardMarkup? = null -) = editLiveLocation(message, latitude, longitude, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup) +) = editLiveLocation(message, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup) /** * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/location/live/EditChatMessageLiveLocation.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/location/live/EditChatMessageLiveLocation.kt index 71a4776f11..1af8f12f35 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/location/live/EditChatMessageLiveLocation.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/location/live/EditChatMessageLiveLocation.kt @@ -18,13 +18,14 @@ suspend fun TelegramBot.editLiveLocation( messageId: MessageId, latitude: Double, longitude: Double, + livePeriod: Seconds? = null, horizontalAccuracy: Meters? = null, heading: Degrees? = null, proximityAlertRadius: Meters? = null, replyMarkup: InlineKeyboardMarkup? = null ) = execute( EditChatMessageLiveLocation( - chatId, messageId, latitude, longitude, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup + chatId, messageId, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup ) ) @@ -37,11 +38,12 @@ suspend fun TelegramBot.editLiveLocation( messageId: MessageId, latitude: Double, longitude: Double, + livePeriod: Seconds? = null, horizontalAccuracy: Meters? = null, heading: Degrees? = null, proximityAlertRadius: Meters? = null, replyMarkup: InlineKeyboardMarkup? = null -) = editLiveLocation(chat.id, messageId, latitude, longitude, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup) +) = editLiveLocation(chat.id, messageId, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup) /** * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] @@ -51,11 +53,12 @@ suspend fun TelegramBot.editLiveLocation( message: ContentMessage, latitude: Double, longitude: Double, + livePeriod: Seconds? = null, horizontalAccuracy: Meters? = null, heading: Degrees? = null, proximityAlertRadius: Meters? = null, replyMarkup: InlineKeyboardMarkup? = null -) = editLiveLocation(message.chat, message.messageId, latitude, longitude, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup) +) = editLiveLocation(message.chat, message.messageId, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup) /** * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] @@ -68,7 +71,7 @@ suspend fun TelegramBot.editLiveLocation( replyMarkup: InlineKeyboardMarkup? = null ) = execute( EditChatMessageLiveLocation( - chatId, messageId, location.latitude, location.longitude, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, replyMarkup + chatId, messageId, location.latitude, location.longitude, location.livePeriod, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, replyMarkup ) ) @@ -81,7 +84,7 @@ suspend fun TelegramBot.editLiveLocation( messageId: MessageId, location: LiveLocation, replyMarkup: InlineKeyboardMarkup? = null -) = editLiveLocation(chat.id, messageId, location.latitude, location.longitude, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, replyMarkup) +) = editLiveLocation(chat.id, messageId, location.latitude, location.longitude, location.livePeriod, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, replyMarkup) /** * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] @@ -91,4 +94,4 @@ suspend fun TelegramBot.editLiveLocation( message: ContentMessage, location: LiveLocation, replyMarkup: InlineKeyboardMarkup? = null -) = editLiveLocation(message.chat, message.messageId, location.latitude, location.longitude, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, replyMarkup) +) = editLiveLocation(message.chat, message.messageId, location.latitude, location.longitude, location.livePeriod, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, replyMarkup) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/location/live/EditChatMessageLiveLocation.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/location/live/EditChatMessageLiveLocation.kt index 1578dfa51e..8b612ad559 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/location/live/EditChatMessageLiveLocation.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/location/live/EditChatMessageLiveLocation.kt @@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.requests.edit.location.live import dev.inmo.tgbotapi.requests.edit.abstracts.* import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup +import dev.inmo.tgbotapi.types.location.LiveLocation import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import dev.inmo.tgbotapi.types.message.content.LocationContent @@ -22,6 +23,8 @@ data class EditChatMessageLiveLocation( override val latitude: Double, @SerialName(longitudeField) override val longitude: Double, + @SerialName(livePeriodField) + val livePeriod: Seconds? = null, @SerialName(horizontalAccuracyField) override val horizontalAccuracy: Meters? = null, @SerialName(headingField)