Add messageSendingStateFailed.need_another_reply_quote.

This commit is contained in:
levlam 2023-11-06 12:42:06 +03:00
parent d0f6791777
commit e7f70d0e09
2 changed files with 10 additions and 3 deletions

View File

@ -1223,8 +1223,9 @@ messageSendingStatePending sending_id:int32 = MessageSendingState;
//@error The cause of the message sending failure
//@can_retry True, if the message can be re-sent
//@need_another_sender True, if the message can be re-sent only on behalf of a different sender
//@need_another_reply_quote True, if the message can be re-sent only if another quote is chosen in the message that is replied by the given message
//@retry_after Time left before the message can be re-sent, in seconds. No update is sent when this field changes
messageSendingStateFailed error:error can_retry:Bool need_another_sender:Bool retry_after:double = MessageSendingState;
messageSendingStateFailed error:error can_retry:Bool need_another_sender:Bool need_another_reply_quote:Bool retry_after:double = MessageSendingState;
//@class MessageReplyTo @description Contains information about the message or the story a message is replying to

View File

@ -23997,9 +23997,11 @@ tl_object_ptr<td_api::MessageSendingState> MessagesManager::get_message_sending_
auto error_code = m->send_error_code > 0 ? m->send_error_code : 400;
auto need_another_sender =
can_retry && error_code == 400 && m->send_error_message == CSlice("SEND_AS_PEER_INVALID");
auto need_another_reply_quote =
can_retry && error_code == 400 && m->send_error_message == CSlice("QUOTE_TEXT_INVALID");
return td_api::make_object<td_api::messageSendingStateFailed>(
td_api::make_object<td_api::error>(error_code, m->send_error_message), can_retry, need_another_sender,
max(m->try_resend_at - Time::now(), 0.0));
need_another_reply_quote, max(m->try_resend_at - Time::now(), 0.0));
}
return nullptr;
}
@ -26450,7 +26452,8 @@ bool MessagesManager::can_edit_message(DialogId dialog_id, const Message *m, boo
bool MessagesManager::can_resend_message(const Message *m) const {
if (m->send_error_code != 429 && m->send_error_message != "Message is too old to be re-sent automatically" &&
m->send_error_message != "SCHEDULE_TOO_MUCH" && m->send_error_message != "SEND_AS_PEER_INVALID") {
m->send_error_message != "SCHEDULE_TOO_MUCH" && m->send_error_message != "SEND_AS_PEER_INVALID" &&
m->send_error_message != "QUOTE_TEXT_INVALID") {
return false;
}
if (m->is_bot_start_message) {
@ -28840,6 +28843,9 @@ bool MessagesManager::on_get_dialog_error(DialogId dialog_id, const Status &stat
reload_dialog_info_full(dialog_id, "SEND_AS_PEER_INVALID");
return true;
}
if (status.message() == CSlice("QUOTE_TEXT_INVALID")) {
return true;
}
switch (dialog_id.get_type()) {
case DialogType::User: