diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 2f005fa37..a09e5de34 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -8112,9 +8112,11 @@ editMessageText chat_id:int53 message_id:int53 reply_markup:ReplyMarkup input_me //@message_id Identifier of the message //@reply_markup The new message reply markup; pass null if none; for bots only //@location New location content of the message; pass null to stop sharing the live location +//@live_period New time relative to the message send date, for which the location can be updated, in seconds. If 0x7FFFFFFF specified, then the location can be updated forever. +//-Otherwise, must not exceed the current live_period by more than a day, and the live location expiration date must remain in the next 90 days. Pass 0 to keep the current live_period //@heading The new direction in which the location moves, in degrees; 1-360. Pass 0 if unknown //@proximity_alert_radius The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled -editMessageLiveLocation chat_id:int53 message_id:int53 reply_markup:ReplyMarkup location:location heading:int32 proximity_alert_radius:int32 = Message; +editMessageLiveLocation chat_id:int53 message_id:int53 reply_markup:ReplyMarkup location:location live_period:int32 heading:int32 proximity_alert_radius:int32 = Message; //@description Edits the content of a message with an animation, an audio, a document, a photo or a video, including message caption. If only the caption needs to be edited, use editMessageCaption instead. //-The media can't be edited if the message was set to self-destruct or to a self-destructing media. The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa. Returns the edited message after the edit is completed on the server side diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 6efc40556..6e57c386b 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -25053,8 +25053,8 @@ void MessagesManager::edit_message_text(MessageFullId message_full_id, void MessagesManager::edit_message_live_location(MessageFullId message_full_id, tl_object_ptr &&reply_markup, - tl_object_ptr &&input_location, int32 heading, - int32 proximity_alert_radius, Promise &&promise) { + tl_object_ptr &&input_location, int32 live_period, + int32 heading, int32 proximity_alert_radius, Promise &&promise) { auto dialog_id = message_full_id.get_dialog_id(); TRY_RESULT_PROMISE(promise, d, check_dialog_access(dialog_id, true, AccessRights::Edit, "edit_message_live_location")); @@ -25090,12 +25090,15 @@ void MessagesManager::edit_message_live_location(MessageFullId message_full_id, if (location.empty()) { flags |= telegram_api::inputMediaGeoLive::STOPPED_MASK; } + if (live_period != 0) { + flags |= telegram_api::inputMediaGeoLive::PERIOD_MASK; + } if (heading != 0) { flags |= telegram_api::inputMediaGeoLive::HEADING_MASK; } flags |= telegram_api::inputMediaGeoLive::PROXIMITY_NOTIFICATION_RADIUS_MASK; auto input_media = telegram_api::make_object( - flags, false /*ignored*/, location.get_input_geo_point(), heading, 0, proximity_alert_radius); + flags, false /*ignored*/, location.get_input_geo_point(), heading, live_period, proximity_alert_radius); td_->create_handler(std::move(promise)) ->send(0, dialog_id, m->message_id, string(), vector>(), std::move(input_media), false, std::move(input_reply_markup), get_message_schedule_date(m)); diff --git a/td/telegram/MessagesManager.h b/td/telegram/MessagesManager.h index 9c502a697..9c6b8e762 100644 --- a/td/telegram/MessagesManager.h +++ b/td/telegram/MessagesManager.h @@ -464,7 +464,7 @@ class MessagesManager final : public Actor { tl_object_ptr &&input_message_content, Promise &&promise); void edit_message_live_location(MessageFullId message_full_id, tl_object_ptr &&reply_markup, - tl_object_ptr &&input_location, int32 heading, + tl_object_ptr &&input_location, int32 live_period, int32 heading, int32 proximity_alert_radius, Promise &&promise); void edit_message_media(MessageFullId message_full_id, tl_object_ptr &&reply_markup, diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index b4266d9e5..2d69a7fb9 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -1212,12 +1212,14 @@ class EditMessageLiveLocationRequest final : public RequestOnceActor { MessageFullId message_full_id_; tl_object_ptr reply_markup_; tl_object_ptr location_; + int32 live_period_; int32 heading_; int32 proximity_alert_radius_; void do_run(Promise &&promise) final { td_->messages_manager_->edit_message_live_location(message_full_id_, std::move(reply_markup_), std::move(location_), - heading_, proximity_alert_radius_, std::move(promise)); + live_period_, heading_, proximity_alert_radius_, + std::move(promise)); } void do_send_result() final { @@ -1227,11 +1229,13 @@ class EditMessageLiveLocationRequest final : public RequestOnceActor { public: EditMessageLiveLocationRequest(ActorShared td, uint64 request_id, int64 dialog_id, int64 message_id, tl_object_ptr reply_markup, - tl_object_ptr location, int32 heading, int32 proximity_alert_radius) + tl_object_ptr location, int32 live_period, int32 heading, + int32 proximity_alert_radius) : RequestOnceActor(std::move(td), request_id) , message_full_id_(DialogId(dialog_id), MessageId(message_id)) , reply_markup_(std::move(reply_markup)) , location_(std::move(location)) + , live_period_(live_period) , heading_(heading) , proximity_alert_radius_(proximity_alert_radius) { } @@ -5776,7 +5780,7 @@ void Td::on_request(uint64 id, td_api::editMessageText &request) { void Td::on_request(uint64 id, td_api::editMessageLiveLocation &request) { CREATE_REQUEST(EditMessageLiveLocationRequest, request.chat_id_, request.message_id_, - std::move(request.reply_markup_), std::move(request.location_), request.heading_, + std::move(request.reply_markup_), std::move(request.location_), request.live_period_, request.heading_, request.proximity_alert_radius_); } diff --git a/td/telegram/cli.cpp b/td/telegram/cli.cpp index ecc6531db..d1dc4c1c9 100644 --- a/td/telegram/cli.cpp +++ b/td/telegram/cli.cpp @@ -5011,12 +5011,14 @@ class CliClient final : public Actor { MessageId message_id; string latitude; string longitude; + int32 live_period; string accuracy; int32 heading; int32 proximity_alert_radius; - get_args(args, chat_id, message_id, latitude, longitude, accuracy, heading, proximity_alert_radius); - send_request(td_api::make_object( - chat_id, message_id, nullptr, as_location(latitude, longitude, accuracy), heading, proximity_alert_radius)); + get_args(args, chat_id, message_id, latitude, longitude, live_period, accuracy, heading, proximity_alert_radius); + send_request(td_api::make_object(chat_id, message_id, nullptr, + as_location(latitude, longitude, accuracy), + live_period, heading, proximity_alert_radius)); } else if (op == "emss") { ChatId chat_id; MessageId message_id;