I am using telethon for adding users in the telegram channel but how to remove or delete users from Particular telegram channels?

There is one function to restrict user so they can’t see messages using EditBannedRequest but I want to remove or delete the user from Particular
telegram channel


Try using the raw API requests at https://tl.telethon.dev/index.html

The request should be DeleteContactsRequest which can be found at 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']))

Source: https://stackoverflow.com/q/67543210

146 7 7 0