Admin Permissions - LonamiWebs/Telethon GitHub Wiki
Giving or revoking admin permissions can be done with the following code:
# Give admin permissions to user in chat/channel
client.edit_admin(channel, who, is_admin=True)
# Revoke admin for user in chat/channel
client.edit_admin(channel, who, is_admin=False)
Note that you can also deny/allow specific permissions for an admin using the positional arguments of edit_admin
. More about this method and the arguments it takes here.
Thanks to @Kyle2142 for pointing out that you cannot set to True
the post_messages
and edit_messages
fields. Those that are None
can be omitted (left here so you know which are available).