diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index 0ba73140..4d16e7ca 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -4394,9 +4394,20 @@ 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 (td_->auth_manager_->is_bot()) { + if (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); + } + + auto new_until_date = status.get_until_date(); + if (new_until_date >= 1840000000 && status.is_restricted()) { + status = DialogParticipantStatus::Restricted( + status.is_member(), new_until_date - 300000000, status.can_send_messages(), status.can_send_media(), + status.can_send_stickers(), status.can_send_animations(), status.can_send_games(), + status.can_use_inline_bots(), status.can_add_web_page_previews(), old_status.can_send_polls(), + old_status.can_change_info_and_settings(), old_status.can_invite_users(), old_status.can_pin_messages()); + } } if (old_status == status) { return promise.set_value(Unit());