From e15dd05975975139fee4ecb87e6c9525cde41e63 Mon Sep 17 00:00:00 2001 From: Kyle2142 Date: Fri, 9 Feb 2018 10:07:25 +0200 Subject: [PATCH] Corrected info in Admin Permissions example (#589) --- .../extra/examples/chats-and-channels.rst | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/readthedocs/extra/examples/chats-and-channels.rst b/readthedocs/extra/examples/chats-and-channels.rst index 30b94178..44ee6112 100644 --- a/readthedocs/extra/examples/chats-and-channels.rst +++ b/readthedocs/extra/examples/chats-and-channels.rst @@ -169,14 +169,28 @@ Giving or revoking admin permissions can be done with the `EditAdminRequest`__: pin_messages=True, invite_link=None, edit_messages=None - ) + ) + # Equivalent to: + # rights = ChannelAdminRights( + # change_info=True, + # delete_messages=True, + # pin_messages=True + # ) - client(EditAdminRequest(channel, who, rights)) + # Once you have a ChannelAdminRights, invoke it + client(EditAdminRequest(channel, user, 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`__. + # User will now be able to change group info, delete other people's + # messages and pin messages. + +| Thanks to `@Kyle2142`__ for `pointing out`__ that you **cannot** set all +| parameters to ``True`` to give a user full permissions, as not all +| permissions are related to both broadcast channels/megagroups. +| +| E.g. trying to set ``post_messages=True`` in a megagroup will raise an +| error. It is recommended to always use keyword arguments, and to set only +| the permissions the user needs. If you don't need to change a permission, +| it can be omitted (full list `here`__). __ https://lonamiwebs.github.io/Telethon/methods/channels/edit_admin.html __ https://github.com/Kyle2142