Various fixes.

This commit is contained in:
levlam 2024-04-21 02:24:11 +03:00
parent f3385d6cb7
commit 01e30e5263
8 changed files with 21 additions and 15 deletions

View File

@ -7211,7 +7211,7 @@ updateAnimationSearchParameters provider:string emojis:vector<string> = Update;
updateSuggestedActions added_actions:vector<SuggestedAction> removed_actions:vector<SuggestedAction> = Update;
//@description Download or upload file speed for the user was limited, but it can be restored by subscription to Telegram Premium. The notification can be postponed until a being downloaded or uploaded file is visible to the user
//-Use getOption("premium_download_speedup") or getOption("premium_upload_speedup") to get expected speedup after subscription to Telegram Premium
//-Use getOption("premium_download_speedup") or getOption("premium_upload_speedup") to get expected speedup after subscription to Telegram Premium
//@is_upload True, if upload speed was limited; false, if download speed was limited
updateSpeedLimitNotification is_upload:Bool = Update;
@ -8180,7 +8180,7 @@ addQuickReplyShortcutInlineQueryResultMessage shortcut_name:string reply_to_mess
//@description Readds quick reply messages which failed to add. Can be called only for messages for which messageSendingStateFailed.can_retry is true and after specified in messageSendingStateFailed.retry_after time passed.
//-If a message is readded, the corresponding failed to send message is deleted. Returns the sent messages in the same order as the message identifiers passed in message_ids. If a message can't be readded, null will be returned instead of the message
//@shortcut_name Name of the target shortcut
//@message_ids Identifiers of the quick reply messages to readd. Message identifiers must be in a strictly increasing order
//@message_ids Identifiers of the quick reply messages to readd. Message identifiers must be in a strictly increasing order
readdQuickReplyShortcutMessages shortcut_name:string message_ids:vector<int53> = QuickReplyMessages;
//@description Asynchronously edits the text, media or caption of a quick reply message. Use quickReplyMessage.can_be_edited to check whether a message can be edited.
@ -9799,7 +9799,7 @@ setBusinessAwayMessageSettings away_message_settings:businessAwayMessageSettings
setBusinessStartPage start_page:inputBusinessStartPage = Ok;
//@description Sends a code to the specified phone number. Aborts previous phone number verification if any. On success, returns information about the sent code
//@description Sends a code to the specified phone number. Aborts previous phone number verification if there was one. On success, returns information about the sent code
//@phone_number The phone number, in international format
//@settings Settings for the authentication of the user's phone number; pass null to use default settings
//@type Type of the request for which the code is sent
@ -9836,7 +9836,7 @@ removeBusinessConnectedBotFromChat chat_id:int53 = Ok;
getBusinessChatLinks = BusinessChatLinks;
//@description Creates a business chat link for the current account. Requires Telegram Business subscription. There can be up to getOption("business_chat_link_count_max") links created. Returns the created link
//@link_info Description of the link to create
//@link_info Information about the link to create
createBusinessChatLink link_info:inputBusinessChatLink = BusinessChatLink;
//@description Edits a business chat link of the current account. Requires Telegram Business subscription. Returns the edited link

View File

@ -27,6 +27,8 @@
#include "td/utils/misc.h"
#include "td/utils/SliceBuilder.h"
#include <algorithm>
namespace td {
static td_api::object_ptr<td_api::chatBoost> get_chat_boost_object(
@ -371,12 +373,12 @@ td_api::object_ptr<td_api::chatBoostLevelFeatures> BoostManager::get_chat_boost_
}
td_api::object_ptr<td_api::chatBoostFeatures> BoostManager::get_chat_boost_features_object(bool for_megagroup) const {
std::set<int32> big_levels;
vector<int32> big_levels;
auto get_min_boost_level = [&](Slice name) {
auto min_level = narrow_cast<int32>(td_->option_manager_->get_option_integer(
PSLICE() << (for_megagroup ? "group" : "channel") << '_' << name << "_level_min", 1000000000));
if (min_level > 10 && min_level < 1000000) {
big_levels.insert(min_level);
big_levels.push_back(min_level);
}
return min_level;
};
@ -388,6 +390,7 @@ td_api::object_ptr<td_api::chatBoostFeatures> BoostManager::get_chat_boost_featu
for (int32 level = 1; level <= 10; level++) {
result->features_.push_back(get_chat_boost_level_features_object(for_megagroup, level));
}
td::unique(big_levels);
for (auto level : big_levels) {
result->features_.push_back(get_chat_boost_level_features_object(for_megagroup, level));
}

View File

@ -11,7 +11,6 @@
#include "td/telegram/ChatManager.h"
#include "td/telegram/DialogManager.h"
#include "td/telegram/files/FileId.h"
#include "td/telegram/files/FileLocation.h"
#include "td/telegram/files/FileManager.h"
#include "td/telegram/files/FileType.h"
#include "td/telegram/Global.h"

View File

@ -10,6 +10,8 @@
#include "td/telegram/misc.h"
#include "td/telegram/Td.h"
#include "td/utils/logging.h"
namespace td {
InputBusinessChatLink::InputBusinessChatLink(const Td *td, td_api::object_ptr<td_api::inputBusinessChatLink> &&link) {

View File

@ -2277,7 +2277,7 @@ Result<string> LinkManager::get_internal_link_impl(const td_api::InternalLinkTyp
return Status::Error(400, "Invalid chat username specified");
}
if (!check_utf8(link->draft_text_)) {
return Status::Error(400, "Draft text nust be encoded in UTF-8");
return Status::Error(400, "Draft text must be encoded in UTF-8");
}
return get_public_dialog_link(link->chat_username_, link->draft_text_, is_internal);
}
@ -2385,7 +2385,7 @@ Result<string> LinkManager::get_internal_link_impl(const td_api::InternalLinkTyp
return Status::Error(400, "Invalid phone number specified");
}
if (!check_utf8(link->draft_text_)) {
return Status::Error(400, "Draft text nust be encoded in UTF-8");
return Status::Error(400, "Draft text must be encoded in UTF-8");
}
if (is_internal) {
return PSTRING() << "tg://resolve?phone=" << link->phone_number_ << (link->draft_text_.empty() ? "" : "&text=")

View File

@ -13,6 +13,7 @@
#include "td/actor/actor.h"
#include "td/utils/common.h"
#include "td/utils/Promise.h"
#include "td/utils/Status.h"
namespace td {

View File

@ -13,6 +13,7 @@
#include "td/telegram/DialogManager.h"
#include "td/telegram/FileReferenceManager.h"
#include "td/telegram/files/FileManager.h"
#include "td/telegram/files/FileType.h"
#include "td/telegram/Global.h"
#include "td/telegram/InlineQueriesManager.h"
#include "td/telegram/logevent/LogEvent.h"
@ -20,6 +21,7 @@
#include "td/telegram/MessageContent.h"
#include "td/telegram/MessageContentType.h"
#include "td/telegram/MessageCopyOptions.h"
#include "td/telegram/MessageInputReplyTo.h"
#include "td/telegram/MessageReplyHeader.h"
#include "td/telegram/MessageSelfDestructType.h"
#include "td/telegram/misc.h"
@ -37,6 +39,7 @@
#include "td/utils/algorithm.h"
#include "td/utils/buffer.h"
#include "td/utils/format.h"
#include "td/utils/HashTableUtils.h"
#include "td/utils/logging.h"
#include "td/utils/misc.h"
#include "td/utils/Random.h"
@ -46,6 +49,7 @@
#include "td/utils/utf8.h"
#include <algorithm>
#include <limits>
#include <unordered_map>
namespace td {
@ -275,11 +279,11 @@ class QuickReplyManager::SendQuickReplyMessageQuery final : public Td::ResultHan
}
void on_error(Status status) final {
LOG(INFO) << "Receive error for SendQuickReplyMessageQuery: " << status;
if (G()->close_flag()) {
// do not send error, message will be re-sent after restart
return;
}
LOG(INFO) << "Receive error for SendQuickReplyMessageQuery: " << status;
td_->quick_reply_manager_->on_failed_send_quick_reply_messages(shortcut_id_, {random_id_}, std::move(status));
}
};
@ -324,11 +328,11 @@ class QuickReplyManager::SendQuickReplyInlineMessageQuery final : public Td::Res
}
void on_error(Status status) final {
LOG(INFO) << "Receive error for SendQuickReplyInlineMessageQuery: " << status;
if (G()->close_flag()) {
// do not send error, message will be re-sent after restart
return;
}
LOG(INFO) << "Receive error for SendQuickReplyInlineMessageQuery: " << status;
td_->quick_reply_manager_->on_failed_send_quick_reply_messages(shortcut_id_, {random_id_}, std::move(status));
}
};
@ -399,11 +403,11 @@ class QuickReplyManager::SendQuickReplyMediaQuery final : public Td::ResultHandl
}
void on_error(Status status) final {
LOG(INFO) << "Receive error for SendQuickReplyMediaQuery: " << status;
if (G()->close_flag()) {
// do not send error, message will be re-sent after restart
return;
}
LOG(INFO) << "Receive error for SendQuickReplyMediaQuery: " << status;
if (was_uploaded_) {
if (was_thumbnail_uploaded_) {
CHECK(thumbnail_file_id_.is_valid());
@ -1605,12 +1609,10 @@ Status QuickReplyManager::check_send_quick_reply_messages_response(
}
if (sent_random_ids.size() != random_ids.size()) {
return Status::Error("Receive duplicate random_id");
;
}
for (auto random_id : random_ids) {
if (sent_random_ids.count(random_id) != 1) {
return Status::Error("Don't receive expected random_id");
;
}
}
int32 new_shortcut_count = 0;

View File

@ -12,7 +12,6 @@
#include "td/telegram/Global.h"
#include "td/telegram/MessageId.h"
#include "td/telegram/MessagesManager.h"
#include "td/telegram/misc.h"
#include "td/telegram/PasswordManager.h"
#include "td/telegram/ServerMessageId.h"
#include "td/telegram/StoryId.h"