mirror of
https://github.com/PaiGramTeam/telegram-bot-api.git
synced 2024-11-30 03:14:42 +00:00
Improve sendMediaGroup error message.
This commit is contained in:
parent
897ddb64ce
commit
b102163220
@ -6851,8 +6851,15 @@ void Client::on_message_send_failed(int64 chat_id, int64 old_message_id, int64 n
|
|||||||
auto query_id = extract_yet_unsent_message_query_id(chat_id, old_message_id, nullptr);
|
auto query_id = extract_yet_unsent_message_query_id(chat_id, old_message_id, nullptr);
|
||||||
auto &query = *pending_send_message_queries_[query_id];
|
auto &query = *pending_send_message_queries_[query_id];
|
||||||
if (query.is_multisend) {
|
if (query.is_multisend) {
|
||||||
if (query.error == nullptr) {
|
if (query.error == nullptr || query.error->message_ == "Group send failed") {
|
||||||
|
if (error->code_ == 429 || error->message_ == "Group send failed") {
|
||||||
query.error = std::move(error);
|
query.error = std::move(error);
|
||||||
|
} else {
|
||||||
|
auto pos = (query.total_message_count - query.awaited_message_count + 1);
|
||||||
|
query.error = make_object<td_api::error>(error->code_, PSTRING() << "Failed to send message #" << pos
|
||||||
|
<< " with the error message \""
|
||||||
|
<< error->message_ << '"');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
query.awaited_message_count--;
|
query.awaited_message_count--;
|
||||||
|
|
||||||
@ -8750,7 +8757,10 @@ void Client::on_sent_message(object_ptr<td_api::message> &&message, int64 query_
|
|||||||
auto emplace_result = yet_unsent_messages_.emplace(yet_unsent_message_id, yet_unsent_message);
|
auto emplace_result = yet_unsent_messages_.emplace(yet_unsent_message_id, yet_unsent_message);
|
||||||
CHECK(emplace_result.second);
|
CHECK(emplace_result.second);
|
||||||
yet_unsent_message_count_[chat_id]++;
|
yet_unsent_message_count_[chat_id]++;
|
||||||
pending_send_message_queries_[query_id]->awaited_message_count++;
|
|
||||||
|
auto &query = *pending_send_message_queries_[query_id];
|
||||||
|
query.awaited_message_count++;
|
||||||
|
query.total_message_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::abort_long_poll(bool from_set_webhook) {
|
void Client::abort_long_poll(bool from_set_webhook) {
|
||||||
|
@ -936,6 +936,7 @@ class Client final : public WebhookActor::Callback {
|
|||||||
struct PendingSendMessageQuery {
|
struct PendingSendMessageQuery {
|
||||||
PromisedQueryPtr query;
|
PromisedQueryPtr query;
|
||||||
bool is_multisend = false;
|
bool is_multisend = false;
|
||||||
|
int32 total_message_count = 0;
|
||||||
int32 awaited_message_count = 0;
|
int32 awaited_message_count = 0;
|
||||||
td::vector<td::string> messages;
|
td::vector<td::string> messages;
|
||||||
object_ptr<td_api::error> error;
|
object_ptr<td_api::error> error;
|
||||||
|
Loading…
Reference in New Issue
Block a user