From e23ecdf572d21ba486f886d60cb720636feed120 Mon Sep 17 00:00:00 2001 From: levlam Date: Thu, 20 Jun 2019 20:34:08 +0300 Subject: [PATCH] Allow bots to restrict left chat members without trying to add them. GitOrigin-RevId: b2884da3cdc524634b23d1d149bdb66bc6fa206d --- td/telegram/ContactsManager.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index 218c8c00..678b31ed 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -4390,6 +4390,10 @@ void ContactsManager::change_channel_participant_status_impl(ChannelId channel_i DialogParticipantStatus status, DialogParticipantStatus old_status, Promise &&promise) { + if (td_->auth_manager_->is_bot() && status.is_restricted() && status.is_member() && !old_status.is_member()) { + // allow bots to restrict left chat members without trying to add them + status.set_is_member(false); + } if (old_status == status) { return promise.set_value(Unit()); }