mirror of
https://github.com/tdlight-team/tdlight-telegram-bot-api.git
synced 2025-01-01 07:05:49 +01:00
Add Client::get_same_chat_reply_to_message_id(const MessageInfo *message_info).
This commit is contained in:
parent
96d0d1c668
commit
13d68879d3
@ -1983,8 +1983,7 @@ void Client::JsonMessage::store(td::JsonValueScope *scope) const {
|
|||||||
object("forward_date", message_->initial_send_date);
|
object("forward_date", message_->initial_send_date);
|
||||||
}
|
}
|
||||||
if (need_reply_) {
|
if (need_reply_) {
|
||||||
auto reply_to_message_id =
|
auto reply_to_message_id = get_same_chat_reply_to_message_id(message_);
|
||||||
get_same_chat_reply_to_message_id(message_->reply_to_message.get(), message_->message_thread_id);
|
|
||||||
if (reply_to_message_id > 0) {
|
if (reply_to_message_id > 0) {
|
||||||
// internal reply
|
// internal reply
|
||||||
const MessageInfo *reply_to_message = client_->get_message(message_->chat_id, reply_to_message_id, true);
|
const MessageInfo *reply_to_message = client_->get_message(message_->chat_id, reply_to_message_id, true);
|
||||||
@ -4478,8 +4477,7 @@ void Client::on_get_callback_query_message(object_ptr<td_api::message> message,
|
|||||||
process_new_callback_query_queue(user_id, state);
|
process_new_callback_query_queue(user_id, state);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto reply_to_message_id =
|
auto reply_to_message_id = get_same_chat_reply_to_message_id(message_info);
|
||||||
get_same_chat_reply_to_message_id(message_info->reply_to_message.get(), message_info->message_thread_id);
|
|
||||||
LOG(INFO) << "Can't find callback query reply to message " << reply_to_message_id << " in chat " << chat_id
|
LOG(INFO) << "Can't find callback query reply to message " << reply_to_message_id << " in chat " << chat_id
|
||||||
<< ". It may be already deleted";
|
<< ". It may be already deleted";
|
||||||
}
|
}
|
||||||
@ -10965,10 +10963,7 @@ void Client::process_new_callback_query_queue(int64 user_id, int state) {
|
|||||||
state = 1;
|
state = 1;
|
||||||
}
|
}
|
||||||
if (state == 1) {
|
if (state == 1) {
|
||||||
auto reply_to_message_id = message_info == nullptr
|
auto reply_to_message_id = get_same_chat_reply_to_message_id(message_info);
|
||||||
? 0
|
|
||||||
: get_same_chat_reply_to_message_id(message_info->reply_to_message.get(),
|
|
||||||
message_info->message_thread_id);
|
|
||||||
if (reply_to_message_id > 0 && get_message(chat_id, reply_to_message_id, false) == nullptr) {
|
if (reply_to_message_id > 0 && get_message(chat_id, reply_to_message_id, false) == nullptr) {
|
||||||
queue.has_active_request_ = true;
|
queue.has_active_request_ = true;
|
||||||
return send_request(make_object<td_api::getRepliedMessage>(chat_id, message_id),
|
return send_request(make_object<td_api::getRepliedMessage>(chat_id, message_id),
|
||||||
@ -10983,10 +10978,7 @@ void Client::process_new_callback_query_queue(int64 user_id, int state) {
|
|||||||
return send_request(make_object<td_api::getStickerSet>(message_sticker_set_id),
|
return send_request(make_object<td_api::getStickerSet>(message_sticker_set_id),
|
||||||
td::make_unique<TdOnGetStickerSetCallback>(this, message_sticker_set_id, user_id, 0));
|
td::make_unique<TdOnGetStickerSetCallback>(this, message_sticker_set_id, user_id, 0));
|
||||||
}
|
}
|
||||||
auto reply_to_message_id = message_info == nullptr
|
auto reply_to_message_id = get_same_chat_reply_to_message_id(message_info);
|
||||||
? 0
|
|
||||||
: get_same_chat_reply_to_message_id(message_info->reply_to_message.get(),
|
|
||||||
message_info->message_thread_id);
|
|
||||||
if (reply_to_message_id > 0) {
|
if (reply_to_message_id > 0) {
|
||||||
auto reply_to_message_info = get_message(chat_id, reply_to_message_id, true);
|
auto reply_to_message_info = get_message(chat_id, reply_to_message_id, true);
|
||||||
auto reply_sticker_set_id =
|
auto reply_sticker_set_id =
|
||||||
@ -11284,7 +11276,16 @@ td::int64 Client::get_same_chat_reply_to_message_id(const object_ptr<td_api::mes
|
|||||||
CHECK(message->reply_to_ == nullptr);
|
CHECK(message->reply_to_ == nullptr);
|
||||||
return content_message_id;
|
return content_message_id;
|
||||||
}
|
}
|
||||||
return get_same_chat_reply_to_message_id(message->reply_to_, message->message_thread_id_);
|
return get_same_chat_reply_to_message_id(
|
||||||
|
message->reply_to_, message->message_thread_id_ < message->id_ ? message->message_thread_id_ : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
td::int64 Client::get_same_chat_reply_to_message_id(const MessageInfo *message_info) {
|
||||||
|
if (message_info == nullptr) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
auto message_thread_id = message_info->message_thread_id < message_info->id ? message_info->message_thread_id : 0;
|
||||||
|
return get_same_chat_reply_to_message_id(message_info->reply_to_message.get(), message_thread_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::drop_internal_reply_to_message_in_another_chat(object_ptr<td_api::message> &message) {
|
void Client::drop_internal_reply_to_message_in_another_chat(object_ptr<td_api::message> &message) {
|
||||||
|
@ -845,6 +845,8 @@ class Client final : public WebhookActor::Callback {
|
|||||||
|
|
||||||
static int64 get_same_chat_reply_to_message_id(const object_ptr<td_api::message> &message);
|
static int64 get_same_chat_reply_to_message_id(const object_ptr<td_api::message> &message);
|
||||||
|
|
||||||
|
static int64 get_same_chat_reply_to_message_id(const MessageInfo *message_info);
|
||||||
|
|
||||||
static void drop_internal_reply_to_message_in_another_chat(object_ptr<td_api::message> &message);
|
static void drop_internal_reply_to_message_in_another_chat(object_ptr<td_api::message> &message);
|
||||||
|
|
||||||
static td::Slice get_sticker_type(const object_ptr<td_api::StickerType> &type);
|
static td::Slice get_sticker_type(const object_ptr<td_api::StickerType> &type);
|
||||||
|
Loading…
Reference in New Issue
Block a user