Available Methods¶
This page is about Pyrogram methods. All the methods listed here are bound to a Client instance,
except for idle(), which is a special function that can be found in the main package directly.
from pyrogram import Client
app = Client("my_account")
with app:
app.send_message("haskell", "hi")
Utilities¶
Start the client. |
|
Stop the Client. |
|
Start the client, idle the main script and finally stop the client. |
|
Restart the Client. |
|
Register an update handler. |
|
Remove a previously-registered update handler. |
|
Stop downloading or uploading a file. |
|
Export the current authorized session as a serialized string. |
|
Set the parse mode to be used globally by the client. |
Block the main script execution until a signal is received. |
Messages¶
Send text messages. |
|
Forward messages of any kind. |
|
Send photos. |
|
Send audio files. |
|
Send generic files. |
|
Send static .webp or animated .tgs stickers. |
|
Send video files. |
|
Send animation files (animation or H.264/MPEG-4 AVC video without sound). |
|
Send audio files. |
|
Send video messages. |
|
Send a group of photos or videos as an album. |
|
Send points on the map. |
|
Send information about a venue. |
|
Send phone contacts. |
|
Send any media stored on the Telegram servers using a file_id. |
|
Edit the text of messages. |
|
Edit the caption of media messages. |
|
Edit animation, audio, document, photo or video messages. |
|
Edit only the reply markup of messages sent by the bot. |
|
Edit the text of inline messages. |
|
Edit the caption of inline media messages. |
|
Edit inline animation, audio, document, photo or video messages. |
|
Edit only the reply markup of inline messages sent via the bot (for inline bots). |
|
Tell the other party that something is happening on your side. |
|
Delete messages, including service messages. |
|
Get one or more messages from a chat by using message identifiers. |
|
Retrieve a chunk of the history of a chat. |
|
Get the total count of messages in a chat. |
|
Mark a chat’s message history as read. |
|
Iterate through a chat history sequentially. |
|
Send a new poll. |
|
Vote a poll. |
|
Stop a poll which was sent by you. |
|
Retract your vote in a poll. |
|
Send a dice with a random value from 1 to 6. |
|
Search for text and media messages inside a specific chat. |
|
Search messages globally from all of your chats. |
|
Download the media from a message. |
Chats¶
Join a group chat or channel. |
|
Leave a group chat or channel. |
|
Kick a user from a group, a supergroup or a channel. |
|
Unban a previously kicked user in a supergroup or channel. |
|
Restrict a user in a supergroup. |
|
Promote or demote a user in a supergroup or a channel. |
|
Set a custom title (rank) to an administrator of a supergroup. |
|
Generate a new invite link for a chat; any previously generated link is revoked. |
|
Set a new chat photo or video (H.264/MPEG-4 AVC video, max 5 seconds). |
|
Delete a chat photo. |
|
Change the title of a chat. |
|
Change the description of a supergroup or a channel. |
|
Set default chat permissions for all members. |
|
Pin a message in a group, channel or your own chat. |
|
Unpin a message in a group, channel or your own chat. |
|
Use this method to clear the list of pinned messages in a chat. |
|
Get up to date information about a chat. |
|
Get information about one member of a chat. |
|
Get a chunk of the members list of a chat. |
|
Get the number of members in a chat. |
|
Iterate through the members of a chat sequentially. |
|
Get a chunk of the user’s dialogs. |
|
Iterate through a user’s dialogs sequentially. |
|
Get the total count of your dialogs. |
|
Update a channel or a supergroup username. |
|
Get the common chats you have with a user. |
|
Get nearby chats. |
|
Archive one or more chats. |
|
Unarchive one or more chats. |
|
Add new chat members to a group, supergroup or channel |
|
Create a new broadcast channel. |
|
Create a new basic group. |
|
Create a new supergroup. |
|
Delete a channel. |
|
Delete a supergroup. |
|
Set the slow mode interval for a chat. |
Users¶
Get your own user identity. |
|
Get information about a user. |
|
Get a list of profile pictures for a user or a chat. |
|
Get the total count of profile pictures for a user. |
|
Iterate through a chat or a user profile photos sequentially. |
|
Set a new profile photo or video (H.264/MPEG-4 AVC video, max 5 seconds). |
|
Delete your own profile photos. |
|
Update your own username. |
|
Update your profile details such as first name, last name and bio. |
|
Block a user. |
|
Unblock a user. |
Contacts¶
Add contacts to your Telegram address book. |
|
Get contacts from your Telegram address book. |
|
Get the total count of contacts from your Telegram address book. |
|
Delete contacts from your Telegram address book. |
Password¶
Enable the Two-Step Verification security feature (Cloud Password) on your account. |
|
Change your Two-Step Verification password (Cloud Password) with a new one. |
|
Turn off the Two-Step Verification security feature (Cloud Password) on your account. |
Bots¶
Get bot results via inline queries. |
|
Send an inline bot result. |
|
Send answers to callback queries sent from inline keyboards. |
|
Send answers to an inline query. |
|
Request a callback answer from bots. |
|
Send a game. |
|
Set the score of the specified user in a game. |
|
Get data for high score tables. |
Authorization¶
Connect the client to Telegram servers. |
|
Disconnect the client from Telegram servers. |
|
Initialize the client by starting up workers. |
|
Terminate the client by shutting down workers. |
|
Send the confirmation code to the given phone number. |
|
Re-send the confirmation code using a different type. |
|
Authorize a user in Telegram with a valid confirmation code. |
|
Authorize a bot using its bot token generated by BotFather. |
|
Register a new user in Telegram. |
|
Get your Two-Step Verification password hint. |
|
Check your Two-Step Verification password and log in. |
|
Send a code to your email to recover your password. |
|
Recover your password with a recovery code and log in. |
|
Accept the given terms of service. |
|
Log out from Telegram and delete the *.session file. |
Advanced¶
Methods used only when dealing with the raw Telegram API. Learn more about how to use the raw API at Advanced Usage.
Send raw Telegram queries. |
|
Get the InputPeer of a known peer id. |
|
Upload a file onto Telegram servers, without actually sending the message to anyone. |