【问题标题】:How to remove user from telegram channel using python如何使用python从电报频道中删除用户
【发布时间】:2021-05-15 04:16:31
【问题描述】:

我正在使用 telethon 在电报频道中添加用户,但如何从特定电报频道中删除或删除用户?

restrict user so they can’t see messages 使用EditBannedRequest 有一个功能,但我想从“特定”中删除或删除用户 电报频道

【问题讨论】:

    标签: python python-3.x telethon


    【解决方案1】:

    尝试使用https://tl.telethon.dev/index.html 的原始 API 请求

    请求应该是DeleteContactsRequest,可以在https://tl.telethon.dev/methods/contacts/delete_contacts.html找到

    例子

    from telethon.sync import TelegramClient
    from telethon import functions, types
    
    with TelegramClient(name, api_id, api_hash) as client:
        result = client(functions.contacts.DeleteContactsRequest(id=['username']))
        print(result.stringify())
    

    【讨论】:

    • 您好,很好的答案。如何指定需要删除用户的频道?假设用户跨越 3 个渠道,我只想删除其中 1 个渠道的用户。我怎样才能做到这一点?
    猜你喜欢
    • 2017-09-11
    • 2020-04-18
    • 1970-01-01
    • 2016-09-08
    • 1970-01-01
    • 2021-11-15
    • 2021-01-01
    • 2018-08-06
    • 1970-01-01
    相关资源
    最近更新 更多