Telegram Clean Removed Users: Remove Deleted Accounts

There are many advertising accounts that have been kicked out of groups by the anti-advertising bot processing. That is, in the group's Permissions - Removed Users list.

Because advertising accounts get reported a lot, they actually get banned by Telegram relatively quickly, becoming Deleted Account

The purpose of this project is to clean up this list and remove accounts that have already been banned.

Once again, developed with GPT.
Based on our previous project, copy and paste the entire code into ChatGPT, then attach the following requirements
基于上面的代码, 实现以下功能:
在群组的 permissions - removed users 里面, 找出被封禁的账户 Deleted Account, 清除掉.

Github

Usage effect
📢 群组: FuckGFW-Newbie 翻墙新手村

✅ 保留: 7887288719 (Trinity Griselda) - 被踢出状态
⏭️ 跳过: 8125834274
🗑️ 检测到 Deleted Account: 7623369260,正在清理...
✅ 保留: 6331849477 (bk ) - 被踢出状态
✅ 保留: 6709325050 (易捷支付 机场特惠 ) - 被踢出状态
🗑️ 检测到 Deleted Account: 8173951376,正在清理...
🗑️ 检测到 Deleted Account: 7499278394,正在清理...
🗑️ 检测到 Deleted Account: 7548224690,正在清理...
...略
✅ 完成检查,共检查 55 人,清理掉 19 个 Deleted Account。
Where 8125834274 is what I set in the script for the test keep list.

Summary

Whether it's Exceptions or Removed users, they are all group members queried using the iter_participants function, just with different filters.
Whether clearing Exceptions or Removed users, both set an empty ChatBannedRights
await client(EditBannedRequest(entity, p.id, ChatBannedRights(until_date=None)))  # 清除记录

========

Related recommendations


Comments