Add is_fake flag to user and chat

This commit is contained in:
Giuseppe Marino 2025-01-09 20:58:56 +01:00
parent 252db9b9ea
commit 6f622ccfd5
No known key found for this signature in database
GPG Key ID: C26F7A532ADEC25E
3 changed files with 35 additions and 4 deletions

View File

@ -9213,6 +9213,9 @@ components:
is_scam:
description: '*Optional*. Is the user reported for scam, clients show a warning to the user.'
type: boolean
is_fake:
description: '*Optional*. Is the user marked as fake by Telegram.'
type: boolean
required:
- id
- is_bot
@ -9281,6 +9284,9 @@ components:
is_scam:
description: '*Optional*. Is the chat reported for scam, clients show a warning to the user.'
type: boolean
is_fake:
description: '*Optional*. Is the chat marked as fake by Telegram.'
type: boolean
distance:
description: '*Optional*. Distance to the chat location in meters. Returned only in `getChatsNearby`.'
type: integer

View File

@ -491,6 +491,9 @@ class Client::JsonUser final : public td::Jsonable {
if (user_info != nullptr && user_info->is_scam) {
object("is_scam", td::JsonBool(user_info->is_scam));
}
if (user_info != nullptr && user_info->is_fake) {
object("is_fake", td::JsonBool(user_info->is_fake));
}
if (user_info != nullptr) {
json_store_user_status(object, user_info->status.get());
}
@ -1053,6 +1056,9 @@ class Client::JsonChat final : public td::Jsonable {
if (user_info->is_scam) {
object("is_scam", td::JsonBool(user_info->is_scam));
}
if (user_info->is_fake) {
object("is_fake", td::JsonBool(user_info->is_fake));
}
json_store_user_status(object, user_info->status.get());
// end custom properties impl
@ -1145,6 +1151,9 @@ class Client::JsonChat final : public td::Jsonable {
if (supergroup_info->is_scam) {
object("is_scam", td::JsonBool(supergroup_info->is_scam));
}
if (supergroup_info->is_fake) {
object("is_fake", td::JsonBool(supergroup_info->is_fake));
}
// end custom properties impl
if (is_full_) {
@ -14686,8 +14695,15 @@ void Client::add_user(UserInfo *user_info, object_ptr<td_api::user> &&user) {
user_info->language_code = std::move(user->language_code_);
// start custom properties
user_info->is_verified = user->verification_status_->is_verified_;
user_info->is_scam = user->verification_status_->is_scam_;
if (user->verification_status_ == nullptr) {
user_info->is_verified = false;
user_info->is_scam = false;
user_info->is_fake = false;
} else {
user_info->is_verified = user->verification_status_->is_verified_;
user_info->is_scam = user->verification_status_->is_scam_;
user_info->is_fake = user->verification_status_->is_fake_;
}
user_info->status = std::move(user->status_);
//end custom properties
@ -14777,8 +14793,15 @@ void Client::add_supergroup(SupergroupInfo *supergroup_info, object_ptr<td_api::
supergroup_info->join_by_request = supergroup->join_by_request_;
// start custom properties
supergroup_info->is_verified = supergroup->verification_status_->is_verified_;
supergroup_info->is_scam = supergroup->verification_status_->is_scam_;
if (supergroup->verification_status_ == nullptr) {
supergroup_info->is_verified = false;
supergroup_info->is_scam = false;
supergroup_info->is_fake = false;
} else {
supergroup_info->is_verified = supergroup->verification_status_->is_verified_;
supergroup_info->is_scam = supergroup->verification_status_->is_scam_;
supergroup_info->is_fake = supergroup->verification_status_->is_fake_;
}
// end custom properties
}

View File

@ -968,6 +968,7 @@ class Client final : public WebhookActor::Callback {
// start custom properties
bool is_verified = false;
bool is_scam = false;
bool is_fake = false;
object_ptr<td_api::UserStatus> status;
// end custom properties
@ -1030,6 +1031,7 @@ class Client final : public WebhookActor::Callback {
// start custom properties
bool is_verified = false;
bool is_scam = false;
bool is_fake = false;
// end custom properties
};
static void add_supergroup(SupergroupInfo *supergroup_info, object_ptr<td_api::supergroup> &&supergroup);