mirror of
https://github.com/tdlight-team/tdlight-telegram-bot-api.git
synced 2025-01-31 22:27:38 +01:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
768793e88d
@ -6,7 +6,7 @@ if (POLICY CMP0065)
|
|||||||
cmake_policy(SET CMP0065 NEW)
|
cmake_policy(SET CMP0065 NEW)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
project(TelegramBotApi VERSION 5.5 LANGUAGES CXX)
|
project(TelegramBotApi VERSION 5.5.1 LANGUAGES CXX)
|
||||||
|
|
||||||
if (POLICY CMP0069)
|
if (POLICY CMP0069)
|
||||||
option(TELEGRAM_BOT_API_ENABLE_LTO "Use \"ON\" to enable Link Time Optimization.")
|
option(TELEGRAM_BOT_API_ENABLE_LTO "Use \"ON\" to enable Link Time Optimization.")
|
||||||
|
2
td
2
td
@ -1 +1 @@
|
|||||||
Subproject commit a53cb30e99f937cfd64e0266fa558785a184a553
|
Subproject commit 68212198a0e44086bd8a63d23365c3f56e391f0f
|
@ -5110,6 +5110,9 @@ void Client::on_update(object_ptr<td_api::Object> result) {
|
|||||||
if (name == "group_anonymous_bot_user_id" && update->value_->get_id() == td_api::optionValueInteger::ID) {
|
if (name == "group_anonymous_bot_user_id" && update->value_->get_id() == td_api::optionValueInteger::ID) {
|
||||||
group_anonymous_bot_user_id_ = move_object_as<td_api::optionValueInteger>(update->value_)->value_;
|
group_anonymous_bot_user_id_ = move_object_as<td_api::optionValueInteger>(update->value_)->value_;
|
||||||
}
|
}
|
||||||
|
if (name == "channel_bot_user_id" && update->value_->get_id() == td_api::optionValueInteger::ID) {
|
||||||
|
channel_bot_user_id_ = move_object_as<td_api::optionValueInteger>(update->value_)->value_;
|
||||||
|
}
|
||||||
if (name == "telegram_service_notifications_chat_id" &&
|
if (name == "telegram_service_notifications_chat_id" &&
|
||||||
update->value_->get_id() == td_api::optionValueInteger::ID) {
|
update->value_->get_id() == td_api::optionValueInteger::ID) {
|
||||||
service_notifications_user_id_ = move_object_as<td_api::optionValueInteger>(update->value_)->value_;
|
service_notifications_user_id_ = move_object_as<td_api::optionValueInteger>(update->value_)->value_;
|
||||||
@ -10887,33 +10890,6 @@ Client::FullMessageId Client::add_message(object_ptr<td_api::message> &&message,
|
|||||||
message_info->via_bot_user_id = message->via_bot_user_id_;
|
message_info->via_bot_user_id = message->via_bot_user_id_;
|
||||||
message_info->message_thread_id = message->message_thread_id_;
|
message_info->message_thread_id = message->message_thread_id_;
|
||||||
|
|
||||||
CHECK(message->sender_id_ != nullptr);
|
|
||||||
switch (message->sender_id_->get_id()) {
|
|
||||||
case td_api::messageSenderUser::ID: {
|
|
||||||
auto sender_id = move_object_as<td_api::messageSenderUser>(message->sender_id_);
|
|
||||||
message_info->sender_user_id = sender_id->user_id_;
|
|
||||||
CHECK(message_info->sender_user_id > 0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case td_api::messageSenderChat::ID: {
|
|
||||||
auto sender_id = move_object_as<td_api::messageSenderChat>(message->sender_id_);
|
|
||||||
message_info->sender_chat_id = sender_id->chat_id_;
|
|
||||||
|
|
||||||
auto chat_type = get_chat_type(chat_id);
|
|
||||||
if (chat_type != ChatType::Channel) {
|
|
||||||
if (message_info->sender_chat_id == chat_id) {
|
|
||||||
message_info->sender_user_id = group_anonymous_bot_user_id_;
|
|
||||||
} else {
|
|
||||||
message_info->sender_user_id = service_notifications_user_id_;
|
|
||||||
}
|
|
||||||
CHECK(message_info->sender_user_id > 0);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
UNREACHABLE();
|
|
||||||
}
|
|
||||||
|
|
||||||
message_info->initial_chat_id = 0;
|
message_info->initial_chat_id = 0;
|
||||||
message_info->initial_sender_user_id = 0;
|
message_info->initial_sender_user_id = 0;
|
||||||
message_info->initial_sender_chat_id = 0;
|
message_info->initial_sender_chat_id = 0;
|
||||||
@ -10956,9 +10932,39 @@ Client::FullMessageId Client::add_message(object_ptr<td_api::message> &&message,
|
|||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
message_info->is_automatic_forward = message_info->initial_chat_id != 0 && message_info->initial_message_id != 0 &&
|
auto from_chat_id = message->forward_info_->from_chat_id_;
|
||||||
message_info->initial_chat_id == message->forward_info_->from_chat_id_ &&
|
message_info->is_automatic_forward =
|
||||||
message_info->initial_message_id == message->forward_info_->from_message_id_;
|
from_chat_id != 0 && from_chat_id != chat_id && message->forward_info_->from_message_id_ != 0 &&
|
||||||
|
get_chat_type(chat_id) == ChatType::Supergroup && get_chat_type(from_chat_id) == ChatType::Channel;
|
||||||
|
}
|
||||||
|
|
||||||
|
CHECK(message->sender_id_ != nullptr);
|
||||||
|
switch (message->sender_id_->get_id()) {
|
||||||
|
case td_api::messageSenderUser::ID: {
|
||||||
|
auto sender_id = move_object_as<td_api::messageSenderUser>(message->sender_id_);
|
||||||
|
message_info->sender_user_id = sender_id->user_id_;
|
||||||
|
CHECK(message_info->sender_user_id > 0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case td_api::messageSenderChat::ID: {
|
||||||
|
auto sender_id = move_object_as<td_api::messageSenderChat>(message->sender_id_);
|
||||||
|
message_info->sender_chat_id = sender_id->chat_id_;
|
||||||
|
|
||||||
|
auto chat_type = get_chat_type(chat_id);
|
||||||
|
if (chat_type != ChatType::Channel) {
|
||||||
|
if (message_info->sender_chat_id == chat_id) {
|
||||||
|
message_info->sender_user_id = group_anonymous_bot_user_id_;
|
||||||
|
} else if (message_info->is_automatic_forward) {
|
||||||
|
message_info->sender_user_id = service_notifications_user_id_;
|
||||||
|
} else {
|
||||||
|
message_info->sender_user_id = channel_bot_user_id_;
|
||||||
|
}
|
||||||
|
CHECK(message_info->sender_user_id > 0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message->interaction_info_ != nullptr) {
|
if (message->interaction_info_ != nullptr) {
|
||||||
|
@ -990,6 +990,7 @@ class Client : public WebhookActor::Callback {
|
|||||||
int32 authorization_date_ = -1;
|
int32 authorization_date_ = -1;
|
||||||
|
|
||||||
int64 group_anonymous_bot_user_id_ = 0;
|
int64 group_anonymous_bot_user_id_ = 0;
|
||||||
|
int64 channel_bot_user_id_ = 0;
|
||||||
int64 service_notifications_user_id_ = 0;
|
int64 service_notifications_user_id_ = 0;
|
||||||
|
|
||||||
static std::unordered_map<td::string, Status (Client::*)(PromisedQueryPtr &query)> methods_;
|
static std::unordered_map<td::string, Status (Client::*)(PromisedQueryPtr &query)> methods_;
|
||||||
|
@ -200,7 +200,7 @@ int main(int argc, char *argv[]) {
|
|||||||
auto start_time = td::Time::now();
|
auto start_time = td::Time::now();
|
||||||
auto shared_data = std::make_shared<SharedData>();
|
auto shared_data = std::make_shared<SharedData>();
|
||||||
auto parameters = std::make_unique<ClientParameters>();
|
auto parameters = std::make_unique<ClientParameters>();
|
||||||
parameters->version_ = "5.5";
|
parameters->version_ = "5.5.1";
|
||||||
parameters->shared_data_ = shared_data;
|
parameters->shared_data_ = shared_data;
|
||||||
parameters->start_time_ = start_time;
|
parameters->start_time_ = start_time;
|
||||||
auto net_query_stats = td::create_net_query_stats();
|
auto net_query_stats = td::create_net_query_stats();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user