Support live_period in editInlineMessageLiveLocation.

This commit is contained in:
levlam 2024-05-02 16:32:44 +03:00
parent 140c97f8ac
commit a89be2370c
4 changed files with 15 additions and 9 deletions

View File

@ -8149,9 +8149,11 @@ editInlineMessageText inline_message_id:string reply_markup:ReplyMarkup input_me
//@inline_message_id Inline message identifier
//@reply_markup The new message reply markup; pass null if none
//@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
editInlineMessageLiveLocation inline_message_id:string reply_markup:ReplyMarkup location:location heading:int32 proximity_alert_radius:int32 = Ok;
editInlineMessageLiveLocation inline_message_id:string reply_markup:ReplyMarkup location:location live_period:int32 heading:int32 proximity_alert_radius:int32 = Ok;
//@description Edits the content of a message with an animation, an audio, a document, a photo or a video in an inline message sent via a bot; for bots only
//@inline_message_id Inline message identifier

View File

@ -25382,8 +25382,9 @@ void MessagesManager::edit_inline_message_text(const string &inline_message_id,
void MessagesManager::edit_inline_message_live_location(const string &inline_message_id,
tl_object_ptr<td_api::ReplyMarkup> &&reply_markup,
tl_object_ptr<td_api::location> &&input_location, int32 heading,
int32 proximity_alert_radius, Promise<Unit> &&promise) {
tl_object_ptr<td_api::location> &&input_location,
int32 live_period, int32 heading, int32 proximity_alert_radius,
Promise<Unit> &&promise) {
CHECK(td_->auth_manager_->is_bot());
TRY_RESULT_PROMISE(promise, new_reply_markup,
@ -25403,12 +25404,15 @@ void MessagesManager::edit_inline_message_live_location(const string &inline_mes
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<telegram_api::inputMediaGeoLive>(
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<EditInlineMessageQuery>(std::move(promise))
->send(0, std::move(input_bot_inline_message_id), "", vector<tl_object_ptr<telegram_api::MessageEntity>>(),
std::move(input_media), false, get_input_reply_markup(td_->user_manager_.get(), new_reply_markup));

View File

@ -482,8 +482,8 @@ class MessagesManager final : public Actor {
void edit_inline_message_live_location(const string &inline_message_id,
tl_object_ptr<td_api::ReplyMarkup> &&reply_markup,
tl_object_ptr<td_api::location> &&input_location, int32 heading,
int32 proximity_alert_radius, Promise<Unit> &&promise);
tl_object_ptr<td_api::location> &&input_location, int32 live_period,
int32 heading, int32 proximity_alert_radius, Promise<Unit> &&promise);
void edit_inline_message_media(const string &inline_message_id, tl_object_ptr<td_api::ReplyMarkup> &&reply_markup,
tl_object_ptr<td_api::InputMessageContent> &&input_message_content,

View File

@ -5812,9 +5812,9 @@ void Td::on_request(uint64 id, td_api::editInlineMessageLiveLocation &request) {
CHECK_IS_BOT();
CLEAN_INPUT_STRING(request.inline_message_id_);
CREATE_OK_REQUEST_PROMISE();
messages_manager_->edit_inline_message_live_location(request.inline_message_id_, std::move(request.reply_markup_),
std::move(request.location_), request.heading_,
request.proximity_alert_radius_, std::move(promise));
messages_manager_->edit_inline_message_live_location(
request.inline_message_id_, std::move(request.reply_markup_), std::move(request.location_), request.live_period_,
request.heading_, request.proximity_alert_radius_, std::move(promise));
}
void Td::on_request(uint64 id, td_api::editInlineMessageMedia &request) {