Add setLocation method.
GitOrigin-RevId: 43fef89f4d2175cf9ec5a20409979c988e781a28
This commit is contained in:
parent
3153e72d2f
commit
3aa55a2e89
@ -3901,6 +3901,9 @@ setBio bio:string = Ok;
|
||||
//@description Changes the username of the current user. If something changes, updateUser will be sent @username The new value of the username. Use an empty string to remove the username
|
||||
setUsername username:string = Ok;
|
||||
|
||||
//@description Changes the location of the current user. Needs to be called if GetOption("is_location_visible") is true and location changes for more than 1 kilometer @location The new location of the user
|
||||
setLocation location:location = Ok;
|
||||
|
||||
//@description Changes the phone number of the user and sends an authentication code to the user's new phone number. On success, returns information about the sent code
|
||||
//@phone_number The new phone number of the user in international format @settings Settings for the authentication of the user's phone number
|
||||
changePhoneNumber phone_number:string settings:phoneNumberAuthenticationSettings = AuthenticationCodeInfo;
|
||||
|
Binary file not shown.
@ -4852,6 +4852,20 @@ void ContactsManager::search_dialogs_nearby(const Location &location,
|
||||
td_->create_handler<SearchDialogsNearbyQuery>(std::move(query_promise))->send(location, false, -1);
|
||||
}
|
||||
|
||||
void ContactsManager::set_location(const Location &location, Promise<Unit> &&promise) {
|
||||
if (location.empty()) {
|
||||
return promise.set_error(Status::Error(400, "Invalid location specified"));
|
||||
}
|
||||
last_user_location_ = location;
|
||||
try_send_set_location_visibility_query();
|
||||
|
||||
auto query_promise = PromiseCreator::lambda(
|
||||
[promise = std::move(promise)](Result<tl_object_ptr<telegram_api::Updates>> result) mutable {
|
||||
promise.set_value(Unit());
|
||||
});
|
||||
td_->create_handler<SearchDialogsNearbyQuery>(std::move(query_promise))->send(location, true, -1);
|
||||
}
|
||||
|
||||
vector<td_api::object_ptr<td_api::chatNearby>> ContactsManager::get_chats_nearby_object(
|
||||
const vector<DialogNearby> &dialogs_nearby) {
|
||||
return transform(dialogs_nearby, [](const DialogNearby &dialog_nearby) {
|
||||
|
@ -313,6 +313,8 @@ class ContactsManager : public Actor {
|
||||
|
||||
void search_dialogs_nearby(const Location &location, Promise<td_api::object_ptr<td_api::chatsNearby>> &&promise);
|
||||
|
||||
void set_location(const Location &location, Promise<Unit> &&promise);
|
||||
|
||||
void set_location_visibility();
|
||||
|
||||
void set_profile_photo(const tl_object_ptr<td_api::InputFile> &input_photo, Promise<Unit> &&promise);
|
||||
|
@ -6170,6 +6170,12 @@ void Td::on_request(uint64 id, td_api::setUsername &request) {
|
||||
contacts_manager_->set_username(request.username_, std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, const td_api::setLocation &request) {
|
||||
CHECK_IS_USER();
|
||||
CREATE_OK_REQUEST_PROMISE();
|
||||
contacts_manager_->set_location(Location(request.location_), std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, td_api::setProfilePhoto &request) {
|
||||
CHECK_IS_USER();
|
||||
CREATE_OK_REQUEST_PROMISE();
|
||||
|
@ -781,6 +781,8 @@ class Td final : public NetQueryCallback {
|
||||
|
||||
void on_request(uint64 id, td_api::setUsername &request);
|
||||
|
||||
void on_request(uint64 id, const td_api::setLocation &request);
|
||||
|
||||
void on_request(uint64 id, td_api::setProfilePhoto &request);
|
||||
|
||||
void on_request(uint64 id, const td_api::deleteProfilePhoto &request);
|
||||
|
@ -3701,6 +3701,12 @@ class CliClient final : public Actor {
|
||||
|
||||
std::tie(latitude, longitude) = split(args);
|
||||
send_request(td_api::make_object<td_api::searchChatsNearby>(as_location(latitude, longitude)));
|
||||
} else if (op == "sloc") {
|
||||
string latitude;
|
||||
string longitude;
|
||||
|
||||
std::tie(latitude, longitude) = split(args);
|
||||
send_request(td_api::make_object<td_api::setLocation>(as_location(latitude, longitude)));
|
||||
} else if (op == "sco") {
|
||||
string limit;
|
||||
string query;
|
||||
|
Loading…
Reference in New Issue
Block a user