Client Reference
This page contains a summary of all the important methods and properties that you may need when using Telethon. They are sorted by relevance and are not in alphabetical order.
You should use this page to learn about which methods are available, and if you need a usage example or further description of the arguments, be sure to follow the links.
TelegramClient
This is a summary of the methods and properties you will find at TelegramClient.
Auth
Starts the client (connects and logs in if necessary). |
|
Sends the Telegram code needed to login to the given phone number. |
|
Logs in to Telegram to an existing user or bot account. |
|
Initiates the QR login procedure. |
|
Logs out Telegram and deletes the current |
|
Changes the 2FA settings of the logged in user. |
Base
Connects to Telegram. |
|
Disconnects from Telegram. |
|
Returns |
|
Property with a |
|
Property with the |
|
Changes the proxy which will be used on next (re)connection. |
Messages
Sends a message to the specified user, chat or channel. |
|
Edits the given message to change its text or media. |
|
Deletes the given messages, optionally "for everyone". |
|
Forwards the given messages to the specified entity. |
|
Iterator over the messages for the given chat. |
|
Same as |
|
Pins a message in a chat. |
|
Unpins a message in a chat. |
|
Marks messages as read and optionally clears mentions. |
Uploads
Sends message with the given file to the specified entity. |
|
Uploads a file to Telegram's servers, without sending it. |
Downloads
Downloads the given media from a message object. |
|
Downloads the profile photo from the given user, chat or channel. |
|
Low-level method to download files from their input location. |
|
Iterates over a file download, yielding chunks of the file. |
Dialogs
Iterator over the dialogs (open conversations/subscribed channels). |
|
Same as |
|
Edits the folder used by one or more dialogs to archive them. |
|
Iterator over draft messages. |
|
Same as |
|
Deletes a dialog (leaves a chat or channel). |
|
Creates a |
Users
Gets "me", the current User who is logged in. |
|
Return |
|
Returns |
|
Turns the given entity into a valid Telegram User, Chat or Channel. |
|
Turns the given entity into its input entity version. |
|
Gets the ID for the given entity. |
Chats
Iterator over the participants belonging to the specified chat. |
|
Same as |
|
Kicks a user from a chat. |
|
Iterator over the admin log for the specified channel. |
|
Same as |
|
Iterator over a user's profile photos or a chat's photos. |
|
Same as |
|
Edits admin permissions for someone in a chat. |
|
Edits user restrictions in a chat. |
|
Fetches the permissions of a user in a specific chat or channel or get Default Restricted Rights of Chat or Channel. |
|
Retrieves statistics from the given megagroup or broadcast channel. |
|
Returns a context-manager object to represent a "chat action". |
Parse Mode
This property is the default parse mode used when sending messages. |
Updates
Decorator used to |
|
Runs the event loop until the library is disconnected. |
|
Registers a new event handler callback. |
|
Inverse operation of |
|
Lists all registered event handlers. |
|
"Catches up" on the missed updates while the client was offline. |
|
Change the value of |
Bots
Makes an inline query to the specified bot ( |
Account
Returns a TelegramClient which calls methods behind a takeout session. |
|
Finishes the current takeout session. |