自动删除自己在 Telegram 群组内的全部发言

2022-11-30 16:07:57 +08:00
 leavic

家人们,不废话,上链接:

https://github.com/lifetyper/TelegramRunAway

不骗 Star 版本:

from pyrogram import Client
from pyrogram.enums import ChatType

api_id = YOUR_APP_ID
api_hash = "YOUR_APP_HASH)"
app = Client("AnyString")


async def main():
    async with app:
        async for dialog in app.get_dialogs():
            if dialog.chat.type in [ChatType.SUPERGROUP, ChatType.GROUP]:
                print("Cleaning Messages in Group:{}...".format(dialog.chat.title))
                async for msg in app.search_messages(chat_id=dialog.chat.id, from_user="me"):
                    if msg.text:
                        print("Deleting Message Contents:{}...".format(msg.text))
                    await app.delete_messages(chat_id=dialog.chat.id, message_ids=msg.id)


app.run(main())
3715 次点击
所在节点    Telegram
11 条回复
Cagliostro
2022-11-30 19:34:20 +08:00
好东西,正好缺。
nah
2022-11-30 19:39:07 +08:00
好评。现在点赞也危险了,点赞之类的可以删吗?
233373
2022-11-30 20:24:00 +08:00
有没有 for nodejs 版本
CatCode
2022-11-30 22:58:08 +08:00
有没有批量删除的 API ,一个请求一条还是太慢了
Pichai
2022-11-30 23:04:39 +08:00
telegram 的中文搜索那么辣鸡,感觉没必要担心吧!
flexbug
2022-11-30 23:30:49 +08:00
安卓上的 nekogram 这个第三方客户端自带删除群组自己的发言
Rookie01
2023-04-18 16:07:34 +08:00
请问这个方法还可以用吗?为什么我的运行提示
raise AttributeError("The API key is required for new authorizations. "
AttributeError: The API key is required for new authorizations. More info: https://docs.pyrogram.org/start/auth
darkzack
2023-04-25 18:54:37 +08:00
@Rookie01

app = Client("AnyString")
改成
app = Client("my_account", api_id=api_id, api_hash=api_hash)
Rookie01
2023-04-28 22:32:43 +08:00
@darkzack 老哥再请教一下,我按照你说的那样修改之后运行这样提示:
The api_id/api_hash combination is invalid
Enter phone number or bot token:
输入什么都不对,不知道是不是我当时创建 API 的时候选错选项了,好像这个 API 还不能修改和删除。
darkzack
363 天前
@Rookie01 这里没问题,这是要登录你的账号,要带国家号码的,跟你登录 tg 一样,例如你号码要输入+8613912345678
Mickeyy
238 天前
好用,感谢。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/899108

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX