Skip to content

Commit c99307d

Browse files
committed
Use liveLocation in editBusinessMessageLiveLocation.
1 parent e59e480 commit c99307d

4 files changed

Lines changed: 9 additions & 29 deletions

File tree

td/generate/scheme/td_api.tl

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11932,12 +11932,9 @@ editBusinessMessageText business_connection_id:string chat_id:int53 message_id:i
1193211932
//@chat_id The chat the message belongs to
1193311933
//@message_id Identifier of the message
1193411934
//@reply_markup The new message reply markup; pass null if none
11935-
//@location New location content of the message; pass null to stop sharing the live location
11936-
//@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.
11937-
//-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
11938-
//@heading The new direction in which the location moves, in degrees; 1-360. Pass 0 if unknown
11939-
//@proximity_alert_radius The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled
11940-
editBusinessMessageLiveLocation business_connection_id:string chat_id:int53 message_id:int53 reply_markup:ReplyMarkup location:location live_period:int32 heading:int32 proximity_alert_radius:int32 = BusinessMessage;
11935+
//@location New live location of the message; pass null to stop sharing the live location. If the new live_period isn't set to 0x7FFFFFFF,
11936+
//-then it 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
11937+
editBusinessMessageLiveLocation business_connection_id:string chat_id:int53 message_id:int53 reply_markup:ReplyMarkup location:liveLocation = BusinessMessage;
1194111938

1194211939
//@description Edits the content of a checklist in a message sent on behalf of a business account; for bots only
1194311940
//@business_connection_id Unique identifier of business connection on behalf of which the message was sent

td/telegram/BusinessConnectionManager.cpp

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1744,33 +1744,17 @@ void BusinessConnectionManager::edit_business_message_text(
17441744

17451745
void BusinessConnectionManager::edit_business_message_live_location(
17461746
BusinessConnectionId business_connection_id, DialogId dialog_id, MessageId message_id,
1747-
td_api::object_ptr<td_api::ReplyMarkup> &&reply_markup, td_api::object_ptr<td_api::location> &&input_location,
1748-
int32 live_period, int32 heading, int32 proximity_alert_radius,
1747+
td_api::object_ptr<td_api::ReplyMarkup> &&reply_markup, td_api::object_ptr<td_api::liveLocation> &&input_location,
17491748
Promise<td_api::object_ptr<td_api::businessMessage>> &&promise) {
17501749
TRY_STATUS_PROMISE(promise, check_business_connection(business_connection_id, dialog_id));
17511750
TRY_STATUS_PROMISE(promise, check_business_message_id(message_id));
1752-
1753-
Location location(input_location);
1754-
if (location.empty() && input_location != nullptr) {
1755-
return promise.set_error(400, "Invalid location specified");
1756-
}
1757-
1751+
TRY_RESULT_PROMISE(promise, location, process_live_location(std::move(input_location), true));
17581752
TRY_RESULT_PROMISE(promise, new_reply_markup,
17591753
get_inline_reply_markup(std::move(reply_markup), td_->auth_manager_->is_bot(), true));
17601754

1761-
int32 flags = 0;
1762-
if (live_period != 0) {
1763-
flags |= telegram_api::inputMediaGeoLive::PERIOD_MASK;
1764-
}
1765-
if (heading != 0) {
1766-
flags |= telegram_api::inputMediaGeoLive::HEADING_MASK;
1767-
}
1768-
flags |= telegram_api::inputMediaGeoLive::PROXIMITY_NOTIFICATION_RADIUS_MASK;
1769-
auto input_media = telegram_api::make_object<telegram_api::inputMediaGeoLive>(
1770-
flags, location.empty(), location.get_input_geo_point(), heading, live_period, proximity_alert_radius);
17711755
td_->create_handler<EditBusinessMessageQuery>(std::move(promise))
1772-
->send(business_connection_id, dialog_id, message_id, false, nullptr, false, std::move(input_media), false,
1773-
new_reply_markup);
1756+
->send(business_connection_id, dialog_id, message_id, false, nullptr, false, location.get_input_media_geo_live(),
1757+
false, new_reply_markup);
17741758
}
17751759

17761760
void BusinessConnectionManager::edit_business_message_to_do_list(

td/telegram/BusinessConnectionManager.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,7 @@ class BusinessConnectionManager final : public Actor {
8888

8989
void edit_business_message_live_location(BusinessConnectionId business_connection_id, DialogId dialog_id,
9090
MessageId message_id, td_api::object_ptr<td_api::ReplyMarkup> &&reply_markup,
91-
td_api::object_ptr<td_api::location> &&input_location, int32 live_period,
92-
int32 heading, int32 proximity_alert_radius,
91+
td_api::object_ptr<td_api::liveLocation> &&input_location,
9392
Promise<td_api::object_ptr<td_api::businessMessage>> &&promise);
9493

9594
void edit_business_message_to_do_list(BusinessConnectionId business_connection_id, DialogId dialog_id,

td/telegram/Requests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4327,7 +4327,7 @@ void Requests::on_request(uint64 id, td_api::editBusinessMessageLiveLocation &re
43274327
td_->business_connection_manager_->edit_business_message_live_location(
43284328
BusinessConnectionId(std::move(request.business_connection_id_)), DialogId(request.chat_id_),
43294329
MessageId(request.message_id_), std::move(request.reply_markup_), std::move(request.location_),
4330-
request.live_period_, request.heading_, request.proximity_alert_radius_, std::move(promise));
4330+
std::move(promise));
43314331
}
43324332

43334333
void Requests::on_request(uint64 id, td_api::editBusinessMessageChecklist &request) {

0 commit comments

Comments
 (0)