diff --git a/CMakeLists.txt b/CMakeLists.txt index 9af6665..245e6a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ if (POLICY CMP0065) cmake_policy(SET CMP0065 NEW) endif() -project(TelegramBotApi VERSION 5.3 LANGUAGES CXX) +project(TelegramBotApi VERSION 5.3.1 LANGUAGES CXX) add_subdirectory(td EXCLUDE_FROM_ALL) diff --git a/td b/td index cf2be88..f8ab675 160000 --- a/td +++ b/td @@ -1 +1 @@ -Subproject commit cf2be88c34b1b844fb9c2cdf28c3b5f0cce6be6b +Subproject commit f8ab675ad14080b1609b5904c366052c814d1788 diff --git a/telegram-bot-api/Client.cpp b/telegram-bot-api/Client.cpp index 8e6128f..3141861 100644 --- a/telegram-bot-api/Client.cpp +++ b/telegram-bot-api/Client.cpp @@ -81,6 +81,19 @@ void Client::fail_query_with_error(PromisedQueryPtr query, int32 error_code, Sli } error_code = 400; + } else if (error_code == 403) { + bool is_server_error = true; + for (auto c : error_message) { + if (c == '_' || ('A' <= c && c <= 'Z') || td::is_digit(c)) { + continue; + } + + is_server_error = false; + break; + } + if (is_server_error) { + error_code = 400; + } } if (error_code == 400) { if (!default_message.empty()) { @@ -10192,7 +10205,7 @@ bool Client::need_skip_update_message(int64 chat_id, const object_ptrttl_ > 0 && message->ttl_expires_in_ == 0) { + if (message->ttl_ > 0 && message->ttl_expires_in_ == message->ttl_) { return true; } */ diff --git a/telegram-bot-api/ClientManager.cpp b/telegram-bot-api/ClientManager.cpp index 6beec0b..3fc9106 100644 --- a/telegram-bot-api/ClientManager.cpp +++ b/telegram-bot-api/ClientManager.cpp @@ -397,6 +397,7 @@ void ClientManager::start_up() { // init tqueue { + auto load_start_time = td::Time::now(); auto tqueue_binlog = td::make_unique>(); auto binlog = td::make_unique(); auto tqueue = td::TQueue::create(); @@ -413,7 +414,6 @@ void ClientManager::start_up() { }) .ensure(); tqueue_binlog.reset(); - LOG(WARNING) << "Loaded " << loaded_event_count << " TQueue events"; if (!failed_to_replay_log_event_ids.empty()) { LOG(ERROR) << "Failed to replay " << failed_to_replay_log_event_ids.size() << " TQueue events"; @@ -428,6 +428,9 @@ void ClientManager::start_up() { tqueue->set_callback(std::move(concurrent_tqueue_binlog)); parameters_->shared_data_->tqueue_ = std::move(tqueue); + + LOG(WARNING) << "Loaded " << loaded_event_count << " TQueue events in " << (td::Time::now() - load_start_time) + << " seconds"; } // init webhook_db and user_db diff --git a/telegram-bot-api/Query.cpp b/telegram-bot-api/Query.cpp index f53c93d..98dcad3 100644 --- a/telegram-bot-api/Query.cpp +++ b/telegram-bot-api/Query.cpp @@ -126,7 +126,7 @@ void Query::send_request_stat() const { void Query::send_response_stat() const { auto now = td::Time::now(); - if (now - start_timestamp_ >= 100.0) { + if (now - start_timestamp_ >= 100.0 && !is_internal_) { LOG(WARNING) << "Answer too old query with code " << http_status_code_ << " and answer size " << answer_.size() << ": " << *this; } diff --git a/telegram-bot-api/telegram-bot-api.cpp b/telegram-bot-api/telegram-bot-api.cpp index e80763e..62efff3 100644 --- a/telegram-bot-api/telegram-bot-api.cpp +++ b/telegram-bot-api/telegram-bot-api.cpp @@ -192,7 +192,7 @@ int main(int argc, char *argv[]) { auto start_time = td::Time::now(); auto shared_data = std::make_shared(); auto parameters = std::make_unique(); - parameters->version_ = "5.3"; + parameters->version_ = "5.3.1"; parameters->shared_data_ = shared_data; parameters->start_time_ = start_time; auto net_query_stats = td::create_net_query_stats();