Improve field names.

GitOrigin-RevId: ded67301be27af1f3b7c8f7e11b2172bb92934c7
This commit is contained in:
levlam 2020-10-30 15:51:20 +03:00
parent 979a1997d5
commit 6f4c4adcc8
10 changed files with 50 additions and 51 deletions

View File

@ -1593,8 +1593,8 @@ messageVoiceNote voice_note:voiceNote caption:formattedText is_listened:Bool = M
//@description A message with a location @location The location description @live_period Time relative to the message send date, for which the location can be updated, in seconds
//@expires_in Left time for which the location can be updated, in seconds. updateMessageContent is not sent when this field changes
//@heading For live locations, a direction in which the location moves, in degrees; 1-360. If 0 the direction is unknown
//@proximity_alert_distance For live locations, a maximum distance to another chat member for proximity alerts, in meters (0-100000). 0 if the notification is disabled. Available only for the message sender
messageLocation location:location live_period:int32 expires_in:int32 heading:int32 proximity_alert_distance:int32 = MessageContent;
//@proximity_alert_radius For live locations, a maximum distance to another chat member for proximity alerts, in meters (0-100000). 0 if the notification is disabled. Available only for the message sender
messageLocation location:location live_period:int32 expires_in:int32 heading:int32 proximity_alert_radius:int32 = MessageContent;
//@description A message with information about a venue @venue The venue description
messageVenue venue:venue = MessageContent;
@ -1814,8 +1814,8 @@ inputMessageVoiceNote voice_note:InputFile duration:int32 waveform:bytes caption
//@description A message with a location @location Location to be sent @live_period Period for which the location can be updated, in seconds; should be between 60 and 86400 for a live location and 0 otherwise
//@heading For live locations, a direction in which the location moves, in degrees; 1-360. Pass 0 if unknown
//@proximity_alert_distance For live locations, a maximum distance to another chat member for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled. Can't be enabled in channels and Saved Messages
inputMessageLocation location:location live_period:int32 heading:int32 proximity_alert_distance:int32 = InputMessageContent;
//@proximity_alert_radius For live locations, a maximum distance to another chat member for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled. Can't be enabled in channels and Saved Messages
inputMessageLocation location:location live_period:int32 heading:int32 proximity_alert_radius:int32 = InputMessageContent;
//@description A message with information about a venue @venue Venue to send
inputMessageVenue venue:venue = InputMessageContent;
@ -2094,8 +2094,8 @@ animations animations:vector<animation> = Animations;
diceStickersRegular sticker:sticker = DiceStickers;
//@description Animated stickers to be combined into a slot machine
//@background The animated sticker with the slot machine background
//@lever The animated sticker with the lever animation
//@background The animated sticker with the slot machine background. The background animation must start playing after all reel animations finish
//@lever The animated sticker with the lever animation. The lever animation must play once in the initial dice state
//@left_reel The animated sticker with the left reel
//@center_reel The animated sticker with the center reel
//@right_reel The animated sticker with the right reel
@ -3849,8 +3849,8 @@ editMessageText chat_id:int53 message_id:int53 reply_markup:ReplyMarkup input_me
//@description Edits the message content of a live location. Messages can be edited for a limited period of time specified in the live location. Returns the edited message after the edit is completed on the server side
//@chat_id The chat the message belongs to @message_id Identifier of the message @reply_markup The new message reply markup; for bots only @location New location content of the message; may be null. Pass null to stop sharing the live location
//@heading The new direction in which the location moves, in degrees; 1-360. Pass 0 if unknown
//@proximity_alert_distance 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_distance:int32 = Message;
//@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;
//@description Edits the content of a message with an animation, an audio, a document, a photo or a video. The media in the message can't be replaced if the message was set to self-destruct. Media can't be replaced by self-destructing media. Media in an album can be edited only to contain a photo or a video. Returns the edited message after the edit is completed on the server side
//@chat_id The chat the message belongs to @message_id Identifier of the message @reply_markup The new message reply markup; for bots only @input_message_content New content of the message. Must be one of the following types: InputMessageAnimation, InputMessageAudio, InputMessageDocument, InputMessagePhoto or InputMessageVideo
@ -3870,8 +3870,8 @@ editInlineMessageText inline_message_id:string reply_markup:ReplyMarkup input_me
//@description Edits the content of a live location in an inline message sent via a bot; for bots only @inline_message_id Inline message identifier @reply_markup The new message reply markup
//@location New location content of the message; may be null. Pass null to stop sharing the live location
//@heading The new direction in which the location moves, in degrees; 1-360. Pass 0 if unknown
//@proximity_alert_distance 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_distance:int32 = Ok;
//@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;
//@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
//@reply_markup The new message reply markup; for bots only @input_message_content New content of the message. Must be one of the following types: InputMessageAnimation, InputMessageAudio, InputMessageDocument, InputMessagePhoto or InputMessageVideo

Binary file not shown.

View File

@ -266,7 +266,7 @@ Result<tl_object_ptr<telegram_api::InputBotInlineMessage>> InlineQueriesManager:
}
return make_tl_object<telegram_api::inputBotInlineMessageMediaGeo>(
flags, location.location.get_input_geo_point(), location.heading, location.live_period,
location.proximity_alert_distance, std::move(input_reply_markup));
location.proximity_alert_radius, std::move(input_reply_markup));
}
if (constructor_id == td_api::inputMessageVenue::ID) {
TRY_RESULT(venue, process_input_message_venue(std::move(input_message_content)));

View File

@ -151,17 +151,17 @@ Result<InputMessageLocation> process_input_message_location(
return Status::Error(400, "Wrong live location heading specified");
}
constexpr int32 MAX_PROXIMITY_ALERT_DISTANCE = 100000; // meters, server side limit
auto proximity_alert_distance = input_location->proximity_alert_distance_;
if (proximity_alert_distance < 0 || proximity_alert_distance > MAX_PROXIMITY_ALERT_DISTANCE) {
return Status::Error(400, "Wrong live location proximity alert distance specified");
constexpr int32 MAX_PROXIMITY_ALERT_RADIUS = 100000; // meters, server side limit
auto proximity_alert_radius = input_location->proximity_alert_radius_;
if (proximity_alert_radius < 0 || proximity_alert_radius > MAX_PROXIMITY_ALERT_RADIUS) {
return Status::Error(400, "Wrong live location proximity alert radius specified");
}
InputMessageLocation result;
result.location = std::move(location);
result.live_period = period;
result.heading = heading;
result.proximity_alert_distance = proximity_alert_distance;
result.proximity_alert_radius = proximity_alert_radius;
return std::move(result);
}

View File

@ -126,7 +126,7 @@ struct InputMessageLocation {
Location location;
int32 live_period;
int32 heading;
int32 proximity_alert_distance;
int32 proximity_alert_radius;
};
Result<InputMessageLocation> process_input_message_location(
td_api::object_ptr<td_api::InputMessageContent> &&input_message_content) TD_WARN_UNUSED_RESULT;

View File

@ -568,14 +568,14 @@ class MessageLiveLocation : public MessageContent {
Location location;
int32 period = 0;
int32 heading = 0;
int32 proximity_alert_distance = 0;
int32 proximity_alert_radius = 0;
MessageLiveLocation() = default;
MessageLiveLocation(Location &&location, int32 period, int32 heading, int32 proximity_alert_distance)
MessageLiveLocation(Location &&location, int32 period, int32 heading, int32 proximity_alert_radius)
: location(std::move(location))
, period(period)
, heading(heading)
, proximity_alert_distance(proximity_alert_distance) {
, proximity_alert_radius(proximity_alert_radius) {
if (period < 0) {
period = 0;
}
@ -583,8 +583,8 @@ class MessageLiveLocation : public MessageContent {
LOG(ERROR) << "Receive wrong heading " << heading;
heading = 0;
}
if (proximity_alert_distance < 0) {
proximity_alert_distance = 0;
if (proximity_alert_radius < 0) {
proximity_alert_radius = 0;
}
}
@ -765,7 +765,7 @@ static void store(const MessageContent *content, StorerT &storer) {
store(m->location, storer);
store(m->period, storer);
store(m->heading, storer);
store(m->proximity_alert_distance, storer);
store(m->proximity_alert_radius, storer);
break;
}
case MessageContentType::Location: {
@ -1073,9 +1073,9 @@ static void parse(unique_ptr<MessageContent> &content, ParserT &parser) {
m->heading = 0;
}
if (parser.version() >= static_cast<int32>(Version::AddLiveLocationProximityAlertDistance)) {
parse(m->proximity_alert_distance, parser);
parse(m->proximity_alert_radius, parser);
} else {
m->proximity_alert_distance = 0;
m->proximity_alert_radius = 0;
}
content = std::move(m);
break;
@ -1417,13 +1417,13 @@ InlineMessageContent create_inline_message_content(Td *td, FileId file_id,
auto heading = (inline_message_geo->flags_ & telegram_api::botInlineMessageMediaGeo::HEADING_MASK) != 0
? inline_message_geo->heading_
: 0;
auto approacing_notification_distance =
auto approacing_notification_radius =
(inline_message_geo->flags_ & telegram_api::botInlineMessageMediaGeo::PROXIMITY_NOTIFICATION_RADIUS_MASK) !=
0
? inline_message_geo->proximity_notification_radius_
: 0;
result.message_content = make_unique<MessageLiveLocation>(
Location(inline_message_geo->geo_), inline_message_geo->period_, heading, approacing_notification_distance);
Location(inline_message_geo->geo_), inline_message_geo->period_, heading, approacing_notification_radius);
} else {
result.message_content = make_unique<MessageLocation>(Location(inline_message_geo->geo_));
}
@ -1687,7 +1687,7 @@ static Result<InputMessageContent> create_input_message_content(
content = make_unique<MessageLocation>(std::move(location.location));
} else {
content = make_unique<MessageLiveLocation>(std::move(location.location), location.live_period, location.heading,
location.proximity_alert_distance);
location.proximity_alert_radius);
}
break;
}
@ -2289,7 +2289,7 @@ static tl_object_ptr<telegram_api::InputMedia> get_input_media_impl(
flags |= telegram_api::inputMediaGeoLive::PROXIMITY_NOTIFICATION_RADIUS_MASK;
return make_tl_object<telegram_api::inputMediaGeoLive>(flags, false /*ignored*/,
m->location.get_input_geo_point(), m->heading, m->period,
m->proximity_alert_distance);
m->proximity_alert_radius);
}
case MessageContentType::Location: {
auto m = static_cast<const MessageLocation *>(content);
@ -2872,7 +2872,7 @@ void merge_message_contents(Td *td, const MessageContent *old_content, MessageCo
need_update = true;
}
if (old_->period != new_->period || old_->heading != new_->heading ||
old_->proximity_alert_distance != new_->proximity_alert_distance) {
old_->proximity_alert_radius != new_->proximity_alert_radius) {
need_update = true;
}
if (old_->location.get_access_hash() != new_->location.get_access_hash()) {
@ -4486,9 +4486,9 @@ tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageCo
auto passed = max(G()->unix_time_cached() - message_date, 0);
auto expires_in = max(0, m->period - passed);
auto heading = expires_in == 0 ? 0 : m->heading;
auto proximity_alert_distance = expires_in == 0 ? 0 : m->proximity_alert_distance;
auto proximity_alert_radius = expires_in == 0 ? 0 : m->proximity_alert_radius;
return make_tl_object<td_api::messageLocation>(m->location.get_location_object(), m->period, expires_in, heading,
proximity_alert_distance);
proximity_alert_radius);
}
case MessageContentType::Location: {
const MessageLocation *m = static_cast<const MessageLocation *>(content);

View File

@ -24135,7 +24135,7 @@ void MessagesManager::edit_message_text(FullMessageId full_message_id,
void MessagesManager::edit_message_live_location(FullMessageId full_message_id,
tl_object_ptr<td_api::ReplyMarkup> &&reply_markup,
tl_object_ptr<td_api::location> &&input_location, int32 heading,
int32 proximity_alert_distance, Promise<Unit> &&promise) {
int32 proximity_alert_radius, Promise<Unit> &&promise) {
LOG(INFO) << "Begin to edit live location of " << full_message_id;
auto dialog_id = full_message_id.get_dialog_id();
Dialog *d = get_dialog_force(dialog_id);
@ -24186,7 +24186,7 @@ void MessagesManager::edit_message_live_location(FullMessageId full_message_id,
}
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_distance);
flags, false /*ignored*/, location.get_input_geo_point(), heading, 0, proximity_alert_radius);
send_closure(td_->create_net_actor<EditMessageActor>(std::move(promise)), &EditMessageActor::send, 0, dialog_id,
m->message_id, string(), vector<tl_object_ptr<telegram_api::MessageEntity>>(), std::move(input_media),
std::move(input_reply_markup), get_message_schedule_date(m),
@ -24500,7 +24500,7 @@ 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_distance, Promise<Unit> &&promise) {
int32 proximity_alert_radius, Promise<Unit> &&promise) {
if (!td_->auth_manager_->is_bot()) {
return promise.set_error(Status::Error(3, "Method is available only for bots"));
}
@ -24529,7 +24529,7 @@ void MessagesManager::edit_inline_message_live_location(const string &inline_mes
}
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_distance);
flags, false /*ignored*/, location.get_input_geo_point(), heading, 0, 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), get_input_reply_markup(r_new_reply_markup.ok()));

View File

@ -440,7 +440,7 @@ class MessagesManager : public Actor {
void edit_message_live_location(FullMessageId full_message_id, tl_object_ptr<td_api::ReplyMarkup> &&reply_markup,
tl_object_ptr<td_api::location> &&input_location, int32 heading,
int32 proximity_alert_distance, Promise<Unit> &&promise);
int32 proximity_alert_radius, Promise<Unit> &&promise);
void edit_message_media(FullMessageId full_message_id, tl_object_ptr<td_api::ReplyMarkup> &&reply_markup,
tl_object_ptr<td_api::InputMessageContent> &&input_message_content, Promise<Unit> &&promise);
@ -458,7 +458,7 @@ class MessagesManager : 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_distance, Promise<Unit> &&promise);
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

@ -1225,11 +1225,11 @@ class EditMessageLiveLocationRequest : public RequestOnceActor {
tl_object_ptr<td_api::ReplyMarkup> reply_markup_;
tl_object_ptr<td_api::location> location_;
int32 heading_;
int32 proximity_alert_distance_;
int32 proximity_alert_radius_;
void do_run(Promise<Unit> &&promise) override {
td->messages_manager_->edit_message_live_location(full_message_id_, std::move(reply_markup_), std::move(location_),
heading_, proximity_alert_distance_, std::move(promise));
heading_, proximity_alert_radius_, std::move(promise));
}
void do_send_result() override {
@ -1239,14 +1239,13 @@ class EditMessageLiveLocationRequest : public RequestOnceActor {
public:
EditMessageLiveLocationRequest(ActorShared<Td> td, uint64 request_id, int64 dialog_id, int64 message_id,
tl_object_ptr<td_api::ReplyMarkup> reply_markup,
tl_object_ptr<td_api::location> location, int32 heading,
int32 proximity_alert_distance)
tl_object_ptr<td_api::location> location, int32 heading, int32 proximity_alert_radius)
: RequestOnceActor(std::move(td), request_id)
, full_message_id_(DialogId(dialog_id), MessageId(message_id))
, reply_markup_(std::move(reply_markup))
, location_(std::move(location))
, heading_(heading)
, proximity_alert_distance_(proximity_alert_distance) {
, proximity_alert_radius_(proximity_alert_radius) {
}
};
@ -5766,7 +5765,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_,
request.proximity_alert_distance_);
request.proximity_alert_radius_);
}
void Td::on_request(uint64 id, td_api::editMessageMedia &request) {
@ -5799,7 +5798,7 @@ void Td::on_request(uint64 id, td_api::editInlineMessageLiveLocation &request) {
CREATE_OK_REQUEST_PROMISE();
messages_manager_->edit_inline_message_live_location(
std::move(request.inline_message_id_), std::move(request.reply_markup_), std::move(request.location_),
request.heading_, request.proximity_alert_distance_, std::move(promise));
request.heading_, request.proximity_alert_radius_, std::move(promise));
}
void Td::on_request(uint64 id, td_api::editInlineMessageMedia &request) {

View File

@ -3159,16 +3159,16 @@ class CliClient final : public Actor {
string longitude;
string accuracy;
string heading;
string proximity_alert_distance;
string proximity_alert_radius;
std::tie(chat_id, args) = split(args);
std::tie(message_id, args) = split(args);
std::tie(latitude, args) = split(args);
std::tie(longitude, args) = split(args);
std::tie(accuracy, args) = split(args);
std::tie(heading, proximity_alert_distance) = split(args);
std::tie(heading, proximity_alert_radius) = split(args);
send_request(td_api::make_object<td_api::editMessageLiveLocation>(
as_chat_id(chat_id), as_message_id(message_id), nullptr, as_location(latitude, longitude, accuracy),
to_integer<int32>(heading), to_integer<int32>(proximity_alert_distance)));
to_integer<int32>(heading), to_integer<int32>(proximity_alert_radius)));
} else if (op == "emss") {
string chat_id;
string message_id;
@ -3432,17 +3432,17 @@ class CliClient final : public Actor {
string longitude;
string accuracy;
string heading;
string proximity_alert_distance;
string proximity_alert_radius;
std::tie(chat_id, args) = split(args);
std::tie(period, args) = split(args);
std::tie(latitude, args) = split(args);
std::tie(longitude, args) = split(args);
std::tie(accuracy, args) = split(args);
std::tie(heading, proximity_alert_distance) = split(args);
std::tie(heading, proximity_alert_radius) = split(args);
send_message(chat_id, td_api::make_object<td_api::inputMessageLocation>(
as_location(latitude, longitude, accuracy), to_integer<int32>(period),
to_integer<int32>(heading), to_integer<int32>(proximity_alert_distance)));
to_integer<int32>(heading), to_integer<int32>(proximity_alert_radius)));
} else if (op == "spoll" || op == "spollm" || op == "spollp" || op == "squiz") {
string chat_id;
string question;