EditChatAdminRequest
Only users can use this request. See code examples.
---functions--- messages.editChatAdmin#a85bd1c2 chat_id:long user_id:InputUser is_admin:Bool = Bool
Returns
Bool |
This type has no instances available.
Parameters
chat_id | long | |
user_id | InputUser | Anything entity-like will work if the library can find its Input version (e.g., usernames, Peer , User or Channel objects, etc.). |
is_admin | Bool |
Known RPC errors
This request can cause 1 known error:
ChatIdInvalidError | Invalid object ID for a chat. Make sure to pass the right types, for instance making sure that the request is designed for chats (not channels/megagroups) or otherwise look for a different one more suited\nAn example working with a megagroup and AddChatUserRequest, it will fail because megagroups are channels. Use InviteToChannelRequest instead. |
You can import these from telethon.errors
.
Example
Please refer to the documentation of client.edit_admin()
to learn about the parameters and see several code examples on how to use it.
The method above is the recommended way to do it. If you need more control over the parameters or want to learn how it is implemented, open the details by clicking on the "Details" text.
from telethon.sync import TelegramClient from telethon import functions, types with TelegramClient(name, api_id, api_hash) as client: result = client(functions.messages.EditChatAdminRequest( chat_id=-12398745604826, user_id='username', is_admin=False )) print(result)