From 9bda968ea4ad5cc8ff538646e6a0fe1032d112e6 Mon Sep 17 00:00:00 2001 From: "jannik (Password 1234)" Date: Wed, 18 Nov 2020 06:05:25 -0800 Subject: [PATCH 1/3] Added is_verified and is_scam to user and chat objects --- telegram-bot-api/Client.cpp | 22 ++++++++++++++++++++++ telegram-bot-api/Client.h | 4 ++++ 2 files changed, 26 insertions(+) diff --git a/telegram-bot-api/Client.cpp b/telegram-bot-api/Client.cpp index 23008f7..f164b85 100644 --- a/telegram-bot-api/Client.cpp +++ b/telegram-bot-api/Client.cpp @@ -329,6 +329,12 @@ class Client::JsonUser : public Jsonable { if (user_info != nullptr && !user_info->language_code.empty()) { object("language_code", user_info->language_code); } + if (user_info != nullptr && user_info->is_verified) { + object("is_verified", td::JsonBool(user_info->is_verified)); + } + if (user_info != nullptr && user_info->is_scam) { + object("is_scam", td::JsonBool(user_info->is_scam)); + } if (is_bot && full_bot_info_) { object("can_join_groups", td::JsonBool(user_info->can_join_groups)); object("can_read_all_group_messages", td::JsonBool(user_info->can_read_all_group_messages)); @@ -582,6 +588,12 @@ class Client::JsonChat : public Jsonable { object("username", user_info->username); } object("type", "private"); + if (user_info->is_verified) { + object("is_verified", td::JsonBool(user_info->is_verified)); + } + if (user_info->is_scam) { + object("is_scam", td::JsonBool(user_info->is_scam)); + } if (is_full_) { if (!user_info->bio.empty()) { object("bio", user_info->bio); @@ -627,6 +639,12 @@ class Client::JsonChat : public Jsonable { } else { object("type", "channel"); } + if (supergroup_info->is_verified) { + object("is_verified", td::JsonBool(supergroup_info->is_verified)); + } + if (supergroup_info->is_scam) { + object("is_scam", td::JsonBool(supergroup_info->is_scam)); + } if (is_full_) { if (!supergroup_info->description.empty()) { object("description", supergroup_info->description); @@ -7934,6 +7952,8 @@ void Client::add_user(std::unordered_map &users, object_ptrlast_name = user->last_name_; user_info->username = user->username_; user_info->language_code = user->language_code_; + user_info->is_verified = user->is_verified_; + user_info->is_scam = user->is_scam_; user_info->have_access = user->have_access_; @@ -8003,6 +8023,8 @@ void Client::add_supergroup(std::unordered_map &supergrou supergroup_info->status = std::move(supergroup->status_); supergroup_info->is_supergroup = !supergroup->is_channel_; supergroup_info->has_location = supergroup->has_location_; + supergroup_info->is_verified = supergroup->is_verified_; + supergroup_info->is_scam = supergroup->is_scam_; } void Client::set_supergroup_description(int32 supergroup_id, td::string &&descripton) { diff --git a/telegram-bot-api/Client.h b/telegram-bot-api/Client.h index cc6a7a9..46dad90 100644 --- a/telegram-bot-api/Client.h +++ b/telegram-bot-api/Client.h @@ -556,6 +556,8 @@ class Client : public WebhookActor::Callback { td::string bio; + bool is_verified = false; + bool is_scam = false; bool have_access = false; bool can_join_groups = false; bool can_read_all_group_messages = false; @@ -592,6 +594,8 @@ class Client : public WebhookActor::Callback { bool is_supergroup = false; bool can_set_sticker_set = false; bool has_location = false; + bool is_verified = false; + bool is_scam = false; }; static void add_supergroup(std::unordered_map &supergroups, object_ptr &&supergroup); From d9b1d58b66e6da6e9d8e220349626dac30f9ef4b Mon Sep 17 00:00:00 2001 From: Jannik <32801117+code1mountain@users.noreply.github.com> Date: Thu, 19 Nov 2020 17:18:49 +0100 Subject: [PATCH 2/3] Receive Updates for Media with destruction timer --- telegram-bot-api/Client.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/telegram-bot-api/Client.cpp b/telegram-bot-api/Client.cpp index 1cce9d2..16ac177 100644 --- a/telegram-bot-api/Client.cpp +++ b/telegram-bot-api/Client.cpp @@ -8603,9 +8603,9 @@ bool Client::need_skip_update_message(int64 chat_id, const object_ptrttl_ > 0) { - return true; - } + //if (message->ttl_ > 0) { + // return true; + //} switch (message->content_->get_id()) { case td_api::messagePhoto::ID: { From af83c25b1667ce2600a943b809961fd618c4d822 Mon Sep 17 00:00:00 2001 From: Jannik <32801117+code1mountain@users.noreply.github.com> Date: Thu, 19 Nov 2020 17:21:19 +0100 Subject: [PATCH 3/3] Receive Updates for Media with destruction timer --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index e6e11e0..c05292a 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,8 @@ The `User` object now has two new fields: In addition, the member list now shows the full bot list (previously only the bot that executed the query was shown) +The bot will now receive Updates for all received media, even if a destruction timer is set. + ## Installation