-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Admin Permissions
Lonami edited this page Dec 14, 2017
·
2 revisions
Giving or revoking admin permissions can be done with the EditAdminRequest
:
from telethon.tl.functions.channels import EditAdminRequest
from telethon.tl.types import ChannelAdminRights
# You need both the channel and who to grant permissions
# They can either be channel/user or input channel/input user.
#
# ChannelAdminRights is a list of granted permissions.
# Set to True those you want to give.
rights = ChannelAdminRights(
post_messages=None,
add_admins=None,
invite_users=None,
change_info=True,
ban_users=None,
delete_messages=True,
pin_messages=True,
invite_link=None,
edit_messages=None
)
client(EditAdminRequest(channel, who, rights))
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).