Get Telegram channel admin id in telethon

Viewed 19

I use telethon

how can I get the id of an admin in a Telegram channel when the channel admin has banned a member of the channel.

For example, I have a Telegram channel with 6 admins. I want to be demoted whenever one of the admins bans a member from the channel

I wrote the following code

    channel=[-0000000000000]
    async def users(m):
        global channel,admin,rem,safe
        while True:
            async for rem in client.iter_admin_log(await client.get_entity(channel),limit=1,ban=True):
                admin=rem.user.id
                if admin not in safe:
                        await client.edit_admin(await client.get_entity(channel),rem.user,is_admin=False)
                        await client.send_message("me","user demoted")

But there is a problem in the liver, it doesn't work and doesn't even send blood. Thank you for your help

0 Answers
Related