Available Methods¶
This page is about Pyrofork methods. All the methods listed here are bound to a Client instance,
except for idle() and compose(), which are special functions that can be found in
the main package directly.
from pyrogram import Client
app = Client("my_account")
with app:
    app.send_message("me", "hi")
Utilities¶
Start the client.  | 
|
Stop the Client.  | 
|
Start the client, idle the main script and finally stop the client.  | 
|
Runs the given sync function (optionally with arguments) on a separate thread.  | 
|
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.  | 
|
Measure the round-trip time (RTT) to the Telegram server.  | 
Block the main script execution until a signal is received.  | 
|
Run multiple clients at once.  | 
Conversation¶
Send a message then listen for a message, callback query, etc.  | 
|
Listen for a message, callback query, etc.  | 
|
Gets a listener that matches the given data.  | 
|
Gets a listener that matches the given identifier pattern.  | 
|
Gets multiple listener that matches the given data.  | 
|
Gets multiple listener that matches the given identifier pattern.  | 
|
Registers a listener with a callback to be called when the listener is fulfilled.  | 
|
Removes a listener from the   | 
|
Stops a listener, calling stopped_handler if applicable or raising ListenerStopped if throw_exceptions is True.  | 
|
Stops all listeners that match the given identifier pattern.  | 
|
Wait for callback query.  | 
|
Wait for message.  | 
Messages¶
Add tasks to a todo list.  | 
|
Send text messages.  | 
|
Forward a media group by providing one of the message ids.  | 
|
Forward messages of any kind.  | 
|
Copy messages of any kind.  | 
|
Copy a media group by providing one of the message ids.  | 
|
Send photos.  | 
|
Send audio files.  | 
|
Send generic files.  | 
|
Send static .webp or animated .tgs stickers.  | 
|
Send a todo list to a chat.  | 
|
Send video files.  | 
|
Send animation files (animation or H.264/MPEG-4 AVC video without sound).  | 
|
Send audio files.  | 
|
Send video messages.  | 
|
Send Web Page Preview.  | 
|
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.  | 
|
Use this method to send reactions on a message/stories.  | 
|
Set the completion status of one or more todo tasks.  | 
|
Edit the text of messages.  | 
|
Edit the caption of media messages.  | 
|
Edit animation, audio, document, photo or video messages, or replace text with 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, or replace inline text with 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.  | 
|
Delete scheduled messages.  | 
|
Get all available effects.  | 
|
Get one or more messages from a chat by using message identifiers.  | 
|
Get the list of users who have read a message.  | 
|
Get one or more scheduled messages from a chat by using message identifiers.  | 
|
Get the media group a message belongs to.  | 
|
Get messages from a chat history.  | 
|
Get the total count of messages in a chat.  | 
|
Mark a chat's message history as read.  | 
|
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.  | 
|
Get the count of messages resulting from a search inside a chat.  | 
|
Search messages globally from all of your chats.  | 
|
Get the count of messages resulting from a global search.  | 
|
Searches for public channel posts with the given hashtag.  | 
|
Get the count of messages with the provided hashtag.  | 
|
Download the media from a message.  | 
|
Stream the media from a message chunk by chunk.  | 
|
Get the first discussion message of a channel post or a discussion thread in a group.  | 
|
Get the message replies of a discussion thread.  | 
|
Get the total count of replies in a discussion thread.  | 
|
Get information about custom emoji stickers by their identifiers.  | 
|
Transcribes the audio of a voice message.  | 
|
Translates a text or message(s) to the given language.  | 
|
Start bot  | 
|
Delete the history of a chat.  | 
Stories¶
Delete one or more story by using story identifiers.  | 
|
Edit story.  | 
|
Get one story link from an user by using story identifiers.  | 
|
Forward a story.  | 
|
Get all active stories.  | 
|
Get one or more story from an user by using story identifiers.  | 
|
Get stories history.  | 
|
Get all active stories from an user/channel by using user identifiers.  | 
|
Send new story.  | 
Chats¶
Join a group chat or channel.  | 
|
Leave a group chat or channel.  | 
|
Ban a user from a group, a supergroup or a channel.  | 
|
Unban a previously banned 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.  | 
|
Set a new chat photo or video (H.264/MPEG-4 AVC video, max 5 seconds).  | 
|
Delete a chat photo.  | 
|
Delete a user's folder.  | 
|
Export link to a user's folder.  | 
|
Create or update a user's folder.  | 
|
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 the members list of a chat.  | 
|
Get the number of members in a chat.  | 
|
Get a user's dialogs sequentially.  | 
|
Get the total count of your dialogs.  | 
|
Get one or more folders by using folder identifiers.  | 
|
Get one or more topic from a chat.  | 
|
Get one or more topic from a chat by using topic identifiers.  | 
|
Get forum topics count from a chat.  | 
|
Set a channel or a supergroup username.  | 
|
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.  | 
|
Delete all messages sent by a certain user in a supergroup.  | 
|
Set the slow mode interval for a chat.  | 
|
Mark a chat as unread.  | 
|
Get the actions taken by chat members and administrators in the last 48h.  | 
|
Get the number of members that are currently online in a chat.  | 
|
Get the list of "send_as" chats available.  | 
|
Set the default "send_as" chat for a chat.  | 
|
Set the chat protected content setting.  | 
|
Close a forum topic.  | 
|
Close a forum topic.  | 
|
Create a new forum topic.  | 
|
Delete a forum topic.  | 
|
Edit a forum topic.  | 
|
Edit a general forum topic.  | 
|
hide a general forum topic.  | 
|
Reopen a forum topic.  | 
|
Reopen a general forum topic.  | 
|
Transfer the owner of a chat or channel to another user.  | 
|
unhide a general forum topic.  | 
|
Update color  | 
|
Create or update a user's folder.  | 
Stickers¶
Add a sticker to stickerset.  | 
|
Create a new stickerset.  | 
|
Get info about a stickerset.  | 
Telegram Business¶
Send answers to pre-checkout queries.  | 
|
If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the API sends the confirmation in the form of an   | 
|
Delete messages on behalf of a business account.  | 
|
Use this method to get information about the connection of the bot with a business account.  | 
|
Return the gifts received and owned by a managed business account.  | 
|
Return the amount of Telegram Stars owned by a managed business account.  | 
|
Transfers Telegram Stars from the business account balance to the bot’s balance.  | 
Users¶
Get your own user identity.  | 
|
Get information about a user.  | 
|
Get a chat or a user profile photos sequentially.  | 
|
Get the total count of photos for a chat.  | 
|
Set a new profile photo or video (H.264/MPEG-4 AVC video, max 5 seconds).  | 
|
Delete your own profile photos.  | 
|
Set your own username.  | 
|
Update your birthday details.  | 
|
Update your birthday details.  | 
|
Update your profile details such as first name, last name and bio.  | 
|
Block a user.  | 
|
Unblock a user.  | 
|
Get the common chats you have with a user.  | 
|
Get the default emoji statuses.  | 
|
Set the emoji status.  | 
Invite Links¶
Get detailed information about a chat invite link.  | 
|
Generate a new primary invite link for a chat; any previously generated primary link is revoked.  | 
|
Create an additional invite link for a chat.  | 
|
Edit a non-primary invite link.  | 
|
Revoke a previously created invite link.  | 
|
Delete an already revoked invite link.  | 
|
Get the members who joined the chat with the invite link.  | 
|
Get the count of the members who joined the chat with the invite link.  | 
|
Get the invite links created by an administrator in a chat.  | 
|
Get the count of the invite links created by an administrator in a chat.  | 
|
Get the list of the administrators that have exported invite links in a chat.  | 
|
Get the pending join requests of a chat.  | 
|
Delete all revoked invite links of an administrator.  | 
|
Approve a chat join request.  | 
|
Approve all pending join requests in a chat.  | 
|
Decline a chat join request.  | 
|
Decline all pending join requests in a chat.  | 
Contacts¶
Add an existing Telegram user as contact, even without a phone number.  | 
|
Delete contacts from your Telegram address book.  | 
|
Import contacts to your Telegram address book.  | 
|
Get contacts from your Telegram address book.  | 
|
Get the total count of 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.  | 
|
Set the list of the bot's commands.  | 
|
Get the current list of the bot's commands for the given scope and user language.  | 
|
Delete the list of the bot's commands for the given scope and user language.  | 
|
Change the default privileges requested by the bot when it's added as an administrator to groups or channels.  | 
|
Get the current default privileges of the bot.  | 
|
Change the bot's menu button in a private chat, or the default menu button.  | 
|
Get the current value of the bot's menu button in a private chat, or the default menu button.  | 
|
Set the result of an interaction with a Web App and send a corresponding message on behalf of the user to the chat from which the query originated.  | 
|
Get the bot info in given language.  | 
|
Get the bot info in given language.  | 
|
Returns information about a given collectible item that was purchased at https://fragment.com .. include:: /_includes/usable-by/users.rst You must use exactly one of   | 
|
Returns the list of bots owned by the current user.  | 
|
Get a list of bots similar to the target bot.  | 
Payments¶
Apply a gift code.  | 
|
Get information about a gift code.  | 
|
Convert star gift to stars.  | 
|
Use this method to create a link for an invoice.  | 
|
Get information about a invoice or paid media.  | 
|
Get stars transactions.  | 
|
Get stars transactions by transaction id.  | 
|
Get all available star gifts to send.  | 
|
Get information about upgraded gift.  | 
|
Get the total count of owned gifts of specified chat.  | 
|
Get all gifts owned by specified chat.  | 
|
Hide the star gift from your profile.  | 
|
Refund the star to the user.  | 
|
Get upgraded gifts that can be bought from other owners.  | 
|
Use this method to send invoices.  | 
|
Send paid media.  | 
|
Use this method to send paid reactions on a channel message.  | 
|
Pay an invoice.  | 
|
Send star gift.  | 
|
Send an upgraded gift that is available for resale to another user or channel chat.  | 
|
Change resale price of a unique gift owned by the current user.  | 
|
Change the list of pinned gifts on the current user.  | 
|
Display the star gift in your profile.  | 
|
Transfer star gift to another user.  | 
|
Upgrade star gift to unique.  | 
|
Get the current Telegram Stars balance of the current account.  | 
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.  | 
|
Authorize a user in Telegram with a QR code.  | 
|
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.  | 
|
Log out from Telegram and delete the *.session file.  | 
|
Returns all active sessions of the current user.  | 
Advanced¶
Methods used only when dealing with the raw Telegram API. Learn more about how to use the raw API at Advanced Usage.
Invoke raw Telegram functions.  | 
|
Get the InputPeer of a known peer id.  | 
|
Upload a file onto Telegram servers, without actually sending the message to anyone.  |