Skip to content

Commit

Permalink
Don't process USER_PRIVACY_RESTRICTED errors for bots.
Browse files Browse the repository at this point in the history
  • Loading branch information
levlam committed Mar 9, 2023
1 parent c2a25b7 commit 6c53a61
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions td/telegram/ContactsManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1888,7 +1888,7 @@ class AddChatUserQuery final : public Td::ResultHandler {
}

void on_error(Status status) final {
if (status.message() == "USER_PRIVACY_RESTRICTED") {
if (!td_->auth_manager_->is_bot() && status.message() == "USER_PRIVACY_RESTRICTED") {
td_->contacts_manager_->send_update_add_chat_members_privacy_forbidden(DialogId(chat_id_), {user_id_},
"AddChatUserQuery");
return promise_.set_error(Status::Error(406, "USER_PRIVACY_RESTRICTED"));
Expand Down Expand Up @@ -1931,7 +1931,7 @@ class EditChatAdminQuery final : public Td::ResultHandler {
}

void on_error(Status status) final {
if (status.message() == "USER_PRIVACY_RESTRICTED") {
if (!td_->auth_manager_->is_bot() && status.message() == "USER_PRIVACY_RESTRICTED") {
// impossible now, because the user must be in the chat already
td_->contacts_manager_->send_update_add_chat_members_privacy_forbidden(DialogId(chat_id_), {user_id_},
"EditChatAdminQuery");
Expand Down Expand Up @@ -2793,7 +2793,7 @@ class InviteToChannelQuery final : public Td::ResultHandler {
}

void on_error(Status status) final {
if (status.message() == "USER_PRIVACY_RESTRICTED") {
if (!td_->auth_manager_->is_bot() && status.message() == "USER_PRIVACY_RESTRICTED") {
td_->contacts_manager_->send_update_add_chat_members_privacy_forbidden(
DialogId(channel_id_), std::move(user_ids_), "InviteToChannelQuery");
return promise_.set_error(Status::Error(406, "USER_PRIVACY_RESTRICTED"));
Expand Down Expand Up @@ -2839,7 +2839,7 @@ class EditChannelAdminQuery final : public Td::ResultHandler {
}

void on_error(Status status) final {
if (status.message() == "USER_PRIVACY_RESTRICTED") {
if (!td_->auth_manager_->is_bot() && status.message() == "USER_PRIVACY_RESTRICTED") {
td_->contacts_manager_->send_update_add_chat_members_privacy_forbidden(DialogId(channel_id_), {user_id_},
"EditChannelAdminQuery");
return promise_.set_error(Status::Error(406, "USER_PRIVACY_RESTRICTED"));
Expand Down Expand Up @@ -3000,7 +3000,7 @@ class EditChannelCreatorQuery final : public Td::ResultHandler {
}

void on_error(Status status) final {
if (status.message() == "USER_PRIVACY_RESTRICTED") {
if (!td_->auth_manager_->is_bot() && status.message() == "USER_PRIVACY_RESTRICTED") {
td_->contacts_manager_->send_update_add_chat_members_privacy_forbidden(DialogId(channel_id_), {user_id_},
"EditChannelCreatorQuery");
return promise_.set_error(Status::Error(406, "USER_PRIVACY_RESTRICTED"));
Expand Down

0 comments on commit 6c53a61

Please sign in to comment.