V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
leavic
V2EX  ›  Telegram

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

  •  
  •   leavic · 2022-11-30 16:07:57 +08:00 · 3623 次点击
    这是一个创建于 484 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

    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())
    
    11 条回复    2023-09-02 15:10:24 +08:00
    Cagliostro
        1
    Cagliostro  
       2022-11-30 19:34:20 +08:00 via iPhone
    好东西,正好缺。
    nah
        2
    nah  
       2022-11-30 19:39:07 +08:00
    好评。现在点赞也危险了,点赞之类的可以删吗?
    233373
        3
    233373  
       2022-11-30 20:24:00 +08:00
    有没有 for nodejs 版本
    CatCode
        4
    CatCode  
       2022-11-30 22:58:08 +08:00
    有没有批量删除的 API ,一个请求一条还是太慢了
    Pichai
        5
    Pichai  
       2022-11-30 23:04:39 +08:00
    telegram 的中文搜索那么辣鸡,感觉没必要担心吧!
    flexbug
        6
    flexbug  
       2022-11-30 23:30:49 +08:00 via iPhone
    安卓上的 nekogram 这个第三方客户端自带删除群组自己的发言
    Rookie01
        7
    Rookie01  
       345 天前
    请问这个方法还可以用吗?为什么我的运行提示
    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
        8
    darkzack  
       338 天前   ❤️ 1
    @Rookie01

    app = Client("AnyString")
    改成
    app = Client("my_account", api_id=api_id, api_hash=api_hash)
    Rookie01
        9
    Rookie01  
       335 天前
    @darkzack 老哥再请教一下,我按照你说的那样修改之后运行这样提示:
    The api_id/api_hash combination is invalid
    Enter phone number or bot token:
    输入什么都不对,不知道是不是我当时创建 API 的时候选错选项了,好像这个 API 还不能修改和删除。
    darkzack
        10
    darkzack  
       333 天前 via iPhone
    @Rookie01 这里没问题,这是要登录你的账号,要带国家号码的,跟你登录 tg 一样,例如你号码要输入+8613912345678
    Mickeyy
        11
    Mickeyy  
       208 天前
    好用,感谢。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1135 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 22:57 · PVG 06:57 · LAX 15:57 · JFK 18:57
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.