Check that all shortcut messages are loaded before sending a message there.

This commit is contained in:
levlam 2024-04-22 16:14:33 +03:00
parent c56c89f10d
commit 2424d681c9

View File

@ -2794,6 +2794,9 @@ Result<QuickReplyManager::Shortcut *> QuickReplyManager::create_new_local_shortc
auto *s = get_shortcut(name);
auto max_message_count = td_->option_manager_->get_option_integer("quick_reply_shortcut_message_count_max");
if (s != nullptr) {
if (!have_all_shortcut_messages(s)) {
return Status::Error(400, "The quick reply shortcut must be loaded first");
}
max_message_count -= s->server_total_count_ + s->local_total_count_;
} else {
auto max_shortcut_count = td_->option_manager_->get_option_integer("quick_reply_shortcut_count_max");