From f6de50e19f8c97a8d72a7a078adec19d4ab6f5ab Mon Sep 17 00:00:00 2001 From: levlam Date: Thu, 22 Dec 2022 17:04:18 +0300 Subject: [PATCH] Fix some spelling. --- td/generate/scheme/td_api.tl | 8 ++++---- td/telegram/ContactsManager.cpp | 2 +- td/telegram/MessagesManager.cpp | 26 +++++++------------------- td/telegram/Td.cpp | 6 +++--- td/telegram/files/FileBitmask.cpp | 2 +- 5 files changed, 16 insertions(+), 28 deletions(-) diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 9f142aace..893012108 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -889,8 +889,8 @@ supergroup id:int53 usernames:usernames date:int32 status:ChatMemberStatus membe //@can_get_statistics True, if the supergroup or channel statistics are available //@can_toggle_aggressive_anti_spam True, if aggressive anti-spam checks can be enabled or disabled in the supergroup //@is_all_history_available True, if new chat members will have access to old messages. In public, discussion, of forum groups and all channels, old messages are always available, -//-so this option affects only private non-forum supergroups without a linked chat. The value of this field is only available for chat administrators -//@is_aggressive_anti_spam_enabled True, if aggressive anti-spam checks are enabled in the supergroup. The value of this field is only available for chat administrators +//-so this option affects only private non-forum supergroups without a linked chat. The value of this field is only available to chat administrators +//@is_aggressive_anti_spam_enabled True, if aggressive anti-spam checks are enabled in the supergroup. The value of this field is only available to chat administrators //@sticker_set_id Identifier of the supergroup sticker set; 0 if none //@location Location to which the supergroup is connected; may be null //@invite_link Primary invite link for the chat; may be null. For chat administrators with can_invite_users right only @@ -1767,7 +1767,7 @@ webPageInstantView page_blocks:vector view_count:int32 version:int32 //@video Preview of the content as a video, if available; may be null //@video_note Preview of the content as a video note, if available; may be null //@voice_note Preview of the content as a voice note, if available; may be null -//@instant_view_version Version of instant view, available for the web page (currently, can be 1 or 2), 0 if none +//@instant_view_version Version of web page instant view (currently, can be 1 or 2); 0 if none webPage url:string display_url:string type:string site_name:string title:string description:formattedText photo:photo embed_url:string embed_type:string embed_width:int32 embed_height:int32 duration:int32 author:string animation:animation audio:audio document:document sticker:sticker video:video video_note:videoNote voice_note:voiceNote instant_view_version:int32 = WebPage; @@ -2284,7 +2284,7 @@ messageVoiceNote voice_note:voiceNote caption:formattedText is_listened:Bool = M //@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_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 +//@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 to 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 diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index 183a5248a..5b96e16ec 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -7289,7 +7289,7 @@ void ContactsManager::on_update_active_usernames_order(vector &&username void ContactsManager::set_emoji_status(EmojiStatus emoji_status, Promise &&promise) { if (!td_->option_manager_->get_option_boolean("is_premium")) { - return promise.set_error(Status::Error(400, "The method is available only for Telegram Premium users")); + return promise.set_error(Status::Error(400, "The method is available only to Telegram Premium users")); } add_recent_emoji_status(td_, emoji_status); auto query_promise = PromiseCreator::lambda( diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 8fee84cac..f2c357855 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -11681,7 +11681,7 @@ void MessagesManager::delete_dialog_messages_by_sender(DialogId dialog_id, Dialo case DialogType::Channel: { channel_id = dialog_id.get_channel_id(); if (!td_->contacts_manager_->is_megagroup_channel(channel_id)) { - return promise.set_error(Status::Error(400, "The method is available only for supergroup chats")); + return promise.set_error(Status::Error(400, "The method is available only in supergroup chats")); } channel_status = td_->contacts_manager_->get_channel_permissions(channel_id); if (!channel_status.can_delete_messages()) { @@ -28067,9 +28067,7 @@ void MessagesManager::edit_message_caption(FullMessageId full_message_id, void MessagesManager::edit_message_reply_markup(FullMessageId full_message_id, tl_object_ptr &&reply_markup, Promise &&promise) { - if (!td_->auth_manager_->is_bot()) { - return promise.set_error(Status::Error(400, "Method is available only for bots")); - } + CHECK(td_->auth_manager_->is_bot()); LOG(INFO) << "Begin to edit reply markup of " << full_message_id; auto dialog_id = full_message_id.get_dialog_id(); @@ -28106,9 +28104,7 @@ void MessagesManager::edit_inline_message_text(const string &inline_message_id, tl_object_ptr &&reply_markup, tl_object_ptr &&input_message_content, Promise &&promise) { - if (!td_->auth_manager_->is_bot()) { - return promise.set_error(Status::Error(400, "Method is available only for bots")); - } + CHECK(td_->auth_manager_->is_bot()); if (input_message_content == nullptr) { return promise.set_error(Status::Error(400, "Can't edit message without new content")); @@ -28150,9 +28146,7 @@ void MessagesManager::edit_inline_message_live_location(const string &inline_mes tl_object_ptr &&reply_markup, tl_object_ptr &&input_location, int32 heading, int32 proximity_alert_radius, Promise &&promise) { - if (!td_->auth_manager_->is_bot()) { - return promise.set_error(Status::Error(400, "Method is available only for bots")); - } + CHECK(td_->auth_manager_->is_bot()); auto r_new_reply_markup = get_reply_markup(std::move(reply_markup), td_->auth_manager_->is_bot(), true, false, true); if (r_new_reply_markup.is_error()) { @@ -28188,9 +28182,7 @@ void MessagesManager::edit_inline_message_media(const string &inline_message_id, tl_object_ptr &&reply_markup, tl_object_ptr &&input_message_content, Promise &&promise) { - if (!td_->auth_manager_->is_bot()) { - return promise.set_error(Status::Error(400, "Method is available only for bots")); - } + CHECK(td_->auth_manager_->is_bot()); if (input_message_content == nullptr) { return promise.set_error(Status::Error(400, "Can't edit message without new content")); @@ -28240,9 +28232,7 @@ void MessagesManager::edit_inline_message_caption(const string &inline_message_i tl_object_ptr &&reply_markup, tl_object_ptr &&input_caption, Promise &&promise) { - if (!td_->auth_manager_->is_bot()) { - return promise.set_error(Status::Error(400, "Method is available only for bots")); - } + CHECK(td_->auth_manager_->is_bot()); auto r_caption = get_formatted_text(td_, DialogId(), std::move(input_caption), td_->auth_manager_->is_bot(), true, false, false); @@ -28270,9 +28260,7 @@ void MessagesManager::edit_inline_message_caption(const string &inline_message_i void MessagesManager::edit_inline_message_reply_markup(const string &inline_message_id, tl_object_ptr &&reply_markup, Promise &&promise) { - if (!td_->auth_manager_->is_bot()) { - return promise.set_error(Status::Error(400, "Method is available only for bots")); - } + CHECK(td_->auth_manager_->is_bot()); auto r_new_reply_markup = get_reply_markup(std::move(reply_markup), td_->auth_manager_->is_bot(), true, false, true); if (r_new_reply_markup.is_error()) { diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index ca844677b..a89aba4b1 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -4044,9 +4044,9 @@ Promise Td::create_ok_request_promise(uint64 id) { if (!auth_manager_->is_bot()) { \ return send_error_raw(id, 400, "Only bots can use the method"); \ } -#define CHECK_IS_USER() \ - if (auth_manager_->is_bot()) { \ - return send_error_raw(id, 400, "The method is not available for bots"); \ +#define CHECK_IS_USER() \ + if (auth_manager_->is_bot()) { \ + return send_error_raw(id, 400, "The method is not available to bots"); \ } #define CREATE_NO_ARGS_REQUEST(name) \ diff --git a/td/telegram/files/FileBitmask.cpp b/td/telegram/files/FileBitmask.cpp index 48f58a14f..44b2e9718 100644 --- a/td/telegram/files/FileBitmask.cpp +++ b/td/telegram/files/FileBitmask.cpp @@ -36,7 +36,7 @@ Bitmask Bitmask::compress(int k) const { } std::string Bitmask::encode(int32 prefix_count) { - // remove zeroes in the end to make encoding deterministic + // remove zeroes at the end to make encoding deterministic Slice data(data_); int save_i = -1;